Commit Graph

670 Commits

Author SHA1 Message Date
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
Steve Dignam e30ff13b7d stripe: update a few signatures (#7978)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-06-03 18:27:23 +01:00
Jelle Zijlstra cb9023988d psycopg2: stub improvements (#7964)
Fixes an entry from #7928 along with a number of other improvements.

I went off the C code:
https://github.com/psycopg/psycopg2/blob/master/psycopg/connection_type.c
2022-06-02 18:02:07 -07:00
Tom Milligan 51f97dda15 requests: expand types for files (#7999) 2022-06-01 22:55:38 +03:00
Tomoki Nakagawa 461289e181 PyYAML: Add types to add_constructor (#7989) 2022-06-01 18:23:20 +01:00
Tom Parker-Shemilt f5f79f181d dj-database-url: Add missing fields to _DBConfig TypedDict (#8008)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-06-01 16:52:19 +01:00
Sebastian Rittau 07ac9675e4 SQLAlchemy 1.4.37 fixes (#8003)
Closes: #8001
2022-06-01 09:50:40 +01:00
Lee a0c65022c6 markdown: remove INSTALLED_EXTENSIONS. (#8002) 2022-06-01 10:26:00 +02:00
Lee e8f20bbb56 markdown: add Markdown.registeredExtensions (#7997) 2022-05-31 14:10:30 +01:00
Shantanu d736bb9d85 caldav: add verify_expand to Calendar.date_search (#7996)
Co-authored-by: hauntsaninja <>
2022-05-30 18:29:19 -07:00
Stephen Rosen 17e7cc7d3c Fix exception types for jsonschema._format (#7990)
The annotated type for the `raises` argument on format checkers was

    Exception | tuple[Exception, ...]

when it should read

    type[Exception] | tuple[type[Exception], ...]

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2022-05-30 17:14:33 +01:00
Chanwoo Yoon 92ba4b757f ujson: add JSONDecodeError (#7988) 2022-05-29 23:19:29 -07:00
Lee 8f7786c7df markdown: annotate Registry.__len__(). (#7986) 2022-05-30 02:10:07 +01:00
PIG208 5be7976fe3 psycopg2: Fix the return type of Composable.as_string (#7984)
Signed-off-by: Zixuan James Li <359101898@qq.com>
2022-05-29 15:15:56 -07:00
Stephen Rosen b2aaed1e68 Fix jsonschema exception str|int containers (#7981)
schema_path, relative_schema_path, and absolute_schema_path are all
(related) attributes of `jsonschema` errors which contain `str | int`
but were accidentally annotated as containing `str`. Fix them for
accuracy.
2022-05-29 22:22:34 +01:00
David Robertson ea16964d87 jsonschema: {relative,absolute}_path can hold ints (#7980) 2022-05-29 16:38:54 +01:00
Xavier Francisco c94fb408b7 dj_database_url: make all keys optional in _DBConfig TypedDict (#7979)
Co-authored-by: Xavier Francisco <xavier.n.francisco@gmail.com>
2022-05-29 12:25:16 +01:00
Xavier Francisco 3191c1a2df Add stubs for dj-database-url (#7972)
Co-authored-by: Xavier Francisco <xavier.n.francisco@gmail.com>
2022-05-28 15:14:35 +01:00
Lee 1eef7365b9 markdown: remove __getattr__() (#7962) 2022-05-27 23:12:22 -07:00
Stephen Rosen f52da1e8b0 Flesh out more of jsonschema stubs (#7950)
Apply more detailed annotations to the format module and most of the
exceptions module.
2022-05-27 17:33:32 +01:00
Xavier Francisco 2d2b34c1ee openpyxl: annotate openpyxl.utils.cell stubs (#7969) 2022-05-27 13:58:20 +01:00
Sebastian Rittau d2728cf688 dateutil: Add dateutil.rrule.weekdays (#7968)
Closes: #7946
2022-05-27 11:15:03 +01:00
Crozzers 082faf0d29 Pillow: change _Mode type alias to str (#7967) 2022-05-27 11:16:41 +02:00
Jelle Zijlstra 789c12ad90 constructors: Fix defaulted TypeVars (#7965)
From the list in https://github.com/microsoft/pyright/issues/3501
2022-05-27 07:32:56 +01:00
Crozzers 62a8a6922c Pillow: Add missing image modes to _Mode type alias in Image.pyi stub (issue #7956) (#7960) 2022-05-26 19:00:48 +01:00
Jelle Zijlstra 466f9c2ad7 redis: Fix unconstrained TypeVars in a few redis commands (#7942)
Part of #7928
2022-05-26 15:53:56 +01:00
Alex Waygood fa636bc044 Third-party stubs: fix several fictitious type aliases (#7958) 2022-05-26 06:26:26 -07:00
Lee 597be79b18 markdown: annotate __deprecated__ (#7955) 2022-05-26 07:23:59 +01:00
Akuli f77d0f80a8 requests: allow immutable headers (#7932) 2022-05-25 20:22:05 -07:00
Jaakko Lappalainen 773ddb15bb Pillow: use union type for Image.paste (#7893) 2022-05-25 10:04:59 +01:00
Jelle Zijlstra 796a689fc1 mock: Fix unconstrained TypeVar (#7945)
The first overload covers the case where `new` is not given.

Part of #7928
2022-05-25 06:52:40 +01:00
Jelle Zijlstra 070e6c2a2d invoke: Fix unconstrained TypeVar (#7943)
Part of #7928 

https://github.com/pyinvoke/invoke/blob/f34c6c9413146a34ede3a5b529916b4cee649887/invoke/tasks.py#L328
2022-05-25 06:48:49 +01:00
Jelle Zijlstra bb119544d8 pkg_resources: Fix unconstrained TypeVars (#7941)
https://github.com/pypa/setuptools/blob/499c468a57d240e5bb450bdb6daedc3e559541dd/pkg_resources/__init__.py#L1049

Part of #7928
2022-05-24 19:49:22 -07:00
Alex Waygood 54e11a1ec4 mypy_extensions: fix TypeVar usage (#7937)
#7928
2022-05-24 11:26:35 -07:00
L 1e097a75cb markdown: Annotate methods of Registry (#7926)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-05-24 10:23:48 -07:00
Rens Oliemans 6e18441a2c Update emoji stubs for version 1.7 (#7884) 2022-05-22 11:44:01 +01:00
Peter Pentchev ef887b7beb More setuptools.command.easy_install definitions. (#7145)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-05-22 00:31:31 +03:00
eggplants 6d372ffc09 Add docopt.printable_usage (#7913) 2022-05-21 18:33:04 +02:00
David Robertson e5594aac60 Annotations for psycopg2.ConnectionInfo (#7834)
* Annotations for psycopg2.ConnectionInfo

These annotations come from the documentation here:

https://www.psycopg.org/docs/extensions.html#psycopg2.extensions.ConnectionInfo
If there was doubt, I referred to the libpq documentation cited by
psycopg2's docs.

I wasn't completely sure about `dsn_parameters`. Psycopg2's docs list it
as an `dict`, and the example suggests it's a `dict[str, str]` at that.
From psycopg2's source I found

    https://github.com/psycopg/psycopg2/blob/1d3a89a0bba621dc1cc9b32db6d241bd2da85ad1/psycopg/conninfo_type.c#L183-L206

which is implemented here:

    https://github.com/psycopg/psycopg2/blob/1d3a89a0bba621dc1cc9b32db6d241bd2da85ad1/psycopg/utils.c#L251-L279

I'm no expert in CPython's API, but this looks to me like it's building
a `dict[str, str]`.

Additionally, the libpq docs

https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PQCONNINFO
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PQCONNDEFAULTS

show that the underlying data just consists of strings.

Additionally, I'm pretty sure from this chunk of source

    https://github.com/psycopg/psycopg2/blob/1d3a89a0bba621dc1cc9b32db6d241bd2da85ad1/psycopg/conninfo_type.c#L581-L598

That `ConnectionInfo.__init__` takes one positional-only argument, which
must be a `psycopg2.connection`. But I don't think users are intended to
be constructing this type, so I've not added that annotation.

* Annotate `connection.info` and related attributes

* Make ConnectionInfo attributes properties

According to https://github.com/psycopg/psycopg2/blob/1d3a89a0bba621dc1cc9b32db6d241bd2da85ad1/psycopg/conninfo_type.c#L534-L563

* Mark connection attributes as readonly

according to https://github.com/psycopg/psycopg2/blob/8ef195f2ff187454cc709d7857235676bb4176ee/psycopg/connection_type.c#L1244

* Explain why some properties aren't `T | None`
2022-05-21 07:38:52 -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
Atsu Kakitani d389b5f9cb Import SQLAlchemy types in Flask-SQLAlchemy (#7861) 2022-05-19 08:19:49 +02:00
L 4a08afcbc2 markdown: Annotate parseBoolValue() (#7875) 2022-05-18 20:20:23 -07:00
Mehdi ABAAKOUK f6c1383cae reds: commands from asyncio module must be async (#7820)
redis-py has introduced an asyncio module since 4.2 and almost all
commands should be async if the redis.asyncio.Redis is used instead of
redis.Redis.

This changes adds the types for all core commands.

Related to #7597
2022-05-18 19:50:01 -07:00
Akuli 9a09db46f5 Fix requests.Session().hooks (#7871)
Fixes #7776

Mutating hooks, as in `session.hooks['response'] = ...`, should work. Reassigning it like `session.hooks = ...` is probably a bad idea, so it will always be a `dict`.
2022-05-18 19:31:34 -07:00
Eitan Mosenkis f2f72d6c52 Add return type for dateutil.rrule._rrulestr.__call__. (#7868) 2022-05-18 22:57:38 +01:00
L ada3615a24 markdown: Annotate code_escape(). (#7857) 2022-05-17 17:54:25 -07:00
Sebastian Rittau a05ee9740d Markdown: use I/O protocols (#7851) 2022-05-17 15:00:59 +02:00
L 81be86af6e markdown: Annotate Registry.get_index_for_name() (#7848) 2022-05-17 11:48:55 +02:00
Alejandro Giacometti 87abd8a39f requests: Fix type of request headers (#7773)
Allow bytes values. In `Session` methods, `None` can be used to ignore the session's headers.
2022-05-16 23:33:46 +03:00