Commit Graph

114 Commits

Author SHA1 Message Date
Eric Traut
c4d8507ff7 Removed unused import symbols from stdlib stubs and fixed a few other errors detected by pyright. I did a similar pass several months ago; these were introduced since then. (#4803)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-12-06 18:44:18 +01:00
Raphael Geronimi
b3abdc3cd7 Fix return type of asyncio.Queue.join (#4751)
Fixes #4750
2020-11-09 14:27:44 +01:00
Sebastian Rittau
d2a7889fe0 Drop support for Python 3.5 (#4675)
Python 3.5 EOL was on 2020-09-30.
2020-11-02 16:18:20 +01:00
Shantanu
620989bac5 typeshed: update stubtest version (#4739)
* typeshed: update stubtest version

Includes changes from https://github.com/python/mypy/pull/9680
I've already fixed all the true positives on typeshed.

* attempt to fix windows' _WarnFunction

Co-authored-by: hauntsaninja <>
2020-11-01 12:35:21 +01:00
Utsav
6f943d43ea Added __class_getitem__ (#4695)
Resolves #4682

Co-authored-by: hauntsaninja <>
2020-10-22 14:05:04 -07:00
Shantanu
52974e0a2b asyncio.Semaphore: type some internals (#4605)
Co-authored-by: hauntsaninja <>
2020-10-04 12:53:02 +02:00
Shantanu
b33896bcbc asyncio.run: fix type of debug (#4567) 2020-09-22 10:43:35 +02:00
Sergei Lebedev
6bf894bb82 Made contextvars import in asyncio.base_futures conditional (#4524)
contextvars are only available in 3.7+.
2020-09-10 13:44:21 -07:00
Shantanu
193c7cb932 asyncio.tasks: update for py39 removals (#4493)
Co-authored-by: hauntsaninja <>
2020-08-29 22:07:20 -07:00
Eric Traut
bbd8c96e34 Added some missing types from various stdlib stubs (#4466) 2020-08-29 16:45:36 -07:00
Jelle Zijlstra
5f9fd3d127 upgrade black version (#4486)
Manually removed a number of trailing commas to prevent black from unnecessarily
exploding some collections.
2020-08-26 18:36:01 +02:00
James Weaver
512c154638 Make AbstractEventLoop.run_in_executor return an Awaitable, instead of being a coroutine (#4457)
Closes: #3999
2020-08-18 12:17:31 +02:00
Eric Traut
f46fb7ff59 Added some missing type annotations in stdlib stubs. (#4418)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-08 20:49:37 +02:00
Eric Traut
04c74640f0 Removed imported symbols that are not accessed or re-exported (#4387)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-05 22:49:17 -07:00
Shantanu
bc6da51495 asyncio: export submodules (#4346)
Resolves #4345

Co-authored-by: hauntsaninja <>
2020-07-21 09:34:00 +02:00
Sebastian Rittau
5e76f51930 Upgrade to isort 5 (#4323)
This now also reformats imports not at the top of files.
2020-07-16 07:01:57 -07:00
Alex Grönholm
ad89dee03b Fixed return type of getaddrinfo() everywhere (#4304) 2020-07-10 10:46:28 +02:00
Alex Grönholm
f9d469ac2b Fixed parameter and return types of getnameinfo() everywhere (#4305) 2020-07-03 15:46:02 +02:00
Jelle Zijlstra
0142a87da8 adjust isort config (#4290)
Fixes #4288.

- Default imports to THIRD_PARTY, so in effect we merge the FIRST_PARTY and THIRD_PARTY stubs. This means import order is no longer affected by whether typing_extensions is installed locally.
- Treat typing_extensions, _typeshed and some others as standard library modules.

Note that isort master is very different from the latest release; we'll have to do something
different if and when the next isort release comes out.
2020-06-29 00:00:21 -07:00
Sebastian Rittau
4586ed9adc Require black and isort for contributions (#3329)
* Add explanation to CONTRIBUTNG.md
* Add sample pre-commit script
* Check for correctly formatted files in CI

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2020-06-28 15:28:28 -07:00
Jelle Zijlstra
5d553c9584 apply black and isort (#4287)
* apply black and isort

* move some type ignores
2020-06-28 13:31:00 -07:00
Denis Laxalde
0dd3258ed2 Add __aiter__ and __anext__ methods for asyncio.StreamReader (#4286)
The following code produces an error in mypy:

    import asyncio
    from asyncio.subprocess import PIPE

    async def main() -> None:
        proc = await asyncio.create_subprocess_shell("ls -l", stdout=PIPE)
        assert proc.stdout is not None
        async for line in proc.stdout:
            print(line.decode())
        await proc.wait()

    asyncio.run(main())

$ mypy --strict file.py
file.py:8: error: "StreamReader" has no attribute "__aiter__" (not async iterable)

This commits fixes this by adding __aiter__/__anext__ methods that are
needed for async iterator protocol.
2020-06-28 11:57:49 -07:00
Jelle Zijlstra
e1d89e5742 remove references to "Text" in Python 3-only stubs (#4251) 2020-06-22 12:39:01 +02:00
Sebastian Rittau
89d3a55f1a Preparations for the Big Reformat (#4228)
A few comments between imports were removed or moved to the top of the
import block, due to behavioral differences between black and isort. See
psf/black#251 for details.

In two instances @overloads at the top of the file needed to be moved
due to psf/black#1490.
2020-06-14 07:58:26 -07:00
Jelle Zijlstra
d0b85d7efe remove _types (#4220) 2020-06-11 09:10:52 +02:00
Jelle Zijlstra
44a852dff5 Literal: always import from typing_extensions for simplicity (#4219) 2020-06-10 21:23:58 -07:00
Jelle Zijlstra
43e93f803f use _typeshed's Path aliases (#4214) 2020-06-10 20:57:09 -07:00
Jaromir Latal
c36e4517f7 [stdlib][asyncio] Accept optional context in (Timer)Handle (#4190) 2020-06-07 06:33:46 -07:00
Christopher Head
948c1a63e6 Relax asyncio.TimerHandle.__init__ args parameter (#4193)
Just like the Handle class, the TimerHandle class can take any sequence
here, not just a list.
2020-06-06 18:33:23 -07:00
Jaromir Latal
9ab4ec568d [stdlib][asyncio] Widen asyncio.events.handle arguments type (#4188)
Co-authored-by: Jaromir Latal <jaro@fb.com>
2020-06-06 16:48:02 +02:00
Jaromir Latal
52bf411f2b [stdlib][asyncio] Allow optional policy in (#4189)
Co-authored-by: Jaromir Latal <jaro@fb.com>
2020-06-06 16:47:04 +02:00
Sam Bull
5b66868156 Allow Path in create_subprocess_* (#4159) 2020-06-04 17:11:53 +02:00
Rune Tynan
342ce69f88 Add missing asyncio modules (#4149) 2020-06-01 02:05:16 +02:00
Shantanu
62304eb02f asyncio: update cancels for py39 (#4135)
Co-authored-by: hauntsaninja <>
2020-05-28 13:42:31 -07:00
Shantanu
feb43f7237 asyncio: add asyncio.threads for py39 (#4136) 2020-05-28 13:37:46 -07:00
Rune Tynan
7ba59719b6 Fix asyncio IocpProactor version availability (#4121) 2020-05-27 20:14:00 -07:00
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