Commit Graph

79 Commits

Author SHA1 Message Date
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
claws
35cdafa10e add some missing asyncio items such as gather (#511)
* add some missing asyncio items

* sort items
2016-08-31 07:28:22 -07:00
Michael Lee
c10198db11 Add the selectors module (#484)
* Correct some type errors

* Use Any instead of Optional[Any]
2016-08-23 18:57:46 -07:00
Guido van Rossum
de4e87f574 Changes required by mypy async-await support (#435) 2016-08-03 17:01:35 -07:00
Guido van Rossum
39325bf159 Mypy now supports sys.platform and sys.version_info checks (#410) 2016-07-27 13:25:29 -07:00
Valérian Rousset
cd413c502c Add hmac (#402) 2016-07-26 08:40:04 -07:00
Valérian Rousset
9b3fe3d0e0 add types to pathlib (#338) 2016-07-17 21:16:25 -07:00
Guido van Rossum
6d8628c247 Misc asyncio changes (#373)
* Add stub for cgi.parse_header().

* Improve asyncio stubs (far from complete)

* More asyncio changes.

* Use @overload to solve strange test failures.

* Add some TODOs. Make ProactorEventLoop conditional.

* Future should not inherit from Awaitable or implement __await__.

At least not yet.

* Fix AbstractServer.wait_closed() return type.

It's a generator, not a future.
2016-07-15 15:44:29 -07:00
tewe
c84c138194 Annotate **kwargs with dictionary value type only (#320) 2016-06-29 08:43:13 -07:00
Alvaro Caceres
d0ac66f5f8 Use "..." for attribute values, instead of None, [], {} 2016-06-15 14:10:04 -05:00