Commit Graph

88 Commits

Author SHA1 Message Date
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
Jelle Zijlstra
f7e4cb8c79 make enums support len() (#1139) 2017-04-05 08:22:28 -07:00
Guido van Rossum
f44e461d19 Use a separate type variable for unique() (#1138)
* Use a separate type variable for unique()

See https://github.com/python/typeshed/pull/1136#discussion_r109727053

* actually use the new typevar
2017-04-04 23:48:19 -07:00
Guido van Rossum
7027c3e4e8 Support enum iteration (#1136)
* Support enum iteration.

Fixes python/mypy#2305.

* Make EnumMeta inherit from type, not ABCMeta.
2017-04-04 10:17:52 -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
Guido van Rossum
af2fadc180 More fixes related to PathLike (#1061)
* Make DirEntry generic over AnyStr, and inherit from PathLike if it exists

* Make pathlib require PathLike[str] (when it exists)
2017-03-21 22:26:21 -07:00
Jelle Zijlstra
25464cf0a7 Merge pull request #991 from JetBrains/sproshev/pep-519
Update `open`, `os.fspath`, `os.fsencode`, `os.fsdecode`, `pathlib.PurePath` and `pathlib.Path` stubs due to PEP-519
2017-03-21 07:38:50 -07:00
Jelle Zijlstra
53a42046cb Add tracemalloc (#1053)
* add stubs for tracemalloc

This one has especially nice documentation, even including type annotations.

* no PEP 526 so I can run tests locally

* fixes

* another one
2017-03-21 05:58:22 -07:00
Jelle Zijlstra
5898d75913 stub for statistics (#1021)
* stub for statistics

* fix missing imports

* drop int from the typevar
2017-03-18 14:41:42 -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
Semyon Proshev
e4fdd0eb62 Update stubs for pathlib.PurePath and pathlib.Path classes due to PEP-519. 2017-03-13 18:35:50 +03: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
984307bf45 fix odd version comparisons (#988)
"> (3,)" works but looks like the code is checking for Python 4.

"<= (3, 5)" was intended to check for versions up to and including 3.5, and probably works that
way in current type checkers. However, sys.version_info is actually a 5-tuple that is greater
than (3, 5), so a hypothetical type checker that uses the full version info would interpret
this check incorrectly.

This ensures that all version_info comparisons use <, >=, ==, or !=.
2017-03-12 20:48:48 -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
Ivan Levkivskyi
22c0353498 Add missing imports from typing (#933) 2017-02-14 10:59:00 -08: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
Valérian Rousset
fe15d91041 merge */xml/etree into 2and3/xml/etree (#899)
Fixes #287.
2017-01-30 13:19:28 -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
bbc7594ec7 Add Flag, IntFlag and auto to enum stubs
Fixes python/mypy#2609
2016-12-28 11:34:56 -08:00
Lukasz Langa
82b2d8e3bc Fixing flake8 F403, F405 errors 2016-12-20 02:28:12 -08:00
Lukasz Langa
68a49c2c2e Fixing flake8 E111, E114, E116, E203, E225, E262 errors 2016-12-20 01:39:18 -08:00
Lukasz Langa
d70bb0c00f Fixing flake8 E202, E203, E225 errors 2016-12-20 01:02:59 -08:00
Lukasz Langa
6eb97964fd Fixing flake8 E401, E402 errors 2016-12-20 00:47:51 -08:00
Lukasz Langa
147772950f Fixing flake8 E265 errors 2016-12-20 00:16:44 -08:00
Lukasz Langa
6b5c6626d6 Fixing flake8 E121, E122, E123, E124, E125, E126 errors 2016-12-19 23:53:19 -08:00
Lukasz Langa
67e38b6806 Fixing flake8 E231 errors 2016-12-19 23:53:19 -08:00
Lukasz Langa
fe0e3744cc Fixing flake8 E261 errors 2016-12-19 22:09:35 -08:00
Lukasz Langa
b84f20a011 Fixing flake8 W errors 2016-12-19 21:52:56 -08:00
TrueBrain
7e89fc0d49 Define __slots__ for object as Iterable[str] / Iterable[Union[str, unicode]] (#780)
* Define __slots__ for object as Iterable[str] / Iterable[Union[str, unicode]]
* A string as __slots__ value is also valid and represents a single item
2016-12-19 13:09:04 -08:00
Simon Ekstrand
aa6f4a07c1 Fix AbstractEventLoop.call* callable definitions. (#753)
Several asyncio AbstractEventLoop methods take a callback as
an argument that is passed *args. The Callable definition was
incorrect for those callbacks.
2016-12-16 15:15:20 -08:00
Philip House
04f5c5699e Merge 3.4 and 3.5 pathlib stubs (#764)
Fixes #659
2016-12-13 12:03:03 -08:00
nobuggy
3f03849b70 Fix asyncio.wait for() and add exceptions (#676)
* asyncio.wait_for() should accept Awaitable[_T] same as asyncio.gather()

* {Cancelled,Timeout,InvalidState}Error types missing
2016-11-10 11:00:43 -08:00
Guido van Rossum
bf8b5ac5fd Relax signature of gather() (#677)
Fixes #675
2016-11-10 10:55:29 -08:00
Guido van Rossum
b476028df7 Fix signature of run_coroutine_threadsafe() (#657) 2016-11-04 14:49:49 -07:00
Guido van Rossum
7f7e2d4e75 Fixes for asyncio (#654)
* Fix signature of gather().  Also fold long lines and kill _GatheringFuture.

* Add several missing exports from tasks.
2016-11-04 11:19:22 -07:00
nobuggy
fa1eeb024e Two minor glitches in stdlib asyncio.Event.wait() / asyncio.wait_for() (#636)
* Event.wait() is a coroutine (https://docs.python.org/3/library/asyncio-sync.html#asyncio.Event)

* asyncio.wait_for accepts None as timeout (https://docs.python.org/3/library/asyncio-task.html)
2016-10-29 07:58:09 -07:00
Guido van Rossum
896110fd54 The value member of an IntEnum object is an int. 2016-09-29 09:48:43 -07:00