Continuing work towards #8988.
The first five commits were created using stubdefaulter on various Python versions; the following commits were all created manually by me to fix various problems. The main things this adds that weren't present in #9501 are:
- Defaults in Windows-only modules and Windows-only branches (because I'm running a Windows machine)
- Defaults in non-py311 branches
- Defaults for float parameters
- Defaults for overloads
Since python 3.7, asyncio.loop.create_datagram_endpoint expects the
arguments `local_addr` and `remote_addr` to be `str` or `None` when the
argument family=`socket.AF_UNIX` and the argument `sock` is `None` or
also a unix socket.
- Change the return type of create_connection, start_tls,
connect_accepted_socket, create_unix_connection to Transport
rather than BaseTransport (closes#9199).
- Change the return type of create_datagram_endpoint to
DatagramTransport rather than BaseTransport.
- Change the argument of sendfile to WriteTransport rather than
BaseTransport.
I considered also changing the argument of start_tls to Transport, but
I think that will give false positives for code that implements a custom
transport class that inherits from both ReadTransport and WriteTransport
but not from Transport, and I'm not sure if typing has a way to express
an intersection of types. Since users are not normally expected to
implement transports that may be overthinking things.
`WriteTransport.write`, `WriteTransport.writelines` and `DatagramTransport.sendto` methods only accept `bytes` trying an other type raises an exception
`BaseTransport._extra` is a dictionary with string as key
Adding the empty-tuple overload caused major problems for pyright, and that overload only deals with an unlikely edge case anyway. Get rid of it, and replace the fallback overload with a more general overload.
Fixes#8270.
Closes#7866. This adds an overload to `asyncio.sleep()`, so that when it is called _without_ `return=None`, the type checker knows that the return type is `None` instead of `unknown`.
Also related to https://github.com/microsoft/pyright/issues/3475.