Commit Graph

7553 Commits

Author SHA1 Message Date
Shantanu 5b1ef8b119 mmap: add MADV_FREE on darwin (#7923)
Co-authored-by: hauntsaninja <>
2022-05-22 15:30:09 -07:00
Rens Oliemans 6e18441a2c Update emoji stubs for version 1.7 (#7884) 2022-05-22 11:44:01 +01:00
Jelle Zijlstra 54c2e23a55 3.11 allowlist: move inspect._ParameterKind.description to wontfix section (#7920) 2022-05-22 12:04:11 +03: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
Jelle Zijlstra 3dcfbf3745 urllib.request: add code 308 handler for 3.11 (#7917)
https://github.com/python/cpython/commit/c379bc5ec9012cf66424ef3d80612cf13ec51006
2022-05-21 14:13:17 -07:00
Shantanu f2ea124e82 random: explicitly mention int for seed (#7916)
https://github.com/python/typeshed/pull/7906#discussion_r878750404
I felt this better documents how seed is used in practice

Co-authored-by: hauntsaninja <>
2022-05-21 13:00:05 -07:00
Jelle Zijlstra 1220a99399 unicodedata: add UCD.is_normalized (#7915) 2022-05-21 12:59:44 -07:00
Sebastian Rittau a412ddb437 Update pyright (#7914)
Required for #7865
2022-05-21 19:15:06 +01:00
eggplants 6d372ffc09 Add docopt.printable_usage (#7913) 2022-05-21 18:33:04 +02:00
Jelle Zijlstra ddc6eda10a symtable: has_exec was removed in 3.9 (#7911) 2022-05-21 17:50:27 +02:00
Jelle Zijlstra 39c777f70c pydoc: 3.11 changes (#7910) 2022-05-21 17:49:39 +02:00
Jelle Zijlstra 237b1bb189 binascii.a2b_base64: new param in 3.11 (#7909)
https://github.com/python/cpython/commit/35b98e38b6edd63153fc8e092f94cb20725dacc1
2022-05-21 08:36:03 -07:00
Jelle Zijlstra 9c0c631e46 gettext.install: names is kw-only in 3.11 (#7908) 2022-05-21 08:22:34 -07:00
Jelle Zijlstra 8b58371278 subprocess: new params in 3.11 (#7907) 2022-05-21 16:07:50 +01: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
Jelle Zijlstra 0198d75153 types: 3.11 (and earlier) fixes (#7900)
- New attributes in 3.11
- Arguments to CodeType.__init__ are always positional (have fun)
- co_consts can use object instead of Any
2022-05-21 07:37:11 -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
Jelle Zijlstra 7576805aee zipfile: 3.11 fixes (#7898)
* zipfile: 3.11 fixes

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-05-21 09:22:32 +01:00
Alex Waygood aa70cc8abb CI: Don't install tomli for stubtest_stdlib (#7901)
The script doesn't import tomli
2022-05-20 19:33:06 -07:00
Jelle Zijlstra 585517b20e stubtest: put all the incorrect __get__ sigs together (#7899) 2022-05-20 09:47:02 -07:00
Alex Waygood d54d018e2d CI: Fix stubtest workflow; make paths for other workflows more specific (#7897) 2022-05-20 16:37:02 +01:00
Alex Waygood e2cf6c21d5 CI: Don't run stubtest_stdlib on PRs that don't touch the stdlib (#7895)
* Don't run stubtest_stdlib on PRs that don't touch the stdlib
2022-05-20 15:56:29 +01:00
Jukka Lehtosalo cd039c9b73 Ignore mypy errors in Python 2 builtins and typing (#7894)
Similar errors are already ignored in Python 3 stubs. The
errors break Python 2 tests of mypy.

See https://github.com/python/typeshed/issues/7367#issuecomment-1131472225
for context.
2022-05-20 15:27:09 +01:00
Sebastian Rittau adf48f1f96 Only run CI on pushes to main/master and pull requests (#7883)
Currently, when a maintainer opens a pull request from a branch in the
typeshed repository (instead of a fork), CI is run twice: once for the
PR and once for the push. This not only wastes CI minutes (and it seems
we're running into some limits lately), but also makes CI output twice
as large and more difficult to process.

The disadvantage is that a PR needs to be opened to run CI.
Alternatively, CI can be triggered manually.
2022-05-20 14:14:25 +02:00
Jelle Zijlstra e7cbde0928 xml: stubtest fixes (#7890) 2022-05-20 13:03:45 +02:00
Jaakko Lappalainen 611fa18b5c Use bytes for resp param of imaplib.Internaldate2tuple (#7892) 2022-05-20 12:45:20 +02:00
Jelle Zijlstra 26fa57ab78 traceback: update for py311 (#7886) 2022-05-19 19:14:12 -07:00
Jelle Zijlstra 0b7df3b2aa dataclasses: fix and sort stubtest complaints (#7888) 2022-05-19 19:13:22 -07:00
Jelle Zijlstra 4220712aab dis: add adaptive argument for 3.11 (#7889) 2022-05-19 18:27:34 -07:00
Jelle Zijlstra 64766c8521 locale: add locale.getencoding (#7887)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2022-05-19 18:20:16 -07:00
Jelle Zijlstra 1ffb1bdc0e wsgiref: categorise stubtest issues (#7885) 2022-05-19 18:10:56 -07:00
Alex Waygood dd080d9840 Upgrade flake8-pyi to 22.5.1 (#7882) 2022-05-19 19:59:25 +02:00
Alex Waygood aa72cb1dcf Run pyupgrade on the tests directory (#7880) 2022-05-19 14:16:53 +01:00
Jelle Zijlstra 6f2c53f3b0 _imp: fix stubtest issues, add Python 3.11 items (#7878) 2022-05-19 14:43:58 +02:00
Alex Waygood 44d33f2fdb Add colour to the output of mypy_test, take 2 (#7879)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2022-05-19 13:29:15 +01:00
Jelle Zijlstra 250f3d92e7 ast: fix stubtest issues (#7877)
Add annotations for `_ast.Tuple.dims` and `ast.main()`. Add allowlist comments for others.
2022-05-19 10:13:08 +01:00
Atsu Kakitani d389b5f9cb Import SQLAlchemy types in Flask-SQLAlchemy (#7861) 2022-05-19 08:19:49 +02:00
Jelle Zijlstra 4191906e6e 3.11: move some stubtest entries to wontfix list (#7876) 2022-05-19 08:14:44 +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
Alex Waygood 04dde4d000 enum: More changes for 3.11 (#7862) 2022-05-18 19:35:22 -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
Alex Waygood a348dac6e7 Revert "Add colour to the output of mypy_test" (#7874)
Revert "Add colour to the output of `mypy_test` (#7872)"

This reverts commit 753eb053ac.
2022-05-18 17:13:06 -07:00
Alex Waygood 753eb053ac Add colour to the output of mypy_test (#7872)
And gracefully exit on KeyboardInterrupt.
2022-05-19 00:36:59 +01:00
Winston Chang 6653be1511 Add overloads for asyncio.sleep() (#7873)
Closes #7866. This adds an overload to `asyncio.sleep()`, so that when it is called _without_ `return=None`, the type checker knows that the return type is `None` instead of `unknown`.

Also related to https://github.com/microsoft/pyright/issues/3475.
2022-05-18 16:19:45 -07:00
Eitan Mosenkis f2f72d6c52 Add return type for dateutil.rrule._rrulestr.__call__. (#7868) 2022-05-18 22:57:38 +01:00
Sebastian Rittau 3aaa1d0ada Upgrade pyright to 1.1.247 (#7867) 2022-05-18 19:56:19 +01:00
Sebastian Rittau 7ca82d5fb4 stubtest third party: remove extra line when skipping a distribution (#7864) 2022-05-18 20:15:55 +02:00
Alex Waygood a98a1ead06 Improve output of mypy_test when reporting errors (#7863) 2022-05-18 19:10:54 +01:00
Jelle Zijlstra 7998906226 re: 3.11 fixes (#7859) 2022-05-17 21:42:23 -07:00