Commit Graph

619 Commits

Author SHA1 Message Date
Shantanu 468d8adff1 stubtest_third_party: show package versions on failure (#7826)
Co-authored-by: hauntsaninja <>
2022-05-11 08:08:02 +02:00
Alex Waygood f8547a3f31 Use flake8-pyi 22.5.0, remove redundant parts of check_new_syntax (#7821) 2022-05-10 09:34:41 -07:00
Jelle Zijlstra 5c13f8bbce ast: FormattedValue.conversion cannot be None (#7810)
```
In [4]: ast.dump(ast.parse('f"{x!r}"'))
Out[4]: "Module(body=[Expr(value=JoinedStr(values=[FormattedValue(value=Name(id='x', ctx=Load()), conversion=114)]))], type_ignores=[])"

In [5]: ast.dump(ast.parse('f"{x}"'))
Out[5]: "Module(body=[Expr(value=JoinedStr(values=[FormattedValue(value=Name(id='x', ctx=Load()), conversion=-1)]))], type_ignores=[])"
```
(On 3.9 but I don't think this has changed since 3.6.)

The stdlib also assumes this: https://github.com/python/cpython/blob/main/Lib/ast.py#L1211 (`chr(None)` doesn't work).
2022-05-08 19:42:38 -07:00
Alex Waygood 8d8420bc54 Fix bugs in check_new_syntax.py (#7808) 2022-05-08 21:59:19 +01:00
Alex Waygood bb39bdfd30 Add test cases for pow that are meant to fail a type check (#7760) 2022-05-08 08:16:37 -07:00
Alex Waygood 3ed7e3ba50 csv: annotate keyword arguments in various functions and methods (#7788) 2022-05-07 21:01:20 -07:00
Alex Waygood c6b3211afa Improve test-suite documentation (#7756)
- mypy_test and pyright no longer just test the stubs, they now also test other parts of typeshed as well.
- pytype_test.py can now be run on 3.10, meaning the whole test suite can now also be run on 3.10.
- Various test scripts now have from `__future__ import annotations`, meaning they can now only be run on 3.7+.
- Clean up the description of pyright_test.py, which had a slightly confusing wording.
- Also fix the `--dry-run` config option in mypy_test.py, which I accidentally broke in #7746
2022-04-30 12:43:48 -06:00
Alex Waygood 8b118b236d Run mypy on the test cases and test scripts (#7746) 2022-04-30 06:39:07 -06:00
Alex Waygood 9d450cb50c Make test scripts pass mypy --strict (#7745)
- Add several type hints to untyped functions.
- While we're at it, upgrade several annotations to use modern syntax by using `from __future__ import annotations`. This means that the tests can't be run on Python 3.6, but 3.6 is EOL, and it is already the case that some scripts in this directory can only be run on more recent Python versions. E.g. `check_new_syntax.py` uses `ast.unparse`, which is only available in Python 3.9+.
- Fix a few pieces of code that didn't type check.
2022-04-29 21:55:12 -06:00
Alex Waygood 002c8e2586 Cleanup mypy_test.py (#7738) 2022-04-28 12:00:54 -06:00
Akuli bfa918880f asyncio: expose WriteTransport.get_write_buffer_limits on all Python versions (#7718) 2022-04-27 16:38:25 +03:00
Sebastian Rittau 02310d93da Update pyright to 1.1.240 (#7701) 2022-04-27 15:02:30 +02:00
Sebastian Rittau f7aa41245e Drop Python 2 support in third-party stubs (#7703) 2022-04-27 15:32:17 +03:00
Rebecca Chen 2116d2425e Remove paramiko stubs from pytype_exclude_list. (#7669)
Pytype can parse these now.
2022-04-20 21:53:54 +01:00
Sebastian Rittau 499e74cf2a Add wsgiref.types (Python 3.11+) (#7644)
_typeshed.wsgi: Import from wsgiref.types in Python 3.11+

Make types match wsgiref.types
2022-04-16 21:36:31 +02:00
Jelle Zijlstra b0611bc031 Improve sqlite3 types (#7641)
Read through the code in CPython and made the types more precise
where possible.

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2022-04-16 11:20:11 -07:00
Alex Waygood 819900fa55 Python 3 stubs: use str instead of typing.Text (#7638) 2022-04-16 15:47:00 +01:00
Alex Waygood a1b1b95f67 Unpin Python micro versions used by stubtest (#7619)
Add new `asyncio` method, fix allowlists
2022-04-13 22:07:01 +02:00
Rebecca Chen f1856a384e pytype_test: Don't mix up stdlib and stub packages starting with stdlib. (#7609)
This should fix the pytype_test failure in
https://github.com/python/typeshed/pull/7608.
2022-04-08 13:01:37 -07:00
Alex Waygood 478e7527aa mypy_test: Add two more config options (#7560)
`--enable-error-code ignore-without-code` means that mypy will ignore any type: ignore comments that don't have mypy error codes. It doesn't appear to have any effect on type: ignore comments that mypy_test doesn't use (e.g. because they're pyright- or stubtest-specific).

`--strict-equality` means that mypy will raise errors if we do something silly like `if sys.version_info == "linux"`. flake8-pyi should also check this for us, but I don't see any reason not to have mypy check this as well.
2022-03-28 16:06:13 +01:00
Stefan Zabka f40747f81d Add Server to asyncio.base_events' __all__ (#7554)
Add Server to asyncio.base_events' __all__

Closes #7552
2022-03-25 20:32:28 +00:00
Alex Waygood 5c44ae4f8c Improve various signatures that shouldn't be async def, but currently are (#7491)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-03-18 20:54:39 -07:00
Alex Waygood 3ab250eec8 Use PEP 604 syntax wherever possible (#7493) 2022-03-16 16:01:33 +01:00
Alex Waygood 15e21a8dc1 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 <jelle.zijlstra@gmail.com>
2022-03-16 14:24:55 +00:00
Sebastian Rittau fdc5863337 Use stubtest 0.941 (#7490) 2022-03-15 00:37:34 -07:00
Alex Waygood 2f338ce077 Further improve mypy_test.py (#7484)
* Run mypy on the 3.11 stdlib in CI, as a regression test for https://github.com/python/mypy/issues/12220
* Correct the docstring at the top of the file following the changes made in #7478
* Stop the test from crashing when run locally if there's an extra file/folder in the stubs directory.
2022-03-13 19:58:30 +00:00
Jelle Zijlstra fa332220b7 Fix mypy test (#7478)
* Fix `mypy_test.py` so that it actually tests the third-party stubs
* Upgrade to mypy 0.940
* Skip running mypy on `SQLAlchemy` stubs for now, to workaround a mypy crash.

Because we didn't set mypy's clean_exit parameter, it was exiting immediately after checking the stdlib, meaning `mypy_test.py` wasn't checking the third-party stubs at all.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-03-13 13:01:14 +00:00
Sebastian Rittau cdb573b398 Remove explicit inheritance from object (#7468) 2022-03-09 19:43:44 +01:00
Sebastian Rittau c3907ab26b Remove Python 2 support from some third-party distributions (#7466)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-03-09 20:19:22 +02:00
Henry Schreiner 967f83db09 rlcompleter: add attr_matches, global_matches (#7453)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-03-08 00:07:58 +00:00
Akuli 30a424c661 Finish renaming stubtest.yml to daily.yml (#7448) 2022-03-07 11:09:24 +02:00
Jelle Zijlstra 675de720d6 Add some missing items to sys.pyi and types.pyi (#7447) 2022-03-07 08:22:08 +01:00
Jelle Zijlstra 2fb9c35ff9 Put shutil.chown back on Windows (#7446)
See #7384 and https://github.com/python/typeshed/pull/7443#issuecomment-1060071944 (thanks @AlexWaygood for diagnosing).
2022-03-06 16:27:24 -08:00
Martin Fischer 8034c1c48c stdlib: shutil.chown does not work on Windows (#7384) 2022-03-06 16:04:05 -08:00
Martin Fischer 182ddd9daf stdlib: Add os.get_handle_inheritable & setter 2022-03-06 15:57:52 -08:00
Martin Fischer aa383624cf stdlib: Add missing re-exports for UuidCreate, FCICreate, OpenDatabase & CreateRecord 2022-03-06 15:57:52 -08:00
Martin Fischer 352f5c3237 stdlib: Add os.copy_file_range(src, dst, count) 2022-03-06 15:57:52 -08:00
Martin Fischer 81a85f18b6 stdlib: Add os.pidfd_open(pid) 2022-03-06 15:57:52 -08:00
Martin Fischer 9abf314a5b stdlib: Add time.pthread_getcpuclockid(thread_id) 2022-03-06 15:57:52 -08:00
Alex Waygood 1a2f718ceb Make several fields read-only for type, staticmethod and classmethod (#7423) 2022-03-06 15:50:26 -08:00
Shantanu 77e5a2d468 Upgrade to stubtest with dunder pos only reverted (#7442) 2022-03-05 18:38:08 -08:00
Alex Waygood cda3d9cf72 Use latest stubtest in CI (#7438) 2022-03-04 15:19:29 +01:00
Jelle Zijlstra 0a6b6b095c Add asyncio.windows_utils.Popen (#7396) 2022-03-02 12:37:54 +02:00
Alex Waygood fd750bf065 asyncio.unix_events: Make AbstractChildWatcher abstract, add PidfdChildWatcher (#7412) 2022-03-01 16:23:46 +01:00
Shantanu ebcfe7bc4e random: use bound methods (#7408) 2022-03-01 09:27:44 +01:00
Alex Waygood 1ebedcc2b4 Mark fields as readonly in builtins.pyi and types.pyi (#7392)
Add FunctionType.__builtins__
2022-02-28 13:23:34 +01:00
Alex Waygood b8421eb5d4 Delete the contents of distutils.command.__init__ (#7370) 2022-02-27 16:43:11 -08:00
Alex Waygood a0b41959ec stdlib: fix many attributes which are read-only at runtime but read-write in the stub (#7395) 2022-02-27 16:23:09 -08:00
Alex Waygood d2ddda00cf Fix various __all__-related typos and omissions (#7378) 2022-02-25 15:10:00 +02:00
Alex Waygood 240628c4dd Add missing objects to plistlib, and improve __all__ in asyncio.tasks, http.server, & multiprocessing.__init__ (#7363) 2022-02-22 16:39:34 -08:00