Commit Graph

78 Commits

Author SHA1 Message Date
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
Daniel Farley
955e9c7da4 Unify file descriptor definitions (#3584)
The _types module can house any common type defintions used throughout
the rest of typeshed to keep defintions in sync.

First candidate is file descriptors where anything with `fileno()`
method is accepted. There were several different implementations in
various files that can be unified.
2020-01-08 17:25:36 -08:00
Alex Grönholm
f5a1925e76 Corrected type for "data" in two methods (#3562)
The documentation states:

* datagram_received: "data is a bytes object containing the incoming data."
* pipe_data_received: "data is a non-empty bytes object containing the received data."
2019-12-29 16:03:53 +01:00
Jason Fried
615fa41c25 asyncio/future.pyi - wrap_future loop keyword arg (#3507)
https://docs.python.org/3.8/library/asyncio-future.html?highlight=wrap_future#asyncio.wrap_future but it doesn't look like the signature has changed going back to 3.5
2019-11-26 16:03:54 -08:00
Ivan Levkivskyi
05780a0d11 Fix errors discovered by running typeshed check on Windows (#3456)
Fix errors discovered by running typeshed check on Windows. This is a temporary fix for #3446 (in long term we should figure out why these were not caught by typeshed CI).

I also remove an outdated comment while I am at it.
2019-11-11 12:18:58 +00:00
Sebastian Rittau
e4677d9ed4 Use async syntax instead of @coroutine (#3441) 2019-11-06 07:39:09 -08:00
Jelle Zijlstra
cd5cd12a35 asyncio: fix windows stubs (#3424) 2019-10-30 08:13:32 -07:00
Sebastian Rittau
5e9f66cb62 Add missing Python 3.7 and 3.8 annotations (#3399)
* Add explicit ssl_handshake_timeout arguments to open_connection and start_server

* Add context arguments to call methods

* Accept PathLike for create_unix_* paths

* Add TimerHandle.when()

Add missing version check

* AbstractServer is now an async context manager

* Add happy_eyeballs_delay and interleave arguments to create_connection

* Re-export asyncio.windows_events from asyncio

* Add name argument to Task constructor

* Add Task.get_coro()

* import and other fixes

* Fix return type of get_coro()
2019-10-29 19:49:37 -07:00
Sebastian Rittau
87d7dd3d95 Fix annotations with literal values (#3411) 2019-10-28 06:59:28 -07:00
Rune Tynan
dfe68625ec Add public missing asyncio stubs for windows and proactor files (#3234)
* Add public missing asyncio stubs for windows and proactor files, and any necessary private return/argument types.

* Add methods to BaseProactorEventLoop that mypy is complaining about, with note about status at runtime

* Add asyncio constants file
2019-10-14 21:03:29 -07:00
Sebastian Rittau
0501e2b329 Annotations for remaining Python 3.8 additions (#3358)
* Add os.add_dll_directory()
* Add memfd_create() and flags
* Add type annotation to flags
* Add stat_result.st_reparse_tag and flags
* Add ncurses_version
* Add Path.link_to()
* Add Picker.reducer_override()
* Add plistlib.UID
* Add has_dualstack_ipv6() and create_server()
* Add shlex.join()
* Add SSL methods and fields
* Add Python 3.8 statistics functions and classes
* Remove obsolete sys.subversion
* Add sys.unraisablehook
* Add threading.excepthook
* Add get_native_id() and Thread.native_id
* Add Python 3.8 tkinter methods
* Add CLOCK_UPTIME_RAW
* Add SupportsIndex
* Add typing.get_origin() and get_args()
* Add unicodedata.is_normalized
* Add unittest.mock.AsyncMock

Currently this is just an alias for Any like Mock and MagicMock. All of
these classes should probably be sub-classing Any and add their own
methods. See also #3224.

* Add unittest cleanup methods
* Add IsolatedAsyncioTestCase
* Add ElementTree.canonicalize() and C14NWriterTarget
* cProfile.Profile can be used as a context manager
* Add asyncio task name handling
* mmap.flush() now always returns None
* Add posonlyargcount to CodeType
2019-10-14 09:53:48 +02:00
Sebastian Rittau
950f391704 Remove unnecessary __all__ annotations (#3357) 2019-10-13 16:22:03 -07:00
秋葉
2bd1b75641 Extract asyncio exceptions into a separate module (Python 3.8) (#3356) 2019-10-13 12:20:02 +02:00
Sebastian Rittau
256b3ce8ab Remove a bunch of unused imports (#3323) 2019-10-08 07:59:32 -07:00
Sebastian Rittau
c32e1e2280 Enable --disallow-any-generics for stubs (#3288) 2019-10-01 05:31:34 -07:00
Brad
412b9e74d5 Change last asyncio.gather() overload ret. to List (#3248)
Stems from PR #1550/ Issue #3243.
2019-09-30 12:42:58 +02:00
hh-h
1e881ad156 switched return_exceptions from bool to Literal for asyncio.gather (#3275) 2019-09-29 16:46:37 +02:00
Andrew Svetlov
60bdf60eda Add missing default for ssl_handshake_timeout agrument (#3277) 2019-09-29 15:13:09 +02:00
Scott Belden
04bcb89aea create_server returns a Server, not AbstractServer (#3131)
* remove create_unix_connection and use ABCMeta
2019-08-23 08:31:40 +02:00
Cole Maclean
29771aa1ee Add missing methods to asyncio stubs (#3088) 2019-08-06 08:34:38 +02:00
Nicklas Lindgren
3c4141982e Declare asyncio.as_completed() as taking an Iterable (#3164)
The stub for asyncio.as_completed declared it as taking a Sequence of
Futures. This was unnecessarily strict.

Just like asyncio.wait, asyncio.as_completed can be declared to take
an Iterable of Futures instead. Both these functions iterate over
their argument only once to store its items in a set, so an Iterable
is sufficiently strict. This has been true since the initial
implementation of the functions.
2019-07-31 10:53:23 -07:00
Sebastian Rittau
9ccf9356bf Remove Python 3.4 support (#3147)
Closes #3123
2019-07-27 10:58:21 +02:00
Jelle Zijlstra
b0c9fa4530 fix type of loop.sock_connect (#3073) 2019-06-21 17:31:51 +02:00