Commit Graph
100 Commits
Author SHA1 Message Date
Alex Waygood 2539649560 Add a default for ssl.SSLContext.__new__ on 3.10+ (#9635) 2023-01-31 17:30:00 -08:00
Alex Waygood 510bd460d2 Improve statistics.median_grouped on <=3.10 (#9636) 2023-01-31 17:29:01 -08:00
Alex Waygood cec6162146 Bump flake8-pyi to 23.1.2 (#9643) 2023-02-01 00:07:09 +00:00
Alex Waygood 9e71de0421 Improve several stdlib setdefault methods (#9612) 2023-01-31 15:39:24 -08:00
Alex WaygoodandJelle Zijlstra c54a1a9e16 urllib.parse: Fix issues with TypeVar usage and default values (#9629)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-01-31 02:21:50 +00:00
Alex Waygood a6919227be Add several version-dependent default values to parameters in the stdlib (#9631) 2023-01-31 01:21:39 +00:00
Alex Waygood 81463b9995 tempfile.SpooledTemporaryFile: fix overloads (#9627) 2023-01-30 17:04:18 -08:00
Alex Waygood 8a098a8601 Various asyncio classes: remove the loop argument on 3.10 (#9630) 2023-01-30 16:55:08 -08:00
Alex Waygood 94065d3aa5 Fix typo in tests/regr_test.py (#9628)
It looks like in #9382, I reintroduced the bug that I previously fixed in #9349
2023-01-30 22:56:44 +00:00
Alex Waygood 9099403d58 builtins.pow: Add default values to <py38 branches; remove incorrect = ...s for the 13th overload (#9610) 2023-01-30 18:12:50 +01:00
Alex Waygood b748a9a543 distutils.filelist overloads: Remove unnecessary = ...s (#9619) 2023-01-30 18:02:57 +01:00
Alex Waygood 7958a7f934 RawConfigParser.__init__: fix overloads (#9613) 2023-01-30 18:00:43 +01:00
Alex Waygood b5a26d1ca2 email.message: Fix invalid TypeVar usage; add some default values (#9620) 2023-01-30 17:56:29 +01:00
Alex Waygood 6011cac0cc Stdlib: fix three trivial issues with parameter defaults (#9618) 2023-01-29 21:40:56 -08:00
Alex Waygood 1b5bd63f78 Bump isort to 5.12.0 (#9617) 2023-01-29 16:37:55 -08:00
Alex Waygood dd3aedd133 Correct str.maketrans and collections.UserString.maketrans (#9611) 2023-01-29 11:45:08 -08:00
Alex Waygood 25b3999a10 croniter: complete stubs (#9584) 2023-01-29 11:41:09 -08:00
Alex Waygood 5dfee6aa66 Add some missing py311+ constants to sre_constants.pyi (#9614) 2023-01-29 11:33:37 -08:00
Alex Waygood c9f17d80fa _bisect: Remove incorrect = ...s for several overloads (#9609) 2023-01-29 10:06:39 -08:00
Alex Waygood 33a62ae42d Add more defaults to the stdlib (#9606)
Continuing work towards #8988.

The first five commits were created using stubdefaulter on various Python versions; the following commits were all created manually by me to fix various problems. The main things this adds that weren't present in #9501 are:

- Defaults in Windows-only modules and Windows-only branches (because I'm running a Windows machine)
- Defaults in non-py311 branches
- Defaults for float parameters
- Defaults for overloads
2023-01-29 01:51:23 +00:00
Alex Waygood 25e02db42c Fix typo in parse_metadata.read_stubtest_settings (#9605)
Fixes #9603
2023-01-29 00:40:42 +00:00
Alex Waygood 9cd20ce095 Improve stubsabot logic for finding the first release with a py.typed file (#9600) 2023-01-28 18:03:25 +00:00
Alex Waygood b316dd947e Bump flake8-pyi to 23.1.1 (#9599) 2023-01-28 07:39:30 -08:00
Alex Waygood 32ebe323f5 Use a TypeGuard for dataclasses.is_dataclass(); refine asdict(), astuple(), fields(), replace() (#9362) 2023-01-28 15:14:22 +00:00
Alex Waygood c216b74e39 Centralize METADATA.toml parsing in the test suite (#9534) 2023-01-28 15:13:46 +00:00
Alex Waygood 7f986bdf85 Add more overloads to the re stubs to help out pyright (#9592) 2023-01-27 18:32:50 -08:00
Alex Waygood a9b4fa0a32 Fix some stubtest complaints before they happen (#9585)
Add missing objects to various stubs
2023-01-24 21:45:31 +00:00
Alex Waygood 307aadc632 Improve the signature of types.MappingProxyType.__eq__ (#9581) 2023-01-23 14:41:27 +01:00
Alex Waygood d98d1674e7 Fix a few issues with parameter defaults (#9572) 2023-01-20 09:47:59 -08:00
Alex Waygood a4e3cfefac Improve pre-commit config (#9563)
- Add a few more hooks. These are all very fast, and I've found them useful in other projects:
  - Autofixes:
    - `trailing-whitespace`: fixes trailing whitespace
    - `requirements-txt-fixer`: alphabetises items in `requirements.txt` files
    - `end-of-file-fixer`: makes sure every file ends with a single newline character
    - `mixed-line-ending`: Makes sure Windows users don't accidentally introduce CRLF line endings into a file that uses LF line endings
  - None-autofixes:
    - `check-yaml`: loads YAML files to validate syntax
    - `check-toml`: loads TOML files to validate syntax
    - `check-merge-conflict`: detects merge-conflict strings in files and blocks them from accidentally being committed
    - `check-case-conflict`: checks for files with names that would conflict on a case-insensitive filesystem like MacOS HFS+ or Windows FAT; blocks them from being committed.
  - Change the bot schedule to quarterly, to reduce noisy PRs
  - Change the `black` language target-version to Python 3.10, synching the setting here with the changes that were made to our `pyproject.toml` file in #7538
2023-01-18 06:29:18 -08:00
Alex Waygood 4fea314594 Replace Any with Incomplete in many places (#9558) 2023-01-18 08:48:16 +00:00
Alex Waygood 242ef6f2bd Bump pytype to 2023.1.17 (#9559) 2023-01-18 01:35:11 +01:00
Alex Waygood 3d6b8dccfe mypy_test.py: Try using a process pool instead of a thread pool (#9556) 2023-01-17 14:17:45 +00:00
Alex Waygood 2b9f200e7e Reenable flake8-pyi's Y011 and Y015 (#9551) 2023-01-16 22:52:40 +00:00
Alex Waygood 597e1a0078 Bump various test dependencies (#9549) 2023-01-16 11:04:45 -08:00
Alex Waygood c8c5953aa0 Xlib: Import Pattern from re, not typing (#9544)
Refs https://github.com/PyCQA/flake8-pyi/pull/324
2023-01-16 10:09:06 +00:00
Alex Waygood 0a291da2f0 Pin fpdf2 stubs to 2.6.0 (#9535)
They will need some updates to become compatible with `fpdf2` 2.6.1.

Closes #9524
2023-01-14 18:39:04 +00:00
Alex Waygood 9a76e5a669 Flask-Migrate: Add Flask as a dependency (#9517) 2023-01-13 00:24:13 +00:00
Alex Waygood 8736b7a565 Flask-Cors: Add Flask as a dependency (#9516) 2023-01-13 00:13:58 +00:00
Alex Waygood 00d663e109 third_party_stubtest: use MYPYPATH for internal dependencies (#9512) 2023-01-12 13:13:42 -08:00
Alex Waygood 0b903441e8 Allow stubs to depend on numpy (#9499) 2023-01-12 09:01:23 +00:00
Alex Waygood ab1921a737 Teach isort that imports from utils are first-party imports (#9500) 2023-01-11 17:25:32 +01:00
Alex Waygood e2d67bf703 Delete stubs for cryptography (#9459)
Typeshed's stubs for `paramiko` and `pyOpenSSL` now depend on the `cryptography` package, which now provides inline types at runtime
2023-01-10 22:16:11 +00:00
Alex Waygood 9aa3d99ac2 mypy_test.py: Add more comments (#9477)
Some fairly subtle logic was added in #9408, and I'm immediately regretting not having documented it slightly better. This PR adds some more comments to make maintaining this code easier in the future.
2023-01-08 12:26:11 -08:00
Alex Waygood 910397c714 mypy_test.py: Simplify add_third_party_files() (#9476) 2023-01-08 12:25:06 -08:00
Alex Waygood 4d6fda99f0 mypy_test.py: Allow non-types dependencies (#9408)
The approach is pretty similar to the approach I took in #9382 for regr_test.py: dynamically create virtual environments for testing stubs packages in isolation. However, since mypy_test.py tests all of typeshed's stubs in succession (and since lots of typeshed's stubs packages depend on other typeshed stubs packages), the performance issues with creating a virtual environment for testing each stubs package are even more severe than with regr_test.py.

I mitigate the performance issues associated with dynamically creating virtual environments in two ways:

- Dynamically creating venvs is mostly slow due to I/O bottlenecks. Creating the virtual environments can be sped up dramatically by creating them concurrently in a threadpool. The same goes for pip installing the requirements into the venvs -- though unfortunately, we have to use pip with --no-cache-dir, as the pip cache gets easily corrupted if you try to do concurrent reads and writes to the pip cache.

- If types-pycocotools requires numpy>=1 and types-D3DShot also requires numpy>=1 (for example), there's no need to create 2 virtual environments. The same requirements have been specified, so they can share a virtual environment between them. This means we don't have to create nearly so many virtual environments.
2023-01-07 23:57:49 +00:00
Alex Waygood 28abff4efe Revert "Use --additional-flags='check-untyped-defs' when running mypy_primer" (#9451)
Revert "Use `--additional-flags='check-untyped-defs'` when running mypy_primer (#9433)"

This reverts commit f794cdd582.
2023-01-03 22:58:32 +00:00
Alex Waygood a7f1d3c08d Improve mypy flags for regr_test.py and typecheck_typeshed.py (#9441)
- Remove redundant flags that are now enabled by default
- Add `--pretty` to `typecheck_typeshed.py`
2023-01-02 12:01:44 +00:00
Alex Waygood f794cdd582 Use --additional-flags='check-untyped-defs' when running mypy_primer (#9433) 2022-12-31 11:01:54 -08:00
Alex Waygood ba54f148ef Colorize third-party stubtest and stubsabot outputs in CI (#9432) 2022-12-31 14:22:22 +00:00
Alex Waygood 5fb21861f9 Colorize flake8 output in CI (#9422) 2022-12-28 12:49:51 +01:00
Alex Waygood 27983aa929 ast.NodeVisitor: add visit_TryStar on 3.11+ (#9418) 2022-12-27 18:36:53 +01:00
Alex Waygood fd3e64ac3e regr_test.py: Fix out-of-date comment (#9419) 2022-12-27 17:26:48 +00:00
Alex Waygood 2704a8d916 pyaudio: fix stubtest failures (#9416) 2022-12-27 16:11:01 +01:00
Alex Waygood 116229d0ac datetime: various parameters can now safely be passed as keyword arguments on 3.12+ (#9415) 2022-12-27 14:35:29 +00:00
Alex Waygood 154452ffc2 ast.NodeVisitor: Add visit_* methods for ast nodes new in 3.8-3.10 (#9413) 2022-12-26 20:27:44 -08:00
Alex Waygood 59b1a78d5f Bump various test dependencies (#9412) 2022-12-26 18:48:07 +00:00
Alex Waygood 8671fc5c0f regr_test.py: Allow non-types dependencies (#9382) 2022-12-23 13:55:54 -08:00
Alex Waygood 352f496d69 Unpin stubtest from Python 3.10.8 and 3.11.0 (#9368) 2022-12-20 20:31:13 +00:00
Alex Waygood 0e41136f5a python-dateutil: Add zoneinfo submodule (#9381) 2022-12-18 17:14:05 +00:00
Alex Waygood 805452f896 editdistance: delete the bycython submodule (#9380) 2022-12-18 07:25:11 -08:00
Alex Waygood 7a9818e565 Colorize output of stdlib stubtest in CI (#9379) 2022-12-17 13:08:17 -08:00
Alex Waygood 04d4cbd92f pycurl: Add missing constants (#9373) 2022-12-16 17:48:14 -08:00
Alex Waygood c78bc57f78 shutil.rmtree: add avoids_symlink_attacks attribute (#9366) 2022-12-15 09:56:58 +00:00
Alex Waygood 9bddd3a3f1 Bump pyright to 1.1.284 (#9363) 2022-12-14 20:07:27 +00:00
Alex Waygood b356abcbda Stdlib stubtest: Temporarily pin Python to 3.10.8 and 3.11.0 in CI (#9361)
Stubtest: pin Python to 3.10.8 and 3.11.0 in CI
2022-12-14 10:48:22 -08:00
Alex Waygood 40bfc266f7 3rd-party stubtest: run on Python 3.10 (#9342) 2022-12-07 20:25:57 +00:00
Alex Waygood 0220577a31 Remove stubs for certifi (#9341)
Closes #8048
2022-12-07 08:06:35 -08:00
Alex Waygood fc69819a89 Don't run mypy_primer on stubsabot PRs (#9332)
We can be fairly confident that PRs updating only a `METADATA.toml` file will never produce an interesting `mypy_primer` diff.
2022-12-05 23:47:59 -08:00
Alex Waygood 95c74ba7e1 Minor improvements to tests/regr_test.py (#9274) 2022-11-25 15:03:20 +00:00
Alex Waygood e2ad6fbe62 Add color back to CI output (#9276) 2022-11-25 15:01:31 +00:00
Alex Waygood 350b3c57da Bump flake8 and flake8-noqa (#9275) 2022-11-25 11:51:00 +00:00
Alex Waygood b3728f38f5 Add test case for recent types-regex regression (#9269) 2022-11-24 11:37:12 -08:00
Alex Waygood 89f22278ba Bump flake8-pyi and pytype versions used in CI (#9268) 2022-11-24 14:55:26 +00:00
Alex Waygood 67c8b5cb22 pycurl: Add a few missing constants (#9262) 2022-11-23 23:31:16 +00:00
Alex Waygood 01e78c7e81 Use modern syntax in test-case files where possible (#9261) 2022-11-23 11:58:11 -08:00
Alex Waygood a3de404e1d Pin redis to 4.3.4 in CI (#9247)
We're about to get a daily test failure with 63 stubtest errors (see the Ubuntu stubtest failure in #9187) due to the release of redis-py 4.3.5, and I'd rather that didn't happen.
2022-11-22 12:46:42 +01:00
Alex Waygood 0a5202222c dateparser: delete DIGIT_USE_PATTERN (#9243)
Fixes #9242
2022-11-21 19:53:56 -08:00
Alex Waygood 4588dd6c74 check_consistent.py: Allow having weird filenames in the test_cases directory (#9239) 2022-11-21 17:40:11 +00:00
Alex Waygood 1f8491d23d Allow adding test cases testing version-dependent Python features (#9238) 2022-11-21 08:03:28 -08:00
Alex Waygood f62f402127 python-slugify: use explicit re-exports (#9225)
Fixes https://github.com/python/typeshed/pull/9224#discussion_r1027053364
2022-11-19 06:47:34 -08:00
Alex Waygood beb19fea4c runtests.py: point pycln to pyproject.toml for config settings (#9202)
An oversight in #9197 that was noticed by @Avasam post-merge (thanks!)
2022-11-15 09:40:22 -08:00
Alex Waygood 3fec65927c check_consistent.py: Add a check guarding against typos for the new platforms key (#9203) 2022-11-15 16:23:22 +00:00
Alex Waygood 263427f438 Bump test dependencies; improve pycln config (#9197) 2022-11-14 11:58:45 -08:00
Alex Waygood cc7ac01a3e Stubtest: Don't allowlist termios and posix constants on Windows (#9150) 2022-11-10 07:02:53 -08:00
Alex Waygood 068b0b488a Improve builtins.vars() (#9146) 2022-11-10 12:14:05 +01:00
Alex Waygood 739460291b Use recursive type aliases in builtins and _typeshed (#9134) 2022-11-08 17:04:09 +00:00
Alex Waygood efa1048d42 stubsabot: warn if stubtest is skipped in CI (for real this time) (#9133)
Fixes a bug in #8681. The logic currently is broken; there should have been a warning message in the PR body for #9118, but there wasn't.
2022-11-08 08:33:17 -08:00
Alex Waygood 4f381af4c5 Upgrade mypy to 0.990 (#9123) 2022-11-07 11:20:47 -08:00
Alex WaygoodandJelle Zijlstra 658b6e7de0 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)
<unknown>:11: DeprecationWarning: invalid escape sequence '\u'
<ast.Module object at 0x0000027EAF6D3AF0>
```

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-11-06 14:50:38 -08:00
Alex Waygood 22c5afa2d2 http.server.SimpleHTTPRequestHandler: Fix version branching (#9075) 2022-11-03 11:17:50 +01:00
Alex Waygood d1d1afbe3a Bump flake8-bugbear; ignore flake8-bugbear in stub files (#9069) 2022-11-02 12:18:00 -07:00
Alex Waygood 401a7b929e Bump various test dependencies; pin Python to <3.10 in CI to workaround pytype incompatibility (#9068) 2022-11-02 18:44:48 +00:00
Alex Waygood 8d941f0e53 Remove unnecessary pyright: ignore (#9000) 2022-10-27 08:27:28 -07:00
Alex Waygood 8b9b96c9f8 datetime.timedelta: Remove explicit inheritance from SupportsAbs (#8972)
Fixes #8971
2022-10-23 15:28:44 -07:00
Alex Waygood dc7fdc6f5d Fix invoke regression (#8950)
* Fix `invoke` regression
2022-10-21 18:04:22 +01:00
Alex Waygood 122bceeade CI: Use macOS-11 for stdlib stubtest (#8949) 2022-10-20 15:45:18 +02:00
Alex Waygood d22ebe7676 Remove stubs for atomicwrites (#8925) 2022-10-18 17:33:28 -07:00
Alex Waygood 03c38d91ae 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.
2022-10-17 12:48:21 +02:00
Alex Waygood 9ba68c364a dateutil: Add comment explaining the use of ABCMeta (#8911) 2022-10-17 12:46:48 +02:00