Commit Graph
552 Commits
Author SHA1 Message Date
Alex WaygoodandGitHub a3245db63c Remove unneeded # noqa comments, fix broken # noqa comments (#7561) 2022-03-28 23:17:44 +02:00
c41034c354 passlib: Annotate various handler methods and fields (#7521)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-03-26 20:53:05 -07:00
Kalle MøllerandGitHub 9aa64fdc22 requests: Update adapters.pyi (#7544)
The cert can be
* A string / bytes which is a path to a certfile
* A tuple with two string / bytes, where the first is the certfile and the second is a keyfile
* None (optional)

The tuple could be anything indexable, but there are strict requirement to actualle have two items, don't know if there is something more generic

See https://github.com/psf/requests/blob/main/requests/adapters.py#L242-L248
2022-03-26 20:41:25 -07:00
dset0xandGitHub a018110980 DateTimeRange: __contains__ accepts datetime.datetime (#7541) 2022-03-24 11:39:19 +01:00
Sebastian RittauandGitHub 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
kasiumandGitHub dd1265c0e6 Mark pre/post tasks in invoke tasks as iterable (#7531) 2022-03-22 16:06:22 +01:00
kasiumandGitHub 108c3ab710 Fix wrong return type of invoke decorator (#7536)
Closes #7530
2022-03-22 14:30:51 +01:00
Jelle ZijlstraandGitHub fa9074366b Revert "Remove google/__init__.pyi (#6106)" (#7522)
This reverts commit a11a6643a7.
2022-03-21 19:49:00 +01:00
kasiumandGitHub 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 KoorapatiandGitHub 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
Jelle ZijlstraandGitHub 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
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
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
Jelle ZijlstraandGitHub d9f1f7b81f pytz: utcoffset only returns None if dt is None (#7510) 2022-03-19 08:19:09 +00:00
Alex WaygoodandGitHub e8286e7048 Use PEP 604 syntax in non-autogenerated protobuf stubs (#7506) 2022-03-17 11:34:31 +00:00
kasiumandGitHub 061ddad8e3 Add annotations to invoke.tasks (#7502) 2022-03-17 11:13:03 +01:00
830b57f8f8 Add stubs for whatthepatch (#7492)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-03-16 23:38:41 +02:00
Sebastian RittauandGitHub 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 WaygoodandGitHub 3ab250eec8 Use PEP 604 syntax wherever possible (#7493) 2022-03-16 16:01:33 +01:00
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 KaseorgandGitHub 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
Stephen RosenandGitHub 134f047402 jsonschema: mark schemas as Mapping[str, Any] (#7489) 2022-03-14 17:11:33 +01:00
Sebastian RittauandGitHub 1cc31cd470 passlib: Annotate pbkdf2_sha* (#7486) 2022-03-14 08:55:37 -07:00
Stephen RosenandGitHub a3027d3b96 jsonschema: RefResolver.referrer is a dict[str, Any] (#7487) 2022-03-14 16:27:08 +01:00
Joseph YoungandGitHub 860db6f6c4 sqlalchemy: Annotate (Async)Session.__(a)enter__ (#7488) 2022-03-14 15:15:32 +00:00
Alex WaygoodandGitHub 8134752ad8 requests stubs are not Python 2-compatible (#7483) 2022-03-13 13:06:34 +01:00
Alex WaygoodandGitHub 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 ZijlstraandGitHub 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 ZijlstraandGitHub c89236d1cf passlib: fix MutableMapping import (#7479)
Found by #7478
2022-03-12 19:18:48 -08:00
Joseph YoungandGitHub 3a9abf850a Stubs for parsimonious (#7477) 2022-03-12 18:43:07 -08:00
Andrej ShaduraandGitHub a5ddf0bf0d Add xmltodict (#7472)
Signed-off-by: Andrej Shadura <andrew.shadura@collabora.co.uk>
2022-03-11 12:19:51 +01:00
Alex WaygoodandGitHub 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
Sebastian RittauandGitHub cdb573b398 Remove explicit inheritance from object (#7468) 2022-03-09 19:43:44 +01:00
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
ShantanuandGitHub 9c737f1326 Re-enable stubtest on SQLAlchemy (#7456) 2022-03-09 07:34:12 +01:00
AkuliGitHubAlex Waygoodpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
6c967d4202 Update cachetools to 5.0.0 (#7455)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-03-08 19:20:22 +00:00
Sebastian RittauandGitHub 889164cb0c psycopg2: Annotate cursor execute* and dunder methods (#7460) 2022-03-08 08:13:19 -08:00
Bas van BeekandGitHub 70988f1811 Widen the cmdclass parameter of setuptools.setup (#7458) 2022-03-08 15:07:44 +02:00
Sebastian RittauandGitHub addce5c067 Add passlib stubs (#7024) 2022-03-06 16:25:00 -08:00
Sebastian RittauandGitHub 7e5d2a58aa Add openpyxl stubs (#6801) 2022-03-06 16:24:17 -08:00
ShantanuGitHubhauntsaninja <>
9796b9ed69 Improve open overloads when mode is a literal union (#7428)
As pointed out by @gvanrossum in https://github.com/python/typing/issues/1096

Improves type inference in cases when we know that mode is
OpenBinaryMode, but don't know anything more specific:
```
def my_open(name: str, write: bool):
    mode: Literal['rb', 'wb'] = 'wb' if write else 'rb'
    with open(name, mode) as f:
        reveal_type(f)  # previously typing.IO[Any], now typing.BinaryIO
```

You may be tempted into thinking this is some limitation of type
checkers. mypy does in fact have logic for detecting if we match
multiple overloads and union-ing up the return types of matched
overloads. The problem is the last overload interferes with this logic.
That is, if you remove the fallback overload (prior to this PR), you'd get
"Union[io.BufferedReader, io.BufferedWriter]" in the above example.

Co-authored-by: hauntsaninja <>
2022-03-06 15:45:34 -08:00
ShantanuandGitHub 77e5a2d468 Upgrade to stubtest with dunder pos only reverted (#7442) 2022-03-05 18:38:08 -08:00
ShantanuGitHubhauntsaninja <>
a5ec3c69b2 bs4: expose several other classes (#7420)
On the same lines as #7419

These are all imports that are not used within bs4/__init__.py
My main interest here is in exposing NavigableString

Co-authored-by: hauntsaninja <>
2022-03-01 17:59:11 -08:00
ShantanuGitHubhauntsaninja <>
2f27eaab44 bs4: expose bs4.PageElement (#7419)
This is generally useful. It's also imported in the source without being
used in bs4/__init__.py which in well maintained packages is a pretty
good marker of intention to export

Co-authored-by: hauntsaninja <>
2022-03-01 16:59:50 -08:00
Sebastian RittauandGitHub 7f2cf525e9 Add six.create_bound_method dunders to allowlist (#7409)
Closes: #7404
2022-03-01 07:16:49 -08:00
Sebastian RittauandGitHub 000b466b21 Remove orjson stubs (#7410) 2022-03-01 10:59:31 +01:00
HugoandGitHub ba1482bba4 Add DEFAULT_CIPHERS to urllib3.util.ssl_ (#7399) 2022-02-28 19:08:16 +01:00
Martin FischerandGitHub 98d9ed44cd docutils: complete nodes.Node & bump version to 0.18.* (#7380) 2022-02-28 17:59:56 +01:00
Rebecca ChenandGitHub 64133df6eb Add stripe.util.convert_to_stripe_object (#7386) 2022-02-28 13:47:53 +01:00
yejia-stripeandGitHub ee8aa1e012 Improve annotation for stripe DeletableAPIResource delete method (#7230) 2022-02-25 08:04:36 -08:00