Commit Graph
513 Commits
Author SHA1 Message Date
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
Sebastian RittauandGitHub 3afcc1b2b1 Mark selenium stubs as obsolete (#7383) 2022-02-25 15:46:39 +01:00
Martin FischerandGitHub a342a49d38 docutils: Add missing dunders to nodes.Element (#7377) 2022-02-24 11:46:05 +01:00
Fares AhmedandGitHub b55fed42ed Add stubs for pynput package (#7177)
Fixes #4328
2022-02-23 23:10:20 +01:00
Sebastian RittauandGitHub 7b024f5e9a Update dateparser stubs for 1.1 (#7368) 2022-02-23 11:15:24 -08:00
Joseph YoungandGitHub d3941c2463 regex stubs: Add __getitem__ method to Match (#7372) 2022-02-23 19:38:29 +01:00
Sebastian RittauandGitHub ffeac7297f Re-export RedisCluster from redis (#7371) 2022-02-23 16:39:09 +01:00
Sebastian RittauandGitHub 7a81bd41e9 Re-introduce the 'stubtest' key for third-party packages (#7351)
Some distributions can't be tested with stubtest for a variety of
reasons or because of bugs in stubtest. This key:

* let's us keep metadata about a distribution in one place,
* prevents us from modifying the scripts because of issues with a
  specific distribution, and
* will trigger tests if only the key is changed.
2022-02-22 15:59:27 +01:00
Alex WaygoodandGitHub 64af11c78f Correct several positional-only differences in third-party stubs (#7352) 2022-02-22 06:49:51 -08:00
kasiumandGitHub a1bec51768 Update flake8-simplify (#7339) 2022-02-21 12:17:43 +02:00
Jelle ZijlstraandGitHub 61361ce059 contextvars, pycurl: make classes final (#7334) 2022-02-20 16:55:48 -08:00
Martin FischerandGitHub a287cfd925 Improve docutils stubs (#7256) 2022-02-20 16:49:11 -08:00
ShantanuGitHubhauntsaninja <>
c176911bfb flask-cors: remove unused allowlist (#7309)
Co-authored-by: hauntsaninja <>
2022-02-19 17:12:33 -08:00
J Rob GantandGitHub 99aedf4724 Tag.attrs is a dict, instead of an immutable Mapping (#7253) 2022-02-18 00:46:49 +02:00
Sebastian RittauandGitHub ae39348d7a Annotate Session.execute() and Result (#7252)
* Annotate return type of Session.execute()

* Annotate Result return types

* Remove sub-class overrides with identical signatures
2022-02-17 09:27:55 -08:00
Sebastian RittauandGitHub e3742686b1 Update to redis 4.1.4 (#7247)
Closes: #7245
2022-02-17 01:33:33 -08:00
Sebastian RittauandGitHub 4a0dabda1b Various SQLalchemy type improvements (#7238)
* Make ColumnOperators and ColumnElement generic
* Overload Session.query() return type
* Annotate ColumnOperators methods
2022-02-16 19:03:48 -08:00
Sebastian RittauandGitHub 44bcf5eed0 Various SQLalchemy fixes and improvements (#7237) 2022-02-16 06:46:11 -08:00
Alex WaygoodandGitHub 1341a34525 Remove unused allowlist entries in babel and requests (#7233) 2022-02-15 16:26:13 -08:00
aimileusandGitHub 5081f684c0 Fix argument types of pytz.tzinfo.StaticTzInfo (#7184)
The argument is_dst of the functions StaticTzInfo.localize and
StaticTzInfo.normalize are ignored, and only present for compatibility with
DstTzInfo. The functions in DstTzInfo also accepts None, so for compatibility,
StaticTzInfo should accept them as well.

[^1] https://github.com/stub42/pytz/blob/2ed682a7c4079042f50975970fc4f503c8450058/src/pytz/tzinfo.py#L112
2022-02-13 07:21:30 -08:00
ShantanuGitHubhauntsaninja <>
3a2ce92d32 singledispatch: fix lint (#7178)
Co-authored-by: hauntsaninja <>
2022-02-11 17:53:01 -08:00
James MorrisandGitHub 7e5f3c38bd Add singledispatchmethod to singledispatch (#6089) 2022-02-11 17:23:49 -08:00
Sebastian RittauandGitHub 84b5e73396 protobuf doesn't support Python 2 anymore (#7176)
Remove Python-2-only package "futures"
2022-02-11 08:10:31 -08:00
Alex WaygoodandGitHub da7604a968 Add stubs for pyflakes (#7175) 2022-02-11 12:21:28 +01:00
Sebastian RittauandGitHub 97a327b984 fpdf2: Correct annotations of @contextmanager methods (#7172) 2022-02-10 18:15:09 +01:00
7efda0f21a Improve toml typings (#7146)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-02-10 17:55:31 +02:00
7bb6ce7083 Added missing import for JSONDecodeError (#7171)
Co-authored-by: DataGhost <git@dataghost.com>
2022-02-09 11:31:55 -08:00
Roman JoostandGitHub 2381066c15 google-cloud-ndb: Fix incorrect type definition for validator (#7116)
This function was mistakenly typed as `Callable[[Property], object] |
None`, however the actual function accepts two parameters of type
`Property, value`. The value can be of any type. Strictly speaking, the
type corresponds to the type of the property which is defined at runtime.

Fixes #7103
2022-02-08 07:09:04 -08:00
Itai SteinherzandGitHub 670009ca22 Improve sock typing in Paramiko stub (#7156) 2022-02-08 07:08:14 -08:00
Nipunn KoorapatiandGitHub 96a09f6a35 protobuf: Bring back Message.Extensions (#7154) 2022-02-08 13:51:41 +01:00
Alex WaygoodandGitHub 494481a0ae Improve a bunch of __(deep)copy__ methods (#7148) 2022-02-06 15:40:44 -08:00
Alex WaygoodandGitHub a62fd92fb0 Improve some in-place BinOp methods (#7149) 2022-02-06 15:36:57 -08:00
62e33cbbd5 Add stubs for chevron package (#7139)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-02-05 21:38:19 +02:00
ebcdcfa24e Makes DESCRIPTOR non nullable again (#7125)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-02-04 22:05:58 +02:00
Roman JoostandGitHub fc60d02c3e Fix mistyped get_by_id class methods (#7120)
The types for these class methods were mixed up. The async method
returned an optional `Model`, while the synchronous method returned a
`Future`. It's the other way around.

Fixes #7103
2022-02-02 15:59:02 -08:00
Alex WaygoodandGitHub 26e8959279 Use _typeshed.Self in docutils.VersionInfo and os.sched_param (#7117) 2022-02-02 23:30:39 +01:00
Alex WaygoodandGitHub 15d76b072a Improve classmethods in paramiko stubs (#7113) 2022-02-02 22:15:26 +01:00
Alex WaygoodandGitHub b4e97a1909 Improve __enter__ & constructor methods (#7114) 2022-02-02 22:14:59 +01:00
klaerikandGitHub b327f64d9a Add iterable and ServerPool types to ldap3 Connection.server parameter (#7101) 2022-02-02 18:59:53 +01:00
Nipunn KoorapatiandGitHub 90f5422df7 Add/fix types to a bunch of non-generated protobuf files (#7017) 2022-02-02 12:30:39 +01:00