Commit Graph

156 Commits

Author SHA1 Message Date
Avasam
23ac9bff19 Check for unused pyright: ignore and differentiate from mypy ignores (#9397) 2022-12-28 10:44:29 +00:00
Коренберг Марк
bff43b53e5 Update asyncio subprocess optional **kwargs (#9177) 2022-12-18 09:51:31 -08:00
Lucina
da2d39f16d Mark asyncio.Runner as final (#9353)
As per 71b032635d/Lib/asyncio/runners.py (L47)
2022-12-12 00:33:30 -08:00
Lucina
ae41747836 Add loop_factory argument to asyncio.run on 3.12+ (#9354) 2022-12-12 07:07:31 +00:00
Bruce Merry
de12b1413d Refine types for asyncio transports (#9209)
- Change the return type of create_connection, start_tls,
  connect_accepted_socket, create_unix_connection to Transport
  rather than BaseTransport (closes #9199).
- Change the return type of create_datagram_endpoint to
  DatagramTransport rather than BaseTransport.
- Change the argument of sendfile to WriteTransport rather than
  BaseTransport.

I considered also changing the argument of start_tls to Transport, but
I think that will give false positives for code that implements a custom
transport class that inherits from both ReadTransport and WriteTransport
but not from Transport, and I'm not sure if typing has a way to express
an intersection of types. Since users are not normally expected to
implement transports that may be overthinking things.
2022-11-16 07:00:38 -08:00
Jelle Zijlstra
583b600db0 asyncio: improve bytes handling (#9013) 2022-10-29 00:36:44 +02:00
Allison Karlitskaya
c88c9dd18d asyncio: fix SubprocessTransport.send_signal return type (#8890) 2022-10-13 13:17:48 +02:00
Marc Mueller
93075bf2fc Use general type ignore for asyncio.Task (#8861) 2022-10-07 02:51:14 +01:00
Sam Bull
493e35b15e Make asyncio.Task covariant (#8781) 2022-10-03 14:44:59 -07:00
Nikita Sobolev
380022c650 Remove empty __init__ methods (#8816) 2022-09-30 13:08:41 +01:00
François Conzelmann
7eb277e451 Add type to some asyncio.transports methods (#8756)
`WriteTransport.write`, `WriteTransport.writelines` and `DatagramTransport.sendto` methods only accept `bytes` trying an other type raises an exception

`BaseTransport._extra` is a dictionary with string as key
2022-09-20 19:14:59 -07:00
Alex Waygood
2c052651e9 Normalise use of Never vs NoReturn (#8549) 2022-08-17 21:53:40 +01:00
Nikita Sobolev
64bc0590a6 Remove un-needed __hash__ methods from stdlib (#8465) 2022-08-06 14:55:27 +01:00
Nikita Sobolev
2f15b0d4db _sendfile_compatible is a class variable (#8496) 2022-08-05 10:52:08 +02:00
Nikita Sobolev
a03e8b4949 Revert __eq__ removal (#8487)
Refs #8483
2022-08-04 23:51:42 +02:00
Nikita Sobolev
a376da87bd Remove duplicate definitions (#8483) 2022-08-04 18:55:18 +02:00
Sam Bull
be0d159df3 asyncio.AbstractEventLoop: Allow Path for create_unix_server() (#8376) 2022-07-24 15:43:52 +01:00
Alex Waygood
e156c63bdb inspect, asyncio: Use more TypeGuards (#8057) 2022-07-18 19:49:12 -07:00
Alex Waygood
4b504c78e0 Improve asyncio callbacks (#8192) 2022-07-18 19:46:38 -07:00
Alex Waygood
1ebe1b463e Fix asyncio.gather regression (#8271)
Adding the empty-tuple overload caused major problems for pyright, and that overload only deals with an unlikely edge case anyway. Get rid of it, and replace the fallback overload with a more general overload.

Fixes #8270.
2022-07-16 18:56:58 +01:00
Alex Waygood
27db37240a Remove files that only exist on <=3.6, update a few comments (#8273) 2022-07-12 09:12:32 +02:00
Alex Waygood
edc0ecd857 Remove Python 3.6 branches from typeshed (#8269) 2022-07-11 10:55:17 +02:00
Florimond Manca
2792910ace Tweak pre-3.8 iscoroutine stub (#8104) 2022-07-06 13:28:43 +01:00
Chris Cotter
f7ff6239ff asyncio task factory can accept Coroutines too (#8205)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-07-03 18:00:29 +01:00
Alex Waygood
7c3b13ba4f asyncio.sslproto: _SSLPipe and several SSLProtocol attributes no longer exist on py311 (#8186) 2022-06-27 08:12:01 +02:00
Alex Waygood
8b3b6bf7cd stdlib: Audit Callable[<parameters>, None] annotations (#8187) 2022-06-27 08:08:28 +02:00
Alex Waygood
8826d3a36f Rename some confusingly named type aliases (#8129) 2022-06-21 20:51:05 +01:00
Alex Waygood
0740d1c48e asyncio.gather: Add overload for if no positional arguments are provided (#8126) 2022-06-21 15:31:40 +01:00
Alex Waygood
cad42c7c7b asyncio.gather: Remove default values for return_exceptions: bool overloads (#8123) 2022-06-21 05:57:06 -07:00
Alex Waygood
9db96967cc asyncio.sslproto: More updates for py311 (#8022)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-06-06 15:12:22 -07: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
Jelle Zijlstra
eab82c838a asyncio: updates for 3.11 (#7844)
CPython changes:

- 13c10bfb77
- 9523c0d84f
- 9f04ee569c
- d03acd7270
- 195a46d6ff

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
Alex Waygood
e9526faf40 Various py311 removals (#7836) 2022-05-16 17:28:13 -07:00
Rick Voormolen
693c4f19b4 Mark Future._callbacks as a @property (#7829) 2022-05-11 11:13:29 +02:00
Akuli
bfa918880f asyncio: expose WriteTransport.get_write_buffer_limits on all Python versions (#7718) 2022-04-27 16:38:25 +03:00
Akuli
7576c5e1d5 asyncio: add missing methods to _FlowControlMixin (#7719) 2022-04-27 16:32:22 +03:00
Alex Waygood
b093c90a94 Use TypeAlias for type aliases where possible, part II (#7667) 2022-04-20 20:02:47 +01:00
Alex Waygood
97a74bc1aa Import from collections.abc wherever possible (#7635) 2022-04-18 12:50:37 +02:00
Alex Waygood
740193a8fc Use TypeAlias where possible for type aliases (#7630) 2022-04-15 18:01:00 -07:00
Alex Waygood
a1b1b95f67 Unpin Python micro versions used by stubtest (#7619)
Add new `asyncio` method, fix allowlists
2022-04-13 22:07:01 +02:00
Akuli
40553277ad asyncio: use WriteTransport in StreamWriter (#7611) 2022-04-09 07:03:34 -07:00
Alex Waygood
da3e69d093 stdlib: Improve a bunch of __(a)exit__ methods (#7571) 2022-04-01 08:05:25 +02:00
luzpaz
6550a30fdc Fix source comment typo (#7567)
Found downstream in mypy
2022-03-30 18:06:09 +01:00
Stefan Zabka
f40747f81d Add Server to asyncio.base_events' __all__ (#7554)
Add Server to asyncio.base_events' __all__

Closes #7552
2022-03-25 20:32:28 +00:00
Harry
b69d64df60 allow start_server to accept a Sequence of hosts (#7546) 2022-03-24 19:44:45 +01:00
Alex Grönholm
3a8d121890 Fix type of the "host" parameter in asyncio getaddrinfo() (#7517) 2022-03-20 13:17:55 +00:00
Jelle Zijlstra
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
Alex Waygood
3ab250eec8 Use PEP 604 syntax wherever possible (#7493) 2022-03-16 16:01:33 +01:00
Alex Waygood
bc72b25a2a Make more miscellaneous fields read-only, annotate _json.make_encoder (#7439) 2022-03-06 15:41:49 -08:00
Jelle Zijlstra
0a6b6b095c Add asyncio.windows_utils.Popen (#7396) 2022-03-02 12:37:54 +02:00