Commit Graph

61 Commits

Author SHA1 Message Date
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
Walter Scott Johnson
901cb33a3c Mark asyncio loop parameters as Optional (#3047) 2019-06-10 20:58:31 +02:00
Mark Vismonte
a193aacea8 Add py3.7 support to Future.add_done_callback (#2970) 2019-05-07 13:14:03 -04:00
Anirudh Padmarao
53d4610579 Add stub for asyncio.BaseEventLoop (#2960) 2019-05-07 12:08:33 -04:00
Mark Vismonte
8451cd7819 Add annotation for Future._callbacks (#2965) 2019-05-07 18:02:41 +02:00
Mark Vismonte
e4a81132c4 Fix Future.__init__'s loop variable annotation (#2961) 2019-05-06 22:02:56 -04:00
Mark Vismonte
fe06e8e3c5 Add annotation to Future._loop (#2959) 2019-05-06 22:00:40 -04:00
Yegor Roganov
4cd9a8ef91 Make loop optional in asyncio.Queue (#2923)
Default value is `None`, so `loop` should be optional.
2019-04-14 12:43:33 -07:00
Michael Lee
efb67946f8 Use variable annotations everywhere (#2909) 2019-04-13 10:40:52 +02:00
Jelle Zijlstra
832bf52c28 asyncio: make type alias private and CamelCase (#2849) 2019-03-11 08:43:00 +01:00
Chen Li
012901e318 [asyncio] Change _set_running_loop(loop: AbstractEventLoop) to _set_running_loop(loop: Optional[AbstractEventLoop]) (#2828) 2019-03-11 00:29:53 +01:00
Gleb Chipiga
6282e9f59f Update asyncio streams stub (#2845)
* Add is_closing and wait_closed methods to StreamWriter [Python 3.7]
* Update type of open_unix_connection and start_unix_server path parameter [Python 3.7]
2019-03-11 00:15:03 +01:00
Aymeric Augustin
af9082c302 Fix signature of asyncio.create_connection. (#2756)
* local_addr and server_hostname are optional and default to None.
* If sock is given, none of host, port, family, proto, flags and
  local_addr should be specified.
2019-02-23 10:04:15 -08:00
Aymeric Augustin
503cbb97a3 Fix signature of asyncio.create_server. (#2763)
* host may be None to bind to all interfaces.
* If sock is given, host and port shouldn't be specified.
2019-02-09 15:45:09 +01:00
Diogo Magalhães Martins
f4aed1fd40 Fixing type for asyncio.StreamWriter reader init parameter (#2719)
Closes #2718
2018-12-28 17:56:38 +01:00
Jelle Zijlstra
46ab77eb20 loop argument to asyncio.ensure_future is Optional (#2708)
The default value is None: https://github.com/python/cpython/blob/master/Lib/asyncio/tasks.py#L616.
2018-12-20 15:24:03 -08:00
Andrew Svetlov
b9be76c255 Task.current_task() and Task.all_tasks() have an optional loop parameter (#2690) 2018-12-12 13:18:18 -08:00
Sander Voerman
1b24d80087 Add get_loop() to asyncio.Future [Python 3.7] (#2680) 2018-12-09 21:37:37 +01:00