Shantanu
bc6da51495
asyncio: export submodules ( #4346 )
...
Resolves #4345
Co-authored-by: hauntsaninja <>
2020-07-21 09:34:00 +02:00
Sebastian Rittau
5e76f51930
Upgrade to isort 5 ( #4323 )
...
This now also reformats imports not at the top of files.
2020-07-16 07:01:57 -07:00
Alex Grönholm
ad89dee03b
Fixed return type of getaddrinfo() everywhere ( #4304 )
2020-07-10 10:46:28 +02:00
Alex Grönholm
f9d469ac2b
Fixed parameter and return types of getnameinfo() everywhere ( #4305 )
2020-07-03 15:46:02 +02:00
Jelle Zijlstra
0142a87da8
adjust isort config ( #4290 )
...
Fixes #4288 .
- Default imports to THIRD_PARTY, so in effect we merge the FIRST_PARTY and THIRD_PARTY stubs. This means import order is no longer affected by whether typing_extensions is installed locally.
- Treat typing_extensions, _typeshed and some others as standard library modules.
Note that isort master is very different from the latest release; we'll have to do something
different if and when the next isort release comes out.
2020-06-29 00:00:21 -07:00
Sebastian Rittau
4586ed9adc
Require black and isort for contributions ( #3329 )
...
* Add explanation to CONTRIBUTNG.md
* Add sample pre-commit script
* Check for correctly formatted files in CI
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com >
2020-06-28 15:28:28 -07:00
Jelle Zijlstra
5d553c9584
apply black and isort ( #4287 )
...
* apply black and isort
* move some type ignores
2020-06-28 13:31:00 -07:00
Denis Laxalde
0dd3258ed2
Add __aiter__ and __anext__ methods for asyncio.StreamReader ( #4286 )
...
The following code produces an error in mypy:
import asyncio
from asyncio.subprocess import PIPE
async def main() -> None:
proc = await asyncio.create_subprocess_shell("ls -l", stdout=PIPE)
assert proc.stdout is not None
async for line in proc.stdout:
print(line.decode())
await proc.wait()
asyncio.run(main())
$ mypy --strict file.py
file.py:8: error: "StreamReader" has no attribute "__aiter__" (not async iterable)
This commits fixes this by adding __aiter__/__anext__ methods that are
needed for async iterator protocol.
2020-06-28 11:57:49 -07:00
Jelle Zijlstra
e1d89e5742
remove references to "Text" in Python 3-only stubs ( #4251 )
2020-06-22 12:39:01 +02:00
Sebastian Rittau
89d3a55f1a
Preparations for the Big Reformat ( #4228 )
...
A few comments between imports were removed or moved to the top of the
import block, due to behavioral differences between black and isort. See
psf/black#251 for details.
In two instances @overloads at the top of the file needed to be moved
due to psf/black#1490 .
2020-06-14 07:58:26 -07:00
Jelle Zijlstra
d0b85d7efe
remove _types ( #4220 )
2020-06-11 09:10:52 +02:00
Jelle Zijlstra
44a852dff5
Literal: always import from typing_extensions for simplicity ( #4219 )
2020-06-10 21:23:58 -07:00
Jelle Zijlstra
43e93f803f
use _typeshed's Path aliases ( #4214 )
2020-06-10 20:57:09 -07:00
Jaromir Latal
c36e4517f7
[stdlib][asyncio] Accept optional context in (Timer)Handle ( #4190 )
2020-06-07 06:33:46 -07:00
Christopher Head
948c1a63e6
Relax asyncio.TimerHandle.__init__ args parameter ( #4193 )
...
Just like the Handle class, the TimerHandle class can take any sequence
here, not just a list.
2020-06-06 18:33:23 -07:00
Jaromir Latal
9ab4ec568d
[stdlib][asyncio] Widen asyncio.events.handle arguments type ( #4188 )
...
Co-authored-by: Jaromir Latal <jaro@fb.com >
2020-06-06 16:48:02 +02:00
Jaromir Latal
52bf411f2b
[stdlib][asyncio] Allow optional policy in ( #4189 )
...
Co-authored-by: Jaromir Latal <jaro@fb.com >
2020-06-06 16:47:04 +02:00
Sam Bull
5b66868156
Allow Path in create_subprocess_* ( #4159 )
2020-06-04 17:11:53 +02:00
Rune Tynan
342ce69f88
Add missing asyncio modules ( #4149 )
2020-06-01 02:05:16 +02:00
Shantanu
62304eb02f
asyncio: update cancels for py39 ( #4135 )
...
Co-authored-by: hauntsaninja <>
2020-05-28 13:42:31 -07:00
Shantanu
feb43f7237
asyncio: add asyncio.threads for py39 ( #4136 )
2020-05-28 13:37:46 -07:00
Rune Tynan
7ba59719b6
Fix asyncio IocpProactor version availability ( #4121 )
2020-05-27 20:14:00 -07:00
Shantanu
54c99ff75f
asyncio: add shutdown_default_executor ( #4115 )
...
There are a couple other py39 changes to be made in asyncio, but I'm
trying to avoid merge issues with whitelists / Windows for now.
Co-authored-by: hauntsaninja <>
2020-05-27 18:35:39 -07:00
Rune Tynan
713a2729b4
Fix stubtest failures for asyncio on windows ( #4092 )
2020-05-27 19:08:19 +02:00
Shantanu
448c4e1fa7
asyncio.protocols: fix version availability ( #4081 )
...
Co-authored-by: hauntsaninja <>
2020-05-25 21:54:05 -07:00
Shantanu
18121d71c8
concurrent.futures: fix top level available objects, add InvalidStateError ( #4021 )
...
* concurrent.futures: add InvalidStateError
* concurrent.futures: fix package imports
* asyncio.futures: fix import
* concurrent.futures: fix version availability for BrokenExecutor
* concurrent.futures: make consistent
* concurrent.futures: update whitelist
Co-authored-by: hauntsaninja <>
2020-05-25 15:38:09 -07:00
Shantanu
462a3e9dcd
asyncio: fix signature of set_write_buffer_limits ( #4025 )
...
Co-authored-by: hauntsaninja <>
2020-05-17 08:50:31 -07:00
Shantanu
cc0ffb1648
asyncio.protocols: BufferedProtocol inherits from BaseProtocol ( #3989 )
...
Co-authored-by: hauntsaninja <>
2020-05-13 19:08:47 -07:00
Shantanu
3662bf89d5
asyncio.locks: fix _ContextManagerMixin base class ( #3979 )
2020-05-13 17:57:02 -07:00
Kazushi Kitaya
d39e58c3bc
asyncio.subprocess: returncode is Optional ( #3981 )
2020-05-13 16:14:42 +02:00
Shantanu
fec46043ed
asyncio: various fixes ( #3947 )
...
* asyncio: remove BaseChildWatcher from top level
* asyncio.sleep: loop is keyword-only
* asyncio: remove Server from top level
* asyncio: add FastChildWatcher to top level
* asyncio.constants: fix version availability
* asyncio: fix arg name for _wakeup
* asyncio: fix arg name for wrap_future
* asyncio.streams: add Optional to various arguments
It might be possible to further improve some of these with overloads.
* stubtest: fix whitelist
Co-authored-by: hauntsaninja <>
2020-04-30 17:04:36 -07:00
Kjell Braden
aa06f3bc7b
use socket.sendto argument spec for DatagramTransport ( #3943 )
2020-04-25 13:23:29 +02:00
Shantanu
aa84ff750e
asyncio: remove private methods that don't exist ( #3938 )
...
Co-authored-by: hauntsaninja <>
2020-04-23 19:20:57 -07:00
Shantanu
0532e72e7f
asyncio: mark positional-only args ( #3934 )
2020-04-22 19:34:30 +02:00
Brian Turek
990e648928
Change run_in_executor to return a Future rather than be a coroutine ( #3935 )
2020-04-22 19:00:13 +02:00
Shantanu
ec57251010
asyncio.events: various fixes ( #3931 )
...
- connect_accepted_socket isn't a member of AbstractEventLoop, only
BaseEventLoop
- fix types of arguments with defaults. some of these functions could
have their signatures improved with overloads to reduce false negatives
- correctly mark a positional-only argument
- remove abstractmethod from methods that don't have abstractmethod and
go unimplemented in practice
2020-04-20 17:56:24 -07:00
Shantanu
626a0f3f73
asyncio.subprocess: loop is Optional ( #3930 )
2020-04-20 12:20:08 +02:00
Anthony Sottile
8e46eb7b85
create_subprocess_shell takes a single positional argument ( #3929 )
2020-04-19 13:46:37 +02:00
Debjyoti Biswas
e571d1a2c2
Change Task[Any] to Task[_T] in return statements ( #3878 )
2020-03-24 15:46:03 +01:00
Oleg Höfling
dc060fac2a
on windows, resolve proactor and selector event loop policies only for python 3.7 and newer ( #3866 )
...
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
2020-03-18 17:42:01 -07:00
Ben Leslie
01d4a4c395
Change return type of Future.exception to be Optional[BaseException] ( #3849 )
...
Future.exception can return None if no exception was capture in the future.
As documented: https://docs.python.org/3/library/asyncio-future.html#asyncio.Future.exception
2020-03-13 20:38:58 -07:00
Andrew Svetlov
52d3b9eaba
Fix remove_child_handler() return type ( #3841 )
2020-03-11 14:50:06 +01:00
Shantanu
c478d3aa98
asyncio: add arguments to subprocess_shell ( #3825 )
2020-03-07 12:45:30 +01:00
Oleg Höfling
6600dabd5c
import SelectorEventLoop from asyncio.unix_events when not on windows ( #3753 )
...
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
2020-02-21 20:49:31 -08:00
Oleg Höfling
94fd3b5101
Add type stubs for asyncio.unix_events ( #3664 )
...
* add 3.7 child watchers
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
* add 3.8 child watchers
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
* remove 3.7 check
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
* fix too strict watcher return type in _UnixDefaultEventLoopPolicy.get_child_watcher
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
* group asyncio imports
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
* fixed platform check for importing from asyncio.unix_events
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
2020-02-01 14:08:33 -08:00
Niklas Fiekas
64fea9c543
asyncio: get_returncode() and get_pipe_transport() can return None ( #3663 )
2020-01-26 12:38:11 -08:00
Oleg Höfling
99d79696d7
accept optional extras in asyncio.BaseTransport init ( #3661 )
...
Signed-off-by: Oleg Höfling <oleg.hoefling@gmail.com >
2020-01-26 15:48:44 +01:00
Shantanu
7e6dbc4393
asyncio: fix various version availability ( #3638 )
2020-01-23 15:04:04 +01:00
Shantanu
8b241b5243
asyncio: fix SendfileNotAvailableError availability ( #3631 )
2020-01-22 17:27:58 +01:00
Andrew Svetlov
dfe289e43b
Fix local_addr type ( #3622 )
2020-01-19 19:32:20 +01:00