Commit Graph
100 Commits
Author SHA1 Message Date
Alex Waygood 88506f0e56 _weakref.ReferenceType.__new__: all args are pos-only (#9820)
Fixes #9712
2023-02-27 13:20:10 +01:00
Alex Waygood 9b63a49f64 Re-export dateutil._common.weekday from dateutil.relativedelta (#9819) 2023-02-27 12:03:18 +00:00
Alex Waygood 2daa07ddf0 stubtest_stdlib: suppress output from pip (#9807) 2023-02-25 16:32:24 -08:00
Alex Waygood 13325d4d80 Fix stubtest for influxdb-client (#9808)
Fixes #9805
2023-02-24 09:00:17 -08:00
Alex Waygood f6df5b5dd2 Remove a default value in distutils (#9800)
Fixes #9799.

Stubtest started failing on our `setuptools` stubs because of a default value added to our stdlib `distutils` stubs. The reason for this is because our `setuptools` stubs erroneously claim here that the `setuptools._distutils.core.Distribution` class is the same as the stdlib `distutils.dist.Distribution` class:

https://github.com/python/typeshed/blob/06755e10ba0d39e7e4c18fcc2663d9da564a71ad/stubs/setuptools/setuptools/_distutils/core.pyi#L3

In actual fact, they're not, and they have different default values for this parameter. But reverting the addition of the default value is the simplest short-term fix for now.

(An alternative fix would be to just merge #9795.)
2023-02-23 22:38:11 +00:00
Alex Waygood 1d2ae2598b Fix some typos in comments (#9802) 2023-02-23 22:11:24 +00:00
Alex Waygood 6ba28ae547 Remove unused type: ignore comments (#9801) 2023-02-23 12:59:50 -08:00
Alex Waygood 76bfe8b469 argparse: simplify parse_args overloads (#9798) 2023-02-22 23:46:35 +02:00
Alex Waygood b0dc6a3405 Add defaults to logging.LoggerAdapter methods (#9797) 2023-02-22 11:50:11 +01:00
Alex Waygood 9ed719b640 Bump pyright to 1.1.295 (#9796) 2023-02-22 09:22:35 +00:00
Alex Waygood fbc092b4cd Stdlib: add defaults for several functions that delegate kwargs to other functions at runtime (#9791) 2023-02-21 23:31:25 -08:00
Alex Waygood fea57ad095 hmac.HMAC: digestmod defaults to None on py37 (#9790) 2023-02-21 18:24:34 +00:00
Alex Waygood f2ae3542d3 Stdlib: Deduplicate some multiprocessing type aliases (#9788) 2023-02-21 13:30:41 +01:00
Alex Waygood c407a44489 Add defaults to csv stubs (#9774) 2023-02-21 11:33:38 +01:00
Alex Waygood 880c0da404 Enable some more mypy lints when checking our own code (#9787) 2023-02-21 00:54:35 +00:00
Alex Waygood bc847a9b07 Use generic NamedTuples to clean up urllib.parse (#9773) 2023-02-20 16:41:49 -08:00
Alex Waygood 4d99b33f84 Fix an unnecessary allowlist entry in ssl.pyi (#9776) 2023-02-20 16:35:38 -08:00
Alex Waygood 9163c71e47 [Minor] Simplify some type hints in stubsabot (#9785)
We can use `typing_extensions.Self` now
2023-02-20 16:32:22 -08:00
Alex Waygood e6e7fab111 Add some more environment variables to speedup brew installs in CI (#9786) 2023-02-21 00:20:28 +00:00
Alex Waygood 3786ab295e Fix an unnecessary socketserver allowlist entry (#9777) 2023-02-20 11:14:20 -08:00
Alex Waygood 0878173943 textwrap.{wrap, fill}: max_lines defaults to None (#9775)
All keyword arguments are delegated to `TextWrapper.__init__`: https://github.com/python/cpython/blob/59e86caca812fc993c5eb7dc8ccd1508ffccba86/Lib/textwrap.py#L373-L396
2023-02-20 10:39:48 -08:00
Alex Waygood 14ab089bd5 Use a generic NamedTuple for concurrent.futures.DoneAndNotDoneFutures (#9772) 2023-02-20 08:54:21 -08:00
Alex Waygood 4273a83bb7 unittest: Use a recursive type alias for assertIsInstance (#9770) 2023-02-20 15:35:50 +00:00
Alex Waygood 5e6b172e17 stdlib/_decimal.pyi: correct many parameter names (#9769) 2023-02-20 15:57:54 +01:00
Alex WaygoodandJelle Zijlstra c5b5dd4bf4 Various stdlib dunders: correct parameter names; improve types; add defaults (#9761)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-02-19 22:44:20 +00:00
Alex Waygood 4ca0c48425 Improve the first overload of is_dataclass (#9758) 2023-02-19 06:26:11 -08:00
Alex Waygood 70c027e9ef Fix broken stubsabot logic in find_first_release_with_py_typed (#9760) 2023-02-19 14:22:51 +00:00
Alex Waygood 7180d0223b Use typing_extensions.Self instead of _typeshed.Self (#9702) 2023-02-15 11:32:43 +01:00
Alex Waygood 8cd6d81f15 Bump pyright to 1.1.294; improve psutil stubs (#9739)
Partially type psfullmem
2023-02-15 10:54:36 +01:00
Alex Waygood 9ed39d8796 Use typing_extensions.Self in the stdlib (#9694) 2023-02-09 09:12:13 +00:00
Alex Waygood 6d535bf0a3 Enable stubtest for pyserial (#9692) 2023-02-09 00:10:33 +01:00
Alex Waygood 32c575d980 subprocess.check_call: executable defaults to None (#9689)
This argument is forwarded on to `Popen.__init__`, like most of the other arguments. It can be `None`, just like the `executable` parameter for all the other `subprocess` functions:

```pycon
>>> import subprocess
>>> subprocess.check_call(["python", "-c", "1/1"], executable=None)
0
>>> subprocess.check_call(["python", "-c", "1/0"], executable=None)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ZeroDivisionError: division by zero
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\alexw\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 369, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['python', '-c', '1/0']' returned non-zero exit status 1.
```
2023-02-07 12:33:12 +00:00
Alex Waygood 53747b264e Stdlib: add 'obvious' default values (#9688) 2023-02-07 13:00:40 +01:00
Alex WaygoodandAvasam 60789273a2 Improve pyright verification of third-party test cases in CI (#9650)
Co-authored-by: Avasam <samuel.06@hotmail.com>
2023-02-07 11:53:54 +00:00
Alex Waygood 0ef9c3f8e8 Enable flake8-pyi's Y037 (#9686) 2023-02-06 19:01:02 -08:00
Alex Waygood c4c4bee8aa Remove a no-longer-needed # noqa (#9685) 2023-02-07 00:43:53 +00:00
Alex Waygood efee70abfa Bump mypy to 1.0 (#9684) 2023-02-06 15:57:17 -08:00
Alex Waygood 5157ff86da unicodedata: overload many functions and methods (#9656) 2023-02-06 07:04:26 -08:00
Alex Waygood 262f2067aa Update paramiko stubs to 3.0.* (#9667) 2023-02-06 07:01:50 -08:00
Alex Waygood 191afbc559 Update invoke stubs to 2.0.* (#9669) 2023-02-06 06:54:21 -08:00
Alex Waygood ccb250940a Improve collections stubs (#9674) 2023-02-06 13:54:15 +01:00
Alex Waygood b9270da7b0 Improve readability of stdlib/_winapi.pyi (#9673) 2023-02-04 06:55:47 -08:00
Alex Waygood 1e3d762a12 stdlib: use bool for annotations where the default is False (#9672) 2023-02-04 11:58:18 +00:00
Alex Waygood 48cffeeea6 Update caldav stubs to 1.0.* (#9668) 2023-02-03 06:38:16 -08:00
Alex Waygood f94d496626 Update cachetools stubs to 5.3.* (#9666) 2023-02-03 12:20:38 +00:00
Alex Waygood 4afda1dbe3 Rework CONTRIBUTING.md: simple parameter defaults are now accepted and encouraged (#9665) 2023-02-03 11:59:07 +00:00
Alex Waygood 100cd62373 stdlib: Add bytes defaults (#9660) 2023-02-02 16:01:54 -08:00
Alex Waygood 95dc689b28 Remove unneeded ignore in .flake8 (#9661)
B028 was renamed as B907, and we don't have any of the B9 rules enabled for this repo (they're all off by default)
2023-02-02 13:29:50 +00:00
Alex Waygood 1d7dda7fa1 stdlib: Add defaults for positional-only parameters (#9655) 2023-02-01 21:44:08 +00:00
Alex WaygoodandJelle Zijlstra 35172c7aab Stdlib: add some very large integer defaults (#9651)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-02-01 20:10:28 +00:00
Alex Waygood 8000fbd386 Bump various test dependencies (#9646) 2023-02-01 06:23:40 -08:00
Alex Waygood 23e3dc9bd8 Fix stubtest errors on beautifulsoup4 (#9648)
Fixes #9645.
2023-02-01 06:06:45 -08:00
Alex Waygood 8e7b78a8e8 Bump black to 23.1.0 (#9647) 2023-02-01 06:06:04 -08:00
Alex Waygood 7cd7ae46c0 Improve a few version-dependent tkinter functions (#9637) 2023-02-01 15:02:26 +02:00
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