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
The type has a custom __eq__:
https://github.com/python/cpython/blob/v3.11.1/Objects/descrobject.c#L1906
This helps fix this mypy false positive when using `--strict-equality`:
```
from types import MappingProxyType
p = MappingProxyType({'x': 1})
d = {'x': 1}
print(p == d) # error: Non-overlapping equality check
```
The fragment prints `True` so the comparison is valid.
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.
This reverts commit 034cfab4d6.
The commit exposed the value of the compression constants, which seem
to be implementation details, in the public API. I don't see anything
in the documentation about the values of the constants such as
`ZIP_STORED`:
https://docs.python.org/3/library/zipfile.html?highlight=zipfile#zipfile.ZipFile
Example where this makes a difference:
```
from typing import Literal
import zipfile
def f1(p: str, compression: int) -> None:
"""Error: compression should have the type Literal[0, 8, 12, 14]"""
zipfile.ZipFile(p, compression=compression)
def f2(p: str, compression: Literal[0, 8, 12, 14]) -> None:
"""Works, but cryptic and exposes internal implementation details"""
zipfile.ZipFile(p, compression=compression)
```
The values are of constants need to be explicitly specified if somebody
wants to wrap `zipfipe.ZipFile`, which arguably exposes implementation
details in a problematic fashion.
Here is a real-world example where this caused a regression:
https://github.com/pytorch/vision/blob/main/torchvision/datasets/utils.py#L301
Annotate unittest.TestCase.skipTest() as no-return
This method unconditionally raises unittest.SkipTest, which ends a test
method early. unittest.TestCase.fail() works similarly, and is already
annotated with NoReturn to indicate this behaviour.