Commit Graph

88 Commits

Author SHA1 Message Date
Jelle Zijlstra
94ab32ba59 Fix abstract classes for Python 3 (#2239)
* add metaclass=ABCMeta to some classes

* mark some more classes as explicitly abstract

* make some more classes concrete
2018-06-16 10:18:54 -07:00
Jelle Zijlstra
82c930e66c Improve asyncio.tasks stubs (#2139)
- Use PEP 526-style variable annotations where possible
- Use FrameType instead of Any
- Remove workaround for mypy issue that was since fixed
2018-06-11 14:40:54 -07:00
Jelle Zijlstra
cb293ebd2e switch order of base classes on awaitable classes (#2125)
Fixes #1940.

This makes it so that mypy will infer the common base class of these
classes to be Awaitable instead of Iterable. I verified that this
fixes the errors in the script posted by @neilconway.
2018-06-11 14:20:31 -07:00
NODA, Kai
b472130201 Improve asyncio APIs which take TCP port (#2006)
They have getaddrinfo(3) as their backend, and accept port='http' etc. You can even omit (pass None to) either of host or port for start_server() to effectively select 'localhost' and an arbitrary ephemeral port, respectively.
2018-04-08 23:17:32 -07:00
Sergey Passichenko
00efd76861 Rename parameter to match the actual name in stdlib (#1959) 2018-03-10 09:10:09 -08:00
Rob Day
f91163d729 Fix type of loop parameter to start_unix_server (#1939) 2018-03-03 13:34:02 -08:00
NODA, Kai
3c4bc4266d improve asyncio.AbstractEventLoop.getaddrinfo() (#1867)
The signature should match that of socket.getaddrinfo()
2018-02-14 16:09:38 +00:00
Rick Kilgore
1713ad64de allow Optional[float] for asyncio.wait() timeout arg (#1860) 2018-02-07 19:49:33 -08:00
Nathan Henrie
9429ac070b Use Union[bytes, Text] instead of AnyStr (#1819) 2018-01-11 08:23:39 -08:00
Nathan Henrie
87fca814b1 addr should be Tuple[str, int], not str (#1740)
I think `addr` here should also be  `Tuple[str, int]`, the same change made to `sendto` in [this pr merged a few months ago](0e26c1f936 (diff-d21efb8da2d73c6c7c769270b387cd47)).
2017-11-12 23:14:16 -08:00
Jelle Zijlstra
54dd6ba27c Change numerous default values to ... (#1722)
This is the convention, and some default values (e.g. strings) apparently
break pytype.
2017-11-09 06:28:40 -08:00
Martin DeMello
817c270c32 Clean out the pytype blacklist (#1667) 2017-10-24 10:38:34 -07:00
FichteFoll
8b6234ad2c Use self-type in asyncio.Future.*_done_callback (#1614) 2017-10-10 10:06:57 -07:00
Carl Meyer
a19d4e34c3 Add 3-argument overload for asyncio.gather. (#1644) 2017-10-03 11:41:25 -07:00
Bruce Merry
55dbb967ad Corrections to the asyncio exception stubs (#1623)
Fixes #1622:

- Missing attribute `LimitOverrunError.consumed`
- Missing attribute `IncompleteReadError.expected` and `.partial`
- `partial` argument to `IncompleteReadError` had incorrect type
- `expected` argument to `IncompleteReadError` missing `Optional`
2017-09-22 07:47:17 -07:00
FichteFoll
cc3e753202 All loop kwargs in asyncio.streams are optional (#1615)
I verified this with the module code. All these loop arguments default
to `None` and are set with `events.get_event_loop()` if this is the
case.
2017-09-18 07:51:25 -07:00
Liran Nuna
c5f1e907fa More precisely typehint asyncio.gather up to 5 params (#1550) 2017-08-28 21:37:51 -07:00
Ivan Levkivskyi
d75ea88da5 Use 'as name' patter to re-export names from stubs (PEP 484) (#1484) 2017-07-14 21:31:53 -07:00
Jelle Zijlstra
0e26c1f936 asyncio: fix several types (#1450)
Fixes #1447
2017-07-06 14:22:55 -07:00
Guido van Rossum
350563223f Add Optional[] for all remaining cases of x: <type> = None (#1424)
* Final round of adding Optional[] to type of arguments with default = None
* Update Travis to use --no-implicit-optionals and clarify CONTRIBUTING.md
2017-06-21 10:50:21 -07:00
Suren Nihalani
d494114214 asyncio.subprocess: fix type to include IO instead of just int and match Popen (#1366)
Fixes #1365
2017-05-28 18:58:23 -07:00
Sebastian Meßmer
e6af58a4cc Fix type stubs in locks.pyi (#1250) 2017-05-25 19:32:17 -07:00
Sebastian Meßmer
3cfc146223 Fix type stubs in streams.pyi (#1252) 2017-05-23 23:14:41 -07:00
Jelle Zijlstra
6c5474ae8c various fixes to asyncio stubs (#1305) 2017-05-23 16:14:29 -07:00
Jan Hermann
d68d0c5c00 fix asyncio.BaseEventLoop.create_task for >=3.5 (#1272)
* fix python/typeshed#1202 asyncio.BaseEventLoop.create_task for >=3.5

* remove unnecessary version distinction
2017-05-20 11:06:10 -07:00
Sebastian Meßmer
2ed9ee104f Fix type stubs in transports.pyi (#1255) 2017-05-08 16:26:01 -07:00
Sebastian Meßmer
595e601882 Fix type stubs in events.pyi (#1256) 2017-05-08 16:24:25 -07:00
Sebastian Meßmer
9311e980f4 Fix type stubs in subprocess.pyi (#1253) 2017-05-08 16:24:02 -07:00
Jeremy Apthorp
55dc338bbf Add stub for asyncio.wrap_future (#1183)
Closes #1182.
2017-04-21 07:53:14 -07:00
Sam Dunster
aaa83a7f12 Add missing attributes: asyncio.subprocess.Process (#1154)
Add typehints for the following `asyncio.subprocess.Process` attributes:

- `stdin`: `Optional[asyncio.streams.StreamWriter]`
- `stdout`: `Optional[asyncio.streams.StreamReader]`
- `stderr`: `Optional[asyncio.streams.StreamReader]`
- `pid`: `int`

Include stdin, stdout, and stderr also in SSP.
2017-04-11 15:14:37 -07:00
Roy Williams
90415f5f9d Add an alias for ensure_future as async (#1120)
`async` is still present in 3.6 and `ensure_future` doesn't exist before 3.4.4
2017-03-30 11:58:13 -07:00
Nathan Henrie
da43a231bb Add missing kwargs for create_server and create_datagram_endpoint (#1084)
* Add missing kwargs for create_server and create_datagram_endpoint

Looks like `create_server` and `create_datagram_endpoint` have supported `reuse_port`, `reuse_address`, and `sock` since 3.4.

https://docs.python.org/3.4/library/asyncio-eventloop.html
ee51327a23/Lib/asyncio/events.py

* Fixes to create_server, create_datagram_endpoing

- Add allow sequence for `hosts` in `create_server`
- Add `allow_broadcast` to `create_datagram_endpoint`
- Reorder `sock` in `create_datagram_endpoint`

* Import Sequence

* Sockets are Optionals
2017-03-29 10:31:44 -07:00
Jan Hermann
420219f057 fix derived queues in asyncio.queues to be generic python/typeshed#1087 (#1088) 2017-03-24 12:01:34 -07:00
Jelle Zijlstra
48b1962951 drop union return type from getaddrinfo (#1002) 2017-03-14 11:45:09 -07:00
Jelle Zijlstra
11350ed8cc Fix missing argument types in py3 stdlib (#995)
Still missing a few in _subprocess (a Windows-only private module) and decimal
(I gave up).
2017-03-14 11:43:42 -07:00
Jelle Zijlstra
eb07fd3c1a make sure typevars defined in stubs are private (#989)
And also a few type aliases I noticed in the process.

Found using 59f9cac095
2017-03-13 07:32:40 -07:00
Jelle Zijlstra
3e94c46e64 Add missing methods and @coroutine decorators to AbstractEventLoop (#958)
Closes #953.

I reviewed the documentation at https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.AbstractEventLoop and added missing methods and missing @coroutine decorators.

I ran mypy on the sample file from the issue report to confirm that mypy handles the combination of @abstractmethod and @coroutine correctly.

Also fixed a number of types in this file that are annotated as Any but could be given more precise types (e.g., sockets and protocol factories).
2017-03-12 20:21:25 -07:00
Jelle Zijlstra
06074e1e02 expose asyncio.open_unix_connection if it exists (#879)
Also fix the one other place where hasattr() is used (which PEP 484 doesn't support).
2017-02-06 11:41:11 -08:00
Tomasz Elendt
f9d6218ab7 Fix definitions of various AbstractEventLoop methods (#902) 2017-02-06 10:25:40 -08:00
Tomasz Elendt
b8df3de81a Coroutine functions should return Generator type (#903) 2017-01-31 14:28:07 -08:00
Guido van Rossum
0e9ad51882 Declare asyncio.wait() as taking an Iterable rather than a List. (#901) 2017-01-30 13:55:39 -08:00
Tomasz Elendt
a5e6ac4339 Fix ClientConnectedCallback in asyncio.stream (#900) 2017-01-30 13:53:33 -08:00
Matt Kimball
fd1201f5d5 Allow asyncio.wait to accept non-Task Futures (#881) 2017-01-29 17:53:38 -08:00
Jelle Zijlstra
66bc746bb3 StreamWriter.drain is a coroutine (#880)
See https://docs.python.org/3/library/asyncio-stream.html#asyncio.StreamWriter.drain
2017-01-29 11:33:35 -08:00
Jelle Zijlstra
9a1e8452a3 input argument to Process.communicate is Optional (#894)
The code for this method starts as follows:
```
    @coroutine
    def communicate(self, input=None):
        if input is not None:
            stdin = self._feed_stdin(input)
```
2017-01-29 10:12:36 -08:00
aostiles
0192f301b4 Reflect Python 3.4.4 asyncio.queues changes in stubs (#847)
Fixes #846
2017-01-19 16:11:09 -08:00
Jelle Zijlstra
511ff30f06 Make functions in asyncio.tasks accept Awaitables (#834) 2017-01-16 16:16:10 -08:00
Jason Fried
61cdd4b7ae AbstractEventLoop missing methods from 3.4.2 and up. (#798)
* Update asyncio/events.pyi for python 3.5.2
create_future, create_task, set_task_factory, get_task_factory
* Gate create_future to >= (3, 5)
2017-01-03 11:05:04 -08:00
Lukasz Langa
68a49c2c2e Fixing flake8 E111, E114, E116, E203, E225, E262 errors 2016-12-20 01:39:18 -08:00
Lukasz Langa
6eb97964fd Fixing flake8 E401, E402 errors 2016-12-20 00:47:51 -08:00