Commit Graph
100 Commits
Author SHA1 Message Date
Alex Waygood f812d71ffa Improve errno stubs on Windows and MacOS (#8142) 2022-06-26 08:29:02 +05:30
Alex Waygood ca2f83a4cf typing_extensions: harmonise __all__ with __all__ at runtime (#8165) 2022-06-25 19:16:23 -07:00
Alex Waygood f5f37fed3a Upgrade pytype (#8164) 2022-06-25 18:15:43 +01:00
Alex Waygood b550d463c7 Fix stubtest failures on SQLAlchemy (#8148) 2022-06-25 11:34:47 +05:30
Alex Waygood 64d91ef414 mypy_test.py: Add command-line argument to enable selecting which parts of the test to run (#8143) 2022-06-23 10:21:32 -07:00
Alex Waygood 610d2908bd mypy_test.py: Allow passing in multiple platforms from the command line (#8138) 2022-06-22 20:13:01 +01:00
Alex Waygood 15a17d1301 mypy_test.py: Add argument validation, improve type hints (#8135) 2022-06-22 18:03:29 +01:00
Alex Waygood 09141ec3dc mypy_test.py: Fix argument-parsing for --python-version (#8134)
* mypy_test.py: Fix argument-parsing for `--python-version`

* Bump min version required in the README
2022-06-22 15:08:56 +01:00
Alex Waygood a527bf27d5 Run mypy on the scripts directory in CI (#8133) 2022-06-22 14:13:38 +01:00
Alex Waygood 89f4dee452 Improve several __hash__ methods (#8128) 2022-06-22 11:58:00 +01:00
Alex Waygood 8826d3a36f Rename some confusingly named type aliases (#8129) 2022-06-21 20:51:05 +01:00
Alex Waygood 3fe1f5d6c4 requests, regex: use re-exports instead of assignments in a few places (#8127) 2022-06-21 08:20:13 -07:00
Alex Waygood 67f377898b Add process_group argument to subprocess.{run, call, check_call, check_output} (#8125) 2022-06-21 07:44:20 -07:00
Alex Waygood 0740d1c48e asyncio.gather: Add overload for if no positional arguments are provided (#8126) 2022-06-21 15:31:40 +01:00
Alex Waygood a01e0260b3 Add pipesize argument to subprocess.{run, call, check_call, check_output} (#8124) 2022-06-21 05:59:26 -07:00
Alex Waygood cad42c7c7b asyncio.gather: Remove default values for return_exceptions: bool overloads (#8123) 2022-06-21 05:57:06 -07:00
Alex Waygood f9e24680c3 Add new-in-3.9 parameters to subprocess.{run, call, check_call, check_output} (#8071) 2022-06-21 04:35:50 -07:00
Alex Waygood c6de37df53 Overhaul socket stubs on Windows and MacOS (#8106)
Reduce the `socket` allowlists for these platforms to a handful of missing constants
2022-06-20 20:11:50 +01:00
Alex Waygood 538621e91b unittest.case: tighter annotations for various assertions (#8077) 2022-06-20 18:49:57 +02:00
Alex Waygood bae4fd2209 Upgrade pyright (#8110) 2022-06-20 17:07:43 +01:00
Alex Waygood 411d85feeb socket.AddressFamily: Fix AF_LINK (#8103)
Slipped through the net in #8099
2022-06-19 09:10:33 +01:00
Alex Waygood 6b0c8df9ec Upgrade pyright, improve pyright config files (#8072) 2022-06-16 18:50:50 +01:00
Alex Waygood a2ef47660a Fix TypeVars in beautifulsoup and SQLAlchemy (#8087) 2022-06-16 17:34:27 +02:00
Alex Waygood 43f923b6c2 protobuf: Delete some __new__ and __init__ methods (#8088) 2022-06-16 17:10:14 +02:00
Alex Waygood 4967c8bc12 redis: fix more unconstrained TypeVars (#8084) 2022-06-15 10:14:13 -07:00
Alex Waygood 5fa31e6759 Remove mypy error codes from the test_cases directory (#8083) 2022-06-15 15:31:45 +01:00
Alex Waygood 01d5e28ff7 Fix miscellaneous invalid TypeVar usages (#8074) 2022-06-14 08:48:41 -07:00
Alex Waygood 4941ac0263 Use the Any trick for xml.etree.ElementTree.getroot() (#8069)
Closes #7770
2022-06-14 18:31:19 +03:00
Alex Waygood 5add91d6bb unittest: Improve self.assert(Not)AlmostEqual(s) (#8066) 2022-06-14 18:24:51 +03:00
Alex Waygood 7de1ed9589 cachetools: Fix invalid TypeVar usage (#8073) 2022-06-14 06:39:45 -07:00
Alex Waygood 60c2733ca8 subprocess.(check_)call: add text argument new in 3.7 (#8070) 2022-06-14 01:54:16 +01:00
Alex Waygood 1828ba2045 builtins.sum: Items in the iterable must support addition with int if no start value is given (#8000) 2022-06-13 11:25:38 +01:00
Alex Waygood 67828bd598 xml.etree.ElementTree.Element: remove inheritance from MutableSequence (#8056) 2022-06-13 12:22:28 +02:00
Alex Waygood 1be5918baa Use _typeshed.IdentityFunction more consistently (#8063) 2022-06-12 16:56:14 -07:00
Alex Waygood 033516d39f flake8 config: Ignore more error codes in .py files (#8065)
black fixes these for us in `pre-commit.ci`.
2022-06-12 12:04:38 -07:00
Alex Waygood 1aa5663f9e Add __setattr__ to logging.LogRecord (#8064) 2022-06-12 12:04:22 -07:00
Alex Waygood 55eb19d1bd Improve csv.DictReader (#8061) 2022-06-12 17:02:05 +03:00
Alex Waygood b5802d0bbe Add tkinter._test (#8062)
Fixes #7903
2022-06-12 16:58:39 +03:00
Alex WaygoodandAkuli 16281bb04f Improve turtle.Vec2D (#8058)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-06-12 15:53:14 +03:00
Alex Waygood 45b9e60d13 dateparser: Remove redundant import of _typeshed.Self (#8041) 2022-06-08 21:02:14 +01:00
Alex Waygood c449ddde56 Remove stubs for characteristic (#8040) 2022-06-08 20:18:13 +01:00
Alex Waygood e7a5b7a762 Fix various __all__-related errors and omissions (#8031) 2022-06-07 23:29:55 +01:00
Alex Waygood 591593c85f Simplify __all__ for modules beginning with 'm' to 't' (#8028) 2022-06-07 20:14:15 +01:00
Alex Waygood b88ea4a499 Simplify __all__ for unittest and xml.etree (#8029) 2022-06-07 12:03:52 -07:00
Alex Waygood e88a182573 Simplify __all__ definitions in modules beginning with 'a' to 'l' (#8026) 2022-06-07 15:40:48 +02:00
Alex Waygood 15ad2657db Upgrade pytype (#8025)
Unblocks #7865
2022-06-07 12:13:05 +01:00
Alex WaygoodandJelle Zijlstra 9db96967cc asyncio.sslproto: More updates for py311 (#8022)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-06-06 15:12:22 -07:00
Alex Waygood 7322acbb97 jsonschema: mark type alias explicitly (#8024) 2022-06-06 14:44:46 -07:00
Alex Waygood 43a9ab08d7 Always use TypeAlias when assigning to Any (#8021) 2022-06-05 18:16:20 -07:00
Alex Waygood 0ce825b5a8 Add unittest features new in Python 3.11 (#8020)
python/cpython@086c6b1
2022-06-04 16:27:52 +01:00
Alex Waygood 8a98e5a075 check_new_syntax.py: Fix bug in visit_AnnAssign (#8017) 2022-06-03 19:12:11 +02:00
Alex Waygood acc0167dc1 Fix several new-in-3.11 stubtest errors (#7973) 2022-06-02 18:07:38 -07:00
Alex Waygood 6355cba923 Python 3.11: re.TEMPLATE is back in beta 2 (#8007) 2022-06-01 14:50:37 +02:00
Alex Waygood a7ff433fc3 CONTRIBUTING.md: Fix broken link (#7994) 2022-05-30 16:36:06 -07:00
Alex WaygoodandShantanu fa85367fc9 CONTRIBUTING: improve docs on running tests locally (#7992)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-05-30 15:44:13 -07:00
Alex Waygood d4eba8b5ce builtins.sum: Add overload for bool special case (#7975)
Closes #7974
2022-05-28 11:14:10 -07:00
Alex Waygood 8e8176b24c mypy_test.py: Skip Flask-SQLAlchemy (#7977) 2022-05-28 10:18:57 -07:00
Alex Waygood ceccc655db Introduce _typeshed.GenericPath and _typeshed.AnyStr_co (#7970) 2022-05-27 19:02:00 +01:00
Alex Waygood c05731c46f tempfile.pyi: readability improvements (#7959)
The name `_DirT` implies that it is a `TypeVar`, but it isn't; it's a generic `TypeAlias` that can be parameterised with a `TypeVar`. Rename it to just `_Dir` instead.

Also, use aliases instead of repeating incredibly long Literal annotations six times.
2022-05-27 08:52:44 +01:00
Alex Waygood d511312e21 multiprocessing.managers: fix TypeVar usage (#7938)
#7928

`dict()` and `list()` just return empty dictionaries and lists (respectively) if no arguments are supplied:

```python
>>> from multiprocessing.managers import SyncManager
>>> with SyncManager() as s:
...     print(s.dict())
...
{}
```
2022-05-26 07:18:43 -07:00
Alex Waygood fa636bc044 Third-party stubs: fix several fictitious type aliases (#7958) 2022-05-26 06:26:26 -07:00
Alex WaygoodandJelle Zijlstra cb7742e12c tempfile: Fix TypeVar usage (#7939)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-25 20:06:46 -07:00
Alex Waygood ac9efd8573 stubtest_stdlib: run on PRs updating requirements-tests.txt (#7949) 2022-05-25 15:29:05 +02:00
Alex Waygood 54e11a1ec4 mypy_extensions: fix TypeVar usage (#7937)
#7928
2022-05-24 11:26:35 -07:00
Alex Waygood 76a4bd796b Simplify and correct many numeric unions (#7906)
Unblocks PyCQA/flake8-pyi#222
2022-05-21 15:25:00 +01:00
Alex Waygood aa70cc8abb CI: Don't install tomli for stubtest_stdlib (#7901)
The script doesn't import tomli
2022-05-20 19:33:06 -07:00
Alex Waygood d54d018e2d CI: Fix stubtest workflow; make paths for other workflows more specific (#7897) 2022-05-20 16:37:02 +01:00
Alex Waygood e2cf6c21d5 CI: Don't run stubtest_stdlib on PRs that don't touch the stdlib (#7895)
* Don't run stubtest_stdlib on PRs that don't touch the stdlib
2022-05-20 15:56:29 +01:00
Alex Waygood dd080d9840 Upgrade flake8-pyi to 22.5.1 (#7882) 2022-05-19 19:59:25 +02:00
Alex Waygood aa72cb1dcf Run pyupgrade on the tests directory (#7880) 2022-05-19 14:16:53 +01:00
Alex WaygoodandSebastian Rittau 44d33f2fdb Add colour to the output of mypy_test, take 2 (#7879)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2022-05-19 13:29:15 +01:00
Alex Waygood 04dde4d000 enum: More changes for 3.11 (#7862) 2022-05-18 19:35:22 -07:00
Alex Waygood a348dac6e7 Revert "Add colour to the output of mypy_test" (#7874)
Revert "Add colour to the output of `mypy_test` (#7872)"

This reverts commit 753eb053ac.
2022-05-18 17:13:06 -07:00
Alex Waygood 753eb053ac Add colour to the output of mypy_test (#7872)
And gracefully exit on KeyboardInterrupt.
2022-05-19 00:36:59 +01:00
Alex Waygood a98a1ead06 Improve output of mypy_test when reporting errors (#7863) 2022-05-18 19:10:54 +01:00
Alex WaygoodandJelle Zijlstra 171ea08f0d Add __class_getitem__ to classes in logging and csv (#7830)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-17 14:12:42 +01:00
Alex Waygood eadb35e620 Don't run mypy_primer on changes to test files (#7854)
Only changes to files in `stdlib` or `stubs` will ever have any effect on the checked open-source code. But also run primer on changes to files in `.github/workflows` so that we can see the effect of changes to the `mypy_primer.yml` file itself.
2022-05-17 14:03:58 +01:00
Alex Waygood e9526faf40 Various py311 removals (#7836) 2022-05-16 17:28:13 -07: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
Alex Waygood fed1f35c32 Remove explicit inheritance from object (#7819) 2022-05-10 16:24:53 +03:00
Alex Waygood ac30b96d14 Use str instead of Text (#7812) 2022-05-09 20:47:11 +01: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 4e946b74bf csv.pyi: minor cleanup (#7790) 2022-05-07 10:49:27 +02:00
Alex Waygood 5c6178a821 Import generics from standard modules in all third-party stubs (#7791) 2022-05-07 10:35:50 +02:00
Alex Waygood 16ca92fac7 Add http.HTTPMethod (#7784)
https://github.com/python/cpython/pull/91997

`description` isn't actually read-only at runtime, but I don't think there's any other way of telling type checkers "this is an attribute that the members have, not a member itself". And pretending it's a property is already what we do for `HTTPStatus`, which has the same issue.
2022-05-06 23:48:52 -07:00
Alex Waygood 5f557176b4 _csv.pyi: minor cleanup (#7789) 2022-05-06 11:38:19 -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
Alex Waygood c3ebc7e307 More improvements to pow stubs (#7737) 2022-04-28 10:49:29 -06:00
Alex Waygood 59c346d031 cryptography: make oid attributes readonly (#7731) 2022-04-28 00:58:49 -06:00
Alex Waygood a95a862ca8 Upgrade to pytype 2022.4.26 (#7699) 2022-04-26 15:40:47 -06:00
Alex Waygood 7cbb579a44 Make __wrapped__ read-only on classmethods and staticmethods (#7694) 2022-04-25 22:27:06 -06:00
Alex Waygood 2773480d13 Add regression tests for builtins.pow and object.__reduce__ (#7663) 2022-04-21 21:17:37 -07:00
Alex Waygood a8504f269e Use _typeshed.OptExcInfo in pydoc and unittest (#7668) 2022-04-20 21:00:48 +01:00
Alex Waygood b093c90a94 Use TypeAlias for type aliases where possible, part II (#7667) 2022-04-20 20:02:47 +01:00
Alex Waygood c653be73b8 Use TypeAlias for argparse type aliases (#7664) 2022-04-20 07:32:10 -07:00