Commit Graph

5977 Commits

Author SHA1 Message Date
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
Sebastian Rittau
41160cc294 Fix primer comment workflow (#7545) 2022-03-24 08:02:54 -07:00
dset0x
a018110980 DateTimeRange: __contains__ accepts datetime.datetime (#7541) 2022-03-24 11:39:19 +01:00
Sebastian Rittau
00f1807836 Update black target version to py310 (#7538)
This makes no difference to existing files, but allows scripts to use
the match statement.
2022-03-23 07:57:17 -07:00
Sebastian Rittau
251dd52b57 Remove backports_abc third-party package (#7533)
The last release was in 2016 and it's not required in any currently
supported Python 3 version.
2022-03-22 11:43:59 -07:00
kasium
dd1265c0e6 Mark pre/post tasks in invoke tasks as iterable (#7531) 2022-03-22 16:06:22 +01:00
kasium
108c3ab710 Fix wrong return type of invoke decorator (#7536)
Closes #7530
2022-03-22 14:30:51 +01:00
Sebastian Rittau
b307142f62 Update pytype to 2022.3.21 (#7532) 2022-03-22 08:30:03 +00:00
Rebecca Chen
f39f20c4dd Fix the type signature of multiprocessing.managers.BaseManager.__exit__ (#7529)
All parameters should accept None.
2022-03-22 07:32:15 +01:00
Harry
eb252afb18 random.sample no longer accepts sets in Python 3.11 (#7528)
As of 3.11, population must be a Sequence. Automatic conversion of sets to lists is no longer supported.
2022-03-21 18:58:22 -07:00
Harry
71d14b3ee1 random.sample: counts takes Iterable[int] (#7527) 2022-03-21 18:18:24 -07:00
Shantanu
0af746d048 mypy_primer: mention if output is truncated (#7525) 2022-03-21 23:41:31 +01:00
Jelle Zijlstra
fa9074366b Revert "Remove google/__init__.pyi (#6106)" (#7522)
This reverts commit a11a6643a7.
2022-03-21 19:49:00 +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
kasium
7d77e9c5c1 Fix invoke task decorator (#7511)
The decorator can be called with and without (). The current types only consider the first case
2022-03-20 16:13:02 -07:00
Nipunn Koorapati
a11a6643a7 Remove google/__init__.pyi (#6106)
Since google is a namespace package, it won't have an init.
Depends on https://github.com/typeshed-internal/stub_uploader/pull/33
2022-03-20 14:41:16 -07:00
Alex Grönholm
3a8d121890 Fix type of the "host" parameter in asyncio getaddrinfo() (#7517) 2022-03-20 13:17:55 +00:00
Jelle Zijlstra
b7d129f727 PEP 604: Remove some more uses of Union/Optional (#7515)
The following patterns still break mypy:

1. `type[]` at top level fails
2. `tuple[T1, T2]` at top level fails (but `tuple[T1, ...]` is fine)
3. `T1 | Callable[..., T2 | T3]` fails, but only <=3.9

This PR cleans up usage of `Union` and `Optional` outside these patterns.
2022-03-19 08:23:00 -07:00
Alex Waygood
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 Waygood
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
Jelle Zijlstra
d9f1f7b81f pytz: utcoffset only returns None if dt is None (#7510) 2022-03-19 08:19:09 +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
Marc Mueller
37a981920f Use TypeVar for pkgutil.extend_path (#7473) 2022-03-18 20:44:38 -07:00
Jelle Zijlstra
4d23919200 Add typing.TypeVarTuple, Unpack, assert_type (#7501)
python/cpython#31021 and python/cpython#30843.
2022-03-18 18:03:45 +00:00
Sebastian Rittau
50107e6e2b 'Inactive' -> 'former' consistently (#7512) 2022-03-18 06:01:04 -07:00
Alex Waygood
e8286e7048 Use PEP 604 syntax in non-autogenerated protobuf stubs (#7506) 2022-03-17 11:34:31 +00:00
kasium
061ddad8e3 Add annotations to invoke.tasks (#7502) 2022-03-17 11:13:03 +01:00
Jelle Zijlstra
ba475a04c3 multiprocessing: args can be any Iterable (#7500)
https://github.com/python/cpython/blob/main/Lib/multiprocessing/process.py#L91
2022-03-17 01:44:25 +00:00
Myoungdo Park
830b57f8f8 Add stubs for whatthepatch (#7492)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-03-16 23:38:41 +02:00
Alex Waygood
ec8f51726f Unpin pyright-action (#7499)
The issues that broke typeshed's CI have been fixed by e7c2cbabca
2022-03-16 16:21:05 +00:00
Sebastian Rittau
108b6fb091 pyright: Don't report incompatible overrides (#7498)
These overrides are inherited from the implementation and are out of
typeshed's control.
2022-03-16 16:20:06 +01: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
Anders Kaseorg
b78f0c21ba psycopg2: Accept Composable in place of query string (#7494)
https://www.psycopg.org/docs/sql.html#psycopg2.sql.Composable
“Composable objects can be passed directly to execute(),
executemany(), copy_expert() in place of the query string.”

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2022-03-15 20:47:30 -07:00
Sebastian Rittau
fdc5863337 Use stubtest 0.941 (#7490) 2022-03-15 00:37:34 -07:00
Stephen Rosen
134f047402 jsonschema: mark schemas as Mapping[str, Any] (#7489) 2022-03-14 17:11:33 +01:00
Sebastian Rittau
1cc31cd470 passlib: Annotate pbkdf2_sha* (#7486) 2022-03-14 08:55:37 -07:00
Stephen Rosen
a3027d3b96 jsonschema: RefResolver.referrer is a dict[str, Any] (#7487) 2022-03-14 16:27:08 +01:00
Joseph Young
860db6f6c4 sqlalchemy: Annotate (Async)Session.__(a)enter__ (#7488) 2022-03-14 15:15:32 +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
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
Jelle Zijlstra
3e3cc2a6d6 dict.pop: Remove default for second argument (#7481)
The first overload takes care of the case where there is only one argument, so there should be no default in the second overload.
2022-03-13 13:11:35 +01: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
Jelle Zijlstra
bd449c983a urllib3: stubs are not Python 2 compatible (#7480)
They use http.client, which is Python 3-only. Another catch from #7478.
2022-03-13 07:09:01 +00:00
Jelle Zijlstra
c89236d1cf passlib: fix MutableMapping import (#7479)
Found by #7478
2022-03-12 19:18:48 -08:00
Joseph Young
3a9abf850a Stubs for parsimonious (#7477) 2022-03-12 18:43:07 -08:00
Andrej Shadura
a5ddf0bf0d Add xmltodict (#7472)
Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
2022-03-11 12:19:51 +01:00