Commit Graph
100 Commits
Author SHA1 Message Date
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
Alex Waygood 85594df83b Use re-exports instead of TypeAliases in email.parser (#7665) 2022-04-20 07:31:52 -07:00
Alex Waygood 197dac2c0c Upgrade flake8-pyi to 22.4.1 (#7662) 2022-04-18 22:52:44 +01:00
Alex Waygood 3930d8d12a Make several type aliases private (#7661) 2022-04-18 22:19:16 +01:00
Alex Waygood 617d2aaf57 Fix crash when running mypy master against typeshed master (#7660) 2022-04-18 17:20:49 +01:00
Alex Waygood eafc23ddb8 Add one more # noqa to unblock https://github.com/PyCQA/flake8-pyi/pull/213 (#7659)
Missed one.
2022-04-18 09:09:40 -07:00
Alex Waygood 54af68c789 Add a few # noqas to unblock PyCQA/flake8-pyi#213 (#7658) 2022-04-18 17:57:48 +02:00
Alex Waygood 073f9f416d Use PEP 585 syntax in collections (#7657) 2022-04-18 15:33:50 +01:00
Alex Waygood 97a74bc1aa Import from collections.abc wherever possible (#7635) 2022-04-18 12:50:37 +02:00
Alex Waygood 7ce4607dee Upgrade flake8-pyi to 22.4.0, enable Y026 in .flake8 config (#7650) 2022-04-17 01:23:35 +01:00
Alex Waygood 2e98c8284c Move code from decimal.pyi to _decimal.pyi (#7640)
* Move code from `decimal.pyi` to `_decimal.pyi`

The stub previously did `from decimal import *` in `_decimal.pyi`, but the opposite happens at runtime.
2022-04-16 17:01:13 +01:00
Alex Waygood 819900fa55 Python 3 stubs: use str instead of typing.Text (#7638) 2022-04-16 15:47:00 +01:00
Alex Waygood 653f2c6ba4 Third-party stubs: import from collections.abc where possible (#7637) 2022-04-16 14:52:57 +01:00
Alex Waygood 66bea8ca48 Use imports instead of TypeAliases in a couple places (#7634)
Fixes #7632
2022-04-16 01:38:59 -07:00
Alex Waygood 740193a8fc Use TypeAlias where possible for type aliases (#7630) 2022-04-15 18:01:00 -07:00
Alex Waygood c0e6dd3f3f Use str instead of typing.Text (#7629) 2022-04-16 00:47:42 +02:00
Alex Waygood 40985b4f02 Fix various __all__ bugs and omissions (#7618) 2022-04-14 08:03:19 -07: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
Alex Waygood 536f783a82 Exclude Y037 in .flake8 config, for now (#7600)
Unblocks https://github.com/PyCQA/flake8-pyi/pull/202
2022-04-06 17:24:02 +01:00
Alex Waygood 3c85f36b7f Reduce code duplication in the email module (#7558) 2022-04-06 12:20:14 +02:00
Alex Waygood 1ceb486b75 Replace Union with union operator (#7596) 2022-04-05 23:07:31 +02:00
Alex Waygood 85aec034ae Mark many attributes as read-only properties (#7591) 2022-04-05 08:37:24 +02:00
Alex Waygood b8f2eb3930 Make several fields on _dummy_threading classes read-only properties (#7588) 2022-04-05 08:35:00 +02:00
Alex Waygood 414f324083 Add missing __match_args__ attributes to several unix-only structseq classes (#7587) 2022-04-04 21:33:49 +01:00
Alex Waygood be64b01e6c Upgrade black version (#7582) 2022-04-03 22:34:44 +01:00
Alex Waygood 646993c211 Improve imp._FileLike.__exit__ (#7577)
The signature of this method currently doesn't work quite as intended: see https://github.com/PyCQA/flake8-pyi/pull/199#issuecomment-1086087342

Classes will [still be accepted](https://mypy-play.net/?mypy=latest&python=3.10&gist=77efe095d01edeb1a4614166f0c9cf68) as conforming to this protocol if they have more permissive signatures such as `def __exit__(self, *args: object) -> None: ...`
2022-04-01 18:01:23 +01:00
Alex Waygood ec27c00ca2 Third-party stubs: Improve several __exit__ methods (#7575) 2022-04-01 08:03:12 -07:00
Alex Waygood ae6ff79c0e flake8 config: remove line that exists only for Python-2 checking (#7570) 2022-04-01 08:07:16 +02:00
Alex Waygood da3e69d093 stdlib: Improve a bunch of __(a)exit__ methods (#7571) 2022-04-01 08:05:25 +02:00
Alex Waygood 85f060b26d Exclude the Python-2 stdlib from flake8 CI check (#7569)
We should hopefully be getting rid of this entire subdirectory soon anyway (#7367). This will make PRs to flake8-pyi a lot easier.
2022-03-31 23:35:45 +01:00
Alex Waygood 1245bbcc8d Use type alias to simplify overloads in unittest.mock (#7563) 2022-03-29 08:19:26 +02:00
Alex Waygood a3245db63c Remove unneeded # noqa comments, fix broken # noqa comments (#7561) 2022-03-28 23:17:44 +02: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
Alex WaygoodandJelle Zijlstra 61b22db692 Add many missing __match_args__ attributes (#7556)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-26 19:36:28 +00:00
Alex Waygood 1192db784c Use flake8-pyi 22.3.0 (#7557)
Hot off the presses!
2022-03-26 19:27:11 +00:00
Alex Waygood b63c963077 Use conditional overloads to simplify several stdlib functions (#7540) 2022-03-25 08:47:03 +01:00
Alex Waygood d086488e0e Revert "Use import instead of type alias in email/message.pyi" (#7548)
Let's see if this is fixed in mypy 0.942.

This reverts the changes made in #7022, which was a hack to fix #7019
2022-03-24 11:22:30 -07:00
Alex Waygood 4b63f345ad Upgrade mypy version to 0.942 (#7547) 2022-03-24 18:42:26 +01:00
Alex Waygood 74ecce5b68 Improve host parameter of socket.getaddrinfo() (#7518)
As pointed out by @srittau in #7517, `bytearray` [is redundant](https://docs.python.org/3/library/typing.html#typing.ByteString) in a union where `bytes` is also in the union.
2022-03-20 23:35:03 +00:00
Alex WaygoodandJelle Zijlstra 1acc8f3bd6 Use PEP 604 syntax wherever possible, part II (#7514)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-19 14:27:35 +00:00
Alex WaygoodandJelle Zijlstra 340c6c97ed Add mypy error codes to type: ignores, remove unused ignores (#7504)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-03-19 13:10:00 +00:00
Alex Waygood 4308915e06 Make __hash__ a ClassVar for several classes where it is set to None (#7485) 2022-03-19 05:59:10 -07:00
Alex WaygoodandThomas Grainger 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 e8286e7048 Use PEP 604 syntax in non-autogenerated protobuf stubs (#7506) 2022-03-17 11:34:31 +00:00
Alex Waygood ec8f51726f Unpin pyright-action (#7499)
The issues that broke typeshed's CI have been fixed by https://github.com/jakebailey/pyright-action/commit/e7c2cbabca407c6ba1eecc5c2317422f8a609c2a
2022-03-16 16:21:05 +00:00
Alex Waygood 3ab250eec8 Use PEP 604 syntax wherever possible (#7493) 2022-03-16 16:01:33 +01:00
Alex WaygoodandJelle Zijlstra 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
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
Alex Waygood 8134752ad8 requests stubs are not Python 2-compatible (#7483) 2022-03-13 13:06:34 +01:00
Alex Waygood d3df6da103 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.
2022-03-13 00:23:31 -08:00
Alex Waygood 9a1f5fb06c Modernize syntax in various stubs (#7469)
Use `str` and `contextlib.AbstractContextManager` instead of `typing.Text` and `typing.ContextManager`.
2022-03-09 21:23:26 +00:00
Alex Waygood 4e87b9058f Improve collections.Counter stub (#7464) 2022-03-09 12:22:28 +02:00
Alex Waygood db6f912c77 Improve mmap.mmap.__enter__ (#7461)
It returns `Self` at runtime, not `mmap.mmap`, so inheriting from `AbstractContextManager` doesn't really do anything for us.
2022-03-08 07:47:56 -08:00
Alex Waygood f4ae363b56 stdlib: correct many pos-or-kw arg names in dunder methods (#7451) 2022-03-07 16:40:03 +01:00
Alex Waygood 626ccdaee2 Add @AlexWaygood as a maintainer (#7450) 2022-03-07 15:08:19 +00:00
Alex Waygood 947724a5cb stdlib: Add several missing @abstractmethod decorators (#7443) 2022-03-06 16:41:13 -08:00
Alex Waygood 1a2f718ceb Make several fields read-only for type, staticmethod and classmethod (#7423) 2022-03-06 15:50:26 -08:00
Alex Waygood ea6e06a60d Use bound methods in pydoc (#7426) 2022-03-06 15:49:15 -08:00
Alex Waygood bc72b25a2a Make more miscellaneous fields read-only, annotate _json.make_encoder (#7439) 2022-03-06 15:41:49 -08:00
Alex Waygood cda3d9cf72 Use latest stubtest in CI (#7438) 2022-03-04 15:19:29 +01:00
Alex Waygood fbde20797e Add tomllib.__all__ (#7433) 2022-03-03 15:25:30 -08:00
Alex Waygood c50cb066e0 Improve two classes which are namedtuples at runtime, but cannot be namedtuples in typeshed (#7429) 2022-03-03 07:22:40 -08:00
Alex Waygood 39c8202eaf Increase pyright strictness when checking __all__ (#7356) 2022-03-02 03:31:21 -08:00
Alex Waygood fd750bf065 asyncio.unix_events: Make AbstractChildWatcher abstract, add PidfdChildWatcher (#7412) 2022-03-01 16:23:46 +01:00
Alex Waygood 3bbc36c92d Add two missing ForwardRef attributes (#7402)
These look somewhat like implementation details, but no more so than any of the other dunder attributes that are already on the class.
2022-02-28 21:44:28 -08:00
Alex Waygood 1575c1b3b8 Add sys.__unraisablehook__ (#7403)
Docs [here](https://docs.python.org/3/library/sys.html#sys.__breakpointhook__). The similar functions `sys.__displayhook__` and `sys.__breakpointhook__` are already included in the stub.
2022-02-28 21:43:48 -08:00
Alex Waygood 4b7d2a76cb Add __all__ for pickle and turtle (#7401) 2022-02-28 14:50:29 -08: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 bf167d4df4 Add __all__ for asyncio.unix_events & asyncio.taskgroups, and simplify asyncio.__init__ (#7343) 2022-02-28 12:51:32 +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 46da0b87ea Add collections.ChainMap.__bool__ (#7391) 2022-02-27 16:02:01 -08:00
Alex Waygood 95885c96ed Add subprocess.__all__ (#7390) 2022-02-27 16:01:51 -08:00
Alex Waygood 3000bb8d91 lib2to3: add Leaf.__unicode__ and Node.__unicode__ (#7394) 2022-02-27 14:49:28 -08:00
Alex Waygood 4f0d8c593e Delete EnumMeta.__setattr__ and EnumMeta.__delattr__ (#7388) 2022-02-26 17:55:53 -08:00
Alex Waygood 2d6ab4d3bf Fix several mypy errors when run on the 3.11 stdlib (#7389) 2022-02-26 17:49:36 -08:00
Alex Waygood 95df201a78 Add tokenize.__all__ (#7387) 2022-02-26 16:35:55 -08:00
Alex Waygood d2ddda00cf Fix various __all__-related typos and omissions (#7378) 2022-02-25 15:10:00 +02:00
Alex Waygood 6a743348ca Add __all__ for most modules beginning with 't' (#7373) 2022-02-23 18:25:28 -08:00
Alex Waygood 062fc75d73 Upgrade pytype to 22.2.23 (#7375)
Unblocks #7343
2022-02-23 17:39:27 -08:00
Alex Waygood 58e505eeb2 Add __all__ for modules beginning with 'u', 'x', 'w' and 'z' (#7374) 2022-02-23 23:04:21 +01:00
Alex Waygood 05dee4dc0e Improve re.RegexFlag etc (#7369)
- Add `NO_FLAG`, new in 3.11
- Delete very old comment
- Several members in `RegexFlag` are aliases of other members; the stub should reflect that
2022-02-23 15:06:57 +01:00
Alex Waygood a3bb5af4a0 Add __all__ to most modules beginning with 'q', 'r' and 's' (#7364) 2022-02-22 16:51:54 -08: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
Alex Waygood 070bbb4fb9 Add multiprocessing.reduction submodule (#7361) 2022-02-22 16:36:26 -08:00
Alex Waygood 1610949c66 Improve enum stubs (#7362)
- Improve TypeVar names
- `object` -> `Any` in `Enum.__new__` (there _are_ restrictions on the kinds of objects that can be passed in, they're just not expressable in the stubs.
- Delete pointless `Self | int` unions, since `Self` is a subtype of `int` for these methods.
2022-02-22 20:17:55 +01:00
Alex Waygood 22c3cc4d0b Add csv.__version__ (#7357) 2022-02-22 20:12:43 +02:00
Alex Waygood 6fc4c14181 Add missing objects in codecs, configparser, and multiprocessing.dummy (#7360) 2022-02-22 18:25:27 +01:00
Alex Waygood a37d5f4849 Add enum module features new in 3.11 (#7358) 2022-02-22 08:42:03 -08:00
Alex Waygood bdcaea4305 cgi: Add print_exception and print_arguments (#7359) 2022-02-22 08:38:02 -08:00
Alex Waygood 64af11c78f Correct several positional-only differences in third-party stubs (#7352) 2022-02-22 06:49:51 -08:00
Alex Waygood 69abe56e18 pyrightconfig.json: correct typo in comment (#7355)
Typeshed has no factions, only fractions :)
2022-02-22 06:44:16 -08:00
Alex Waygood d6ce3abd68 Add __all__ to most modules beginning with 'n', 'o' and 'p' (#7345) 2022-02-21 17:57:03 -08:00
Alex Waygood 3afc0b1ade Update inspect stubs for Python 3.11 (#7342) 2022-02-21 16:36:01 +01:00
Alex Waygood e2524b0e96 Add asyncio.base_futures.__all__ (#7279) 2022-02-20 17:59:14 -08:00