Remove more Python 3.8 cruft (#13787)

This commit is contained in:
Alex Waygood
2025-04-03 11:56:38 +01:00
committed by GitHub
parent 1edf4e819a
commit d92a6449c2
19 changed files with 63 additions and 124 deletions
@@ -10,9 +10,9 @@ email.utils.getaddresses
email.utils.parseaddr
# ======
# <= 3.9
# ======
# ========
# 3.9 only
# ========
# Added in Python 3.9.14
sys.set_int_max_str_digits
@@ -1,6 +1,6 @@
# ======
# <= 3.9
# ======
# ========
# 3.9 only
# ========
# `eventmask` argument exists at runtime, but is not correctly recognized
# while being inspected by stubtest. Fixed in Python 3.10.
+5 -27
View File
@@ -1,8 +1,3 @@
# ========================
# New errors in Python 3.9
# ========================
# ========
# 3.9 only
# ========
@@ -16,24 +11,7 @@ collections.MappingView.__class_getitem__
hmac.HMAC.digest_cons
hmac.HMAC.inner
hmac.HMAC.outer
# ===========
# 3.9 to 3.10
# ===========
builtins.float.__setformat__ # Internal method for CPython test suite
typing._SpecialForm.__mro_entries__ # Exists at runtime, but missing from stubs
# ===================================
# Pre-existing errors from Python 3.8
# ===================================
# ======
# <= 3.9
# ======
xxsubtype # module missing from the stubs
builtins.input # Incorrect default value in text signature, fixed in 3.10
collections.AsyncGenerator.__anext__ # async at runtime, deliberately not in the stub, see #7491
@@ -44,13 +22,13 @@ collections.ByteString # see comments in py3_common.txt
collections.Callable
collections.Mapping.get # Adding None to the Union messed up mypy
collections.Sequence.index # Supporting None in end is not mandatory
xxsubtype # module missing from the stubs
# =======
# ===========
# <= 3.10
# =======
# ===========
builtins.float.__setformat__ # Internal method for CPython test suite
typing._SpecialForm.__mro_entries__ # Exists at runtime, but missing from stubs
email.contentmanager.typ
gettext.install # codeset default value is ['unspecified'] so can't be specified
gettext.translation # codeset default value is ['unspecified'] so can't be specified
@@ -11,9 +11,9 @@ email.utils.getaddresses
email.utils.parseaddr
# ======
# <= 3.9
# ======
# ========
# 3.9 only
# ========
# Added in Python 3.9.14
sys.set_int_max_str_digits
-1
View File
@@ -145,7 +145,6 @@ encodings.cp273: 3.4-
encodings.cp858: 3.2-
encodings.koi8_t: 3.5-
encodings.kz1048: 3.5-
encodings.mac_centeuro: 3.0-3.8
ensurepip: 3.0-
enum: 3.4-
errno: 3.0-
+2 -2
View File
@@ -1,7 +1,7 @@
import sys
from abc import abstractmethod
from types import MappingProxyType
from typing import ( # noqa: Y022,Y038
from typing import ( # noqa: Y022,Y038,UP035
AbstractSet as Set,
AsyncGenerator as AsyncGenerator,
AsyncIterable as AsyncIterable,
@@ -61,7 +61,7 @@ __all__ = [
"MutableSequence",
]
if sys.version_info < (3, 14):
from typing import ByteString as ByteString # noqa: Y057
from typing import ByteString as ByteString # noqa: Y057,UP035
__all__ += ["ByteString"]
+3 -7
View File
@@ -1,14 +1,10 @@
import sys
from _typeshed import ReadableBuffer, SupportsRead, SupportsWrite
from collections.abc import Iterable
# pytype crashes if array inherits from collections.abc.MutableSequence instead of typing.MutableSequence
from typing import Any, ClassVar, Literal, MutableSequence, SupportsIndex, TypeVar, overload # noqa: Y022
from collections.abc import Iterable, MutableSequence
from types import GenericAlias
from typing import Any, ClassVar, Literal, SupportsIndex, TypeVar, overload
from typing_extensions import Self, TypeAlias
if sys.version_info >= (3, 12):
from types import GenericAlias
_IntTypeCode: TypeAlias = Literal["b", "B", "h", "H", "i", "I", "l", "L", "q", "Q"]
_FloatTypeCode: TypeAlias = Literal["f", "d"]
_UnicodeTypeCode: TypeAlias = Literal["u"]
+1 -1
View File
@@ -36,7 +36,7 @@ from types import CellType, CodeType, GenericAlias, TracebackType
# mypy crashes if any of {ByteString, Sequence, MutableSequence, Mapping, MutableMapping}
# are imported from collections.abc in builtins.pyi
from typing import ( # noqa: Y022
from typing import ( # noqa: Y022,UP035
IO,
Any,
BinaryIO,
+1 -3
View File
@@ -26,12 +26,10 @@ else:
from _typeshed import SupportsWrite
from collections.abc import Collection, Iterable, Mapping, Sequence
from types import GenericAlias
from typing import Any, Generic, Literal, TypeVar, overload
from typing_extensions import Self
if sys.version_info >= (3, 12):
from types import GenericAlias
__all__ = [
"QUOTE_MINIMAL",
"QUOTE_ALL",
-21
View File
@@ -1,21 +0,0 @@
import codecs
from _codecs import _EncodingMap
from _typeshed import ReadableBuffer
class Codec(codecs.Codec):
def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ...
def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ...
class IncrementalEncoder(codecs.IncrementalEncoder):
def encode(self, input: str, final: bool = False) -> bytes: ...
class IncrementalDecoder(codecs.IncrementalDecoder):
def decode(self, input: ReadableBuffer, final: bool = False) -> str: ...
class StreamWriter(Codec, codecs.StreamWriter): ...
class StreamReader(Codec, codecs.StreamReader): ...
def getregentry() -> codecs.CodecInfo: ...
decoding_table: str
encoding_table: _EncodingMap
+1 -4
View File
@@ -6,13 +6,10 @@ from io import TextIOWrapper
from re import Pattern
from string import Template
from time import struct_time
from types import FrameType, TracebackType
from types import FrameType, GenericAlias, TracebackType
from typing import Any, ClassVar, Final, Generic, Literal, Protocol, TextIO, TypeVar, overload
from typing_extensions import Self, TypeAlias, deprecated
if sys.version_info >= (3, 11):
from types import GenericAlias
__all__ = [
"BASIC_FORMAT",
"BufferingFormatter",
+2 -1
View File
@@ -11,13 +11,14 @@ from collections.abc import (
Iterable,
Iterator,
KeysView,
Mapping, # noqa: Y022
MutableSequence,
ValuesView,
)
from importlib.machinery import ModuleSpec
# pytype crashes if types.MappingProxyType inherits from collections.abc.Mapping instead of typing.Mapping
from typing import Any, ClassVar, Literal, Mapping, TypeVar, final, overload # noqa: Y022
from typing import Any, ClassVar, Literal, TypeVar, final, overload
from typing_extensions import ParamSpec, Self, TypeAliasType, TypeVarTuple, deprecated
__all__ = [
+26 -25
View File
@@ -4,59 +4,60 @@ import sys
import typing
from _collections_abc import dict_items, dict_keys, dict_values
from _typeshed import IdentityFunction, Incomplete, Unused
from collections.abc import (
AsyncGenerator as AsyncGenerator,
AsyncIterable as AsyncIterable,
AsyncIterator as AsyncIterator,
Awaitable as Awaitable,
Collection as Collection,
Container as Container,
Coroutine as Coroutine,
Generator as Generator,
Hashable as Hashable,
ItemsView as ItemsView,
Iterable as Iterable,
Iterator as Iterator,
KeysView as KeysView,
Mapping as Mapping,
MappingView as MappingView,
MutableMapping as MutableMapping,
MutableSequence as MutableSequence,
MutableSet as MutableSet,
Reversible as Reversible,
Sequence as Sequence,
Sized as Sized,
ValuesView as ValuesView,
)
from contextlib import AbstractAsyncContextManager as AsyncContextManager, AbstractContextManager as ContextManager
from re import Match as Match, Pattern as Pattern
from types import GenericAlias, ModuleType
from typing import ( # noqa: Y022,Y037,Y038,Y039
from typing import ( # noqa: Y022,Y037,Y038,Y039,UP035
IO as IO,
TYPE_CHECKING as TYPE_CHECKING,
AbstractSet as AbstractSet,
Any as Any,
AnyStr as AnyStr,
AsyncGenerator as AsyncGenerator,
AsyncIterable as AsyncIterable,
AsyncIterator as AsyncIterator,
Awaitable as Awaitable,
BinaryIO as BinaryIO,
Callable as Callable,
ChainMap as ChainMap,
ClassVar as ClassVar,
Collection as Collection,
Container as Container,
Coroutine as Coroutine,
Counter as Counter,
DefaultDict as DefaultDict,
Deque as Deque,
Dict as Dict,
ForwardRef as ForwardRef,
FrozenSet as FrozenSet,
Generator as Generator,
Generic as Generic,
Hashable as Hashable,
ItemsView as ItemsView,
Iterable as Iterable,
Iterator as Iterator,
KeysView as KeysView,
List as List,
Mapping as Mapping,
MappingView as MappingView,
Match as Match,
MutableMapping as MutableMapping,
MutableSequence as MutableSequence,
MutableSet as MutableSet,
NoReturn as NoReturn,
Optional as Optional,
Pattern as Pattern,
Reversible as Reversible,
Sequence as Sequence,
Set as Set,
Sized as Sized,
Text as Text,
TextIO as TextIO,
Tuple as Tuple,
Type as Type,
TypedDict as TypedDict,
Union as Union,
ValuesView as ValuesView,
_Alias,
cast as cast,
no_type_check as no_type_check,