Commit Graph
6209 Commits
Author SHA1 Message Date
Winston ChangandGitHub 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 MosenkisandGitHub f2f72d6c52 Add return type for dateutil.rrule._rrulestr.__call__. (#7868) 2022-05-18 22:57:38 +01:00
Sebastian RittauandGitHub 3aaa1d0ada Upgrade pyright to 1.1.247 (#7867) 2022-05-18 19:56:19 +01:00
Sebastian RittauandGitHub 7ca82d5fb4 stubtest third party: remove extra line when skipping a distribution (#7864) 2022-05-18 20:15:55 +02:00
Alex WaygoodandGitHub a98a1ead06 Improve output of mypy_test when reporting errors (#7863) 2022-05-18 19:10:54 +01:00
Jelle ZijlstraandGitHub 7998906226 re: 3.11 fixes (#7859) 2022-05-17 21:42:23 -07:00
Jelle ZijlstraandGitHub bd394d2486 builtins: add BaseException.add_note in py311 (#7860) 2022-05-17 20:32:28 -07:00
Jelle ZijlstraandGitHub a01f98c361 sqlite3.Blob: fix stubtest errors (#7858) 2022-05-17 19:50:19 -07:00
8f5a83516b tempfile.SpooledTemporaryFile: inherit from IOBase on 3.11 (#7802)
python/cpython#29560

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-05-17 18:41:47 -07:00
eab82c838a asyncio: updates for 3.11 (#7844)
CPython changes:

- https://github.com/python/cpython/commit/13c10bfb777483c7b02877aab029345a056b809c
- https://github.com/python/cpython/commit/9523c0d84f351a610dc651b234461eb015fa3b82
- https://github.com/python/cpython/commit/9f04ee569cebb8b4c6f04bea95d91a19c5403806
- https://github.com/python/cpython/commit/d03acd7270d66ddb8e987f9743405147ecc15087
- https://github.com/python/cpython/commit/195a46d6ffd4cec6c5fb69c5890f8b1758ac91ca

Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-05-17 18:11:29 -07:00
LandGitHub ada3615a24 markdown: Annotate code_escape(). (#7857) 2022-05-17 17:54:25 -07:00
Sebastian RittauandGitHub b65ef3a722 Make third party stubtest output more succinct (#7853)
stubtest_third_party.py will now only print a single line when the test
succeeds for a certain distribution, unless the "-v" option is given.
When the test fails or "-v" is given, will still print the full output.

The success status is now colored to make spotting failures easier.

stdout/stderr is now used consistently: The distribution name and
success status is always printed to stdout, all other output goes to
stderr. Running the script with "2>/dev/null" will only show the success
status of the test, one per line.
2022-05-17 16:10:58 -07:00
Carl MeyerandGitHub 7ca8303672 CodeType.co_linetable is of type bytes (#7856)
Although the specific format of the bytes is opaque and undocumented, the fact that it will be bytes is stable.

This is necessary in order for type checkers to allow creating one code object from another, since the `lnotab`
positional argument to `__init__` is typed as bytes.
2022-05-17 11:49:12 -07:00
171ea08f0d Add __class_getitem__ to classes in logging and csv (#7830)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-05-17 14:12:42 +01:00
Sebastian RittauandGitHub f21898abb9 Improve I/O types in socket.pyi (#7852)
* Use a protocol for socket.sendfile() "file" argument.
* Use concrete classes for socket.makefile() return types.
2022-05-17 06:11:50 -07:00
Alex WaygoodandGitHub eadb35e620 Don't run mypy_primer on changes to test files (#7854)
Only changes to files in `stdlib` or `stubs` will ever have any effect on the checked open-source code. But also run primer on changes to files in `.github/workflows` so that we can see the effect of changes to the `mypy_primer.yml` file itself.
2022-05-17 14:03:58 +01:00
Sebastian RittauandGitHub e1bd9c73f0 Use I/O protocols in codecs.pyi (#7849) 2022-05-17 15:01:57 +02:00
Sebastian RittauandGitHub a05ee9740d Markdown: use I/O protocols (#7851) 2022-05-17 15:00:59 +02:00
LandGitHub 81be86af6e markdown: Annotate Registry.get_index_for_name() (#7848) 2022-05-17 11:48:55 +02:00
ShantanuGitHubhauntsaninja <>
cb45a4387f stubtest: organise allowlists (#7847)
Co-authored-by: hauntsaninja <>
2022-05-16 21:29:39 -07:00
ShantanuandGitHub b445bb8856 stubtest: test against 3.11 (#7845) 2022-05-16 19:50:30 -07:00
ShantanuGitHubhauntsaninja <>
05c929d42c stubtest_stdlib: [minor] remove unused code (#7846)
Co-authored-by: hauntsaninja <>
2022-05-16 19:40:46 -07:00
Alex WaygoodandGitHub e9526faf40 Various py311 removals (#7836) 2022-05-16 17:28:13 -07:00
Alejandro GiacomettiandGitHub 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
LandGitHub 487bef5a67 markdown: isBlockLevel() returns a bool value. (#7839) 2022-05-16 15:52:22 +02:00
Jukka LehtosaloandGitHub 21a81c6575 sqlite3: Avoid optional type for 'description' (#7842)
Use the `| Any` trick instead, since it seems that in a lot of
code the value can be predicted to be non-`None` (if a query
has been executed previously, I think).

The docs don't mention the possibility of this being `None`, so
it seems likely that a lot of code doesn't check for it:
https://docs.python.org/3/library/sqlite3.html#sqlite3.Cursor.description
2022-05-16 14:54:15 +02:00
Jukka LehtosaloandGitHub dca33e5f8d gettext: Make GNUTranslations.CONTEXT not final (#7841) 2022-05-16 13:32:02 +02:00
Sam BullandGitHub 686cd6ef63 Add __version__/VERSION to redis (#7838) 2022-05-15 11:55:12 +01:00
LandGitHub dbccdcb50e markdown: @deprecated argument of message is a str. (#7835) 2022-05-12 18:48:20 -07:00
Adam SimpkinsandGitHub 40d6592ba1 tarfile.gettarinfo() accepts PathLike objects (#7832)
This method has accepted PathLike objects since Python 3.6
(https://github.com/python/cpython/pull/512)
2022-05-11 22:02:04 -07:00
LandGitHub f8db698ece markdown: PY37 is a bool (#7831) 2022-05-11 19:46:50 -07:00
Rick VoormolenandGitHub 693c4f19b4 Mark Future._callbacks as a @property (#7829) 2022-05-11 11:13:29 +02:00
ShantanuandGitHub a27f15ef0e builtins: reorder overloads (#7828)
This is slightly more friendly for --no-strict-optional (gross)
2022-05-11 01:00:52 -07:00
ShantanuGitHubhauntsaninja <>
468d8adff1 stubtest_third_party: show package versions on failure (#7826)
Co-authored-by: hauntsaninja <>
2022-05-11 08:08:02 +02:00
ShantanuandGitHub 75d2f6c881 statistics: improve type for median_grouped (#7825) 2022-05-11 08:06:35 +02:00
b00b4f3447 regex: accept buffers (#7680)
Similar to #7679

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2022-05-10 15:08:36 -07:00
Jelle ZijlstraandGitHub 68a781d04e Upgrade pytype (#7823) 2022-05-10 14:47:10 -07:00
Alex WaygoodandGitHub f8547a3f31 Use flake8-pyi 22.5.0, remove redundant parts of check_new_syntax (#7821) 2022-05-10 09:34:41 -07:00
Alex WaygoodandGitHub fed1f35c32 Remove explicit inheritance from object (#7819) 2022-05-10 16:24:53 +03:00
Sebastian RittauandGitHub b211bf31a3 Update testing_engine() annotations (#7818) 2022-05-10 12:46:01 +03:00
ShantanuandGitHub 550454c9aa beautifulsoup4: small fixes and updates (#7816) 2022-05-10 09:17:40 +02:00
ShantanuandGitHub 032787d867 builtins: accept old-style iterables to iter (#7817) 2022-05-10 09:06:31 +02:00
Alex WaygoodandGitHub ac30b96d14 Use str instead of Text (#7812) 2022-05-09 20:47:11 +01:00
Jelle ZijlstraandGitHub 5c13f8bbce ast: FormattedValue.conversion cannot be None (#7810)
```
In [4]: ast.dump(ast.parse('f"{x!r}"'))
Out[4]: "Module(body=[Expr(value=JoinedStr(values=[FormattedValue(value=Name(id='x', ctx=Load()), conversion=114)]))], type_ignores=[])"

In [5]: ast.dump(ast.parse('f"{x}"'))
Out[5]: "Module(body=[Expr(value=JoinedStr(values=[FormattedValue(value=Name(id='x', ctx=Load()), conversion=-1)]))], type_ignores=[])"
```
(On 3.9 but I don't think this has changed since 3.6.)

The stdlib also assumes this: https://github.com/python/cpython/blob/main/Lib/ast.py#L1211 (`chr(None)` doesn't work).
2022-05-08 19:42:38 -07:00
MixandGitHub 32f474d6ef subprocess: improve Popen.returncode type (#7806) 2022-05-08 16:53:44 -07:00
Alex WaygoodandGitHub 8d8420bc54 Fix bugs in check_new_syntax.py (#7808) 2022-05-08 21:59:19 +01:00
Alex WaygoodandGitHub bb39bdfd30 Add test cases for pow that are meant to fail a type check (#7760) 2022-05-08 08:16:37 -07:00
JulianandGitHub 032d937bdf #7805: Ensure all references to mode are Literals, not str. (#7807) 2022-05-08 16:51:27 +02:00
Alex WaygoodandGitHub 3ed7e3ba50 csv: annotate keyword arguments in various functions and methods (#7788) 2022-05-07 21:01:20 -07:00
Alex WaygoodandGitHub 4e946b74bf csv.pyi: minor cleanup (#7790) 2022-05-07 10:49:27 +02:00