See #7258 for an extended discussion. In summary, for mypy these
would be better written as follows, but this would not work with
other type checkers:
```
CRITICAL: Final = 50
```
I did a a cursory investigation using GitHub search and also looked at
a big internal codebase, and a significant fraction of callsites used
a dict type instead of a TypedDict or a dict literal.
It seems that it's a common use case to store the config within an
attribute. For example, something like this:
```
CONFIG = {
...
}
...
logging.config.dictConfig(CONFIG)
```
Another use case that was not properly supported is reading the
config from a file, and the config is given `dict[str, Any]` as
the type.
Mypy can still do some type checking of the argument if called
with a dict literal, so I feel this is a reasonable compromise
between type checking strictness and usability.
* Use PEP 604, instead of Optional.
* Override FileHandler.stream and setStream to require a TextIOWrapper
instead of a SupportsWrite object.
* FileHandler._open() now returns a TextIOWrapper instead of IO. Using
anything but a file opened in text mode would not work.
* Extract _socket.pyi from socket.pyi.
* Extract _socket.socket from socket.socket.
* Fix socket.family annotation.
* Annotate SocketIO properly.
* SocketType is an alias of _socket.socket.
* Sort items in socket.pyi in the same order as in socket.py.
* Remove socket.EINTR.
* Use _typeshed.WriteableBuffer instead of custom alias.
* Add errorTab (Windows only).
* Add _socket.dup().
* Mark positional-only argments.
* Remove constructors from socket exceptions.
* socket.timeout is an alias for TimeoutError, starting with Python 3.10.
* Use PEP 604 in changed lines.
* Add alias for fileno arguments.
* getaddrinfo() port can be bytes.
* Explicitly override some SSLSocket methods.
* Allow ReadableBuffer in _CMSG arguments.
* Replace all uses of StrPath, BytesPath, and AnyPath in Python 2 stubs.
* Add StrOrBytesPath as preferred alias for AnyPath.
* Replace all remaining AnyPath instances with StrOrBytesPath.
* Mark AnyPath as obsolete.
Part of #5470