Drop Python 3.8 branches (#13776)

This commit is contained in:
Sebastian Rittau
2025-04-03 10:35:36 +02:00
committed by GitHub
parent 1e43190554
commit 30b16c168d
117 changed files with 1023 additions and 2639 deletions
+10 -22
View File
@@ -2,12 +2,10 @@ import sys
import types
from _typeshed import SupportsAllComparisons, SupportsItems
from collections.abc import Callable, Hashable, Iterable, Sized
from types import GenericAlias
from typing import Any, Generic, Literal, NamedTuple, TypedDict, TypeVar, final, overload
from typing_extensions import ParamSpec, Self, TypeAlias
if sys.version_info >= (3, 9):
from types import GenericAlias
__all__ = [
"update_wrapper",
"wraps",
@@ -22,11 +20,9 @@ __all__ = [
"singledispatch",
"cached_property",
"singledispatchmethod",
"cache",
]
if sys.version_info >= (3, 9):
__all__ += ["cache"]
_T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)
_S = TypeVar("_S")
@@ -46,10 +42,9 @@ class _CacheInfo(NamedTuple):
maxsize: int | None
currsize: int
if sys.version_info >= (3, 9):
class _CacheParameters(TypedDict):
maxsize: int
typed: bool
class _CacheParameters(TypedDict):
maxsize: int
typed: bool
@final
class _lru_cache_wrapper(Generic[_T]):
@@ -57,9 +52,7 @@ class _lru_cache_wrapper(Generic[_T]):
def __call__(self, *args: Hashable, **kwargs: Hashable) -> _T: ...
def cache_info(self) -> _CacheInfo: ...
def cache_clear(self) -> None: ...
if sys.version_info >= (3, 9):
def cache_parameters(self) -> _CacheParameters: ...
def cache_parameters(self) -> _CacheParameters: ...
def __copy__(self) -> _lru_cache_wrapper[_T]: ...
def __deepcopy__(self, memo: Any, /) -> _lru_cache_wrapper[_T]: ...
@@ -131,8 +124,7 @@ class partial(Generic[_T]):
def keywords(self) -> dict[str, Any]: ...
def __new__(cls, func: Callable[..., _T], /, *args: Any, **kwargs: Any) -> Self: ...
def __call__(self, /, *args: Any, **kwargs: Any) -> _T: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
# With protocols, this could change into a generic protocol that defines __get__ and returns _T
_Descriptor: TypeAlias = Any
@@ -148,8 +140,7 @@ class partialmethod(Generic[_T]):
def __get__(self, obj: Any, cls: type[Any] | None = None) -> Callable[..., _T]: ...
@property
def __isabstractmethod__(self) -> bool: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
if sys.version_info >= (3, 11):
_RegType: TypeAlias = type[Any] | types.UnionType
@@ -200,12 +191,9 @@ class cached_property(Generic[_T_co]):
def __set_name__(self, owner: type[Any], name: str) -> None: ...
# __set__ is not defined at runtime, but @cached_property is designed to be settable
def __set__(self, instance: object, value: _T_co) -> None: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
if sys.version_info >= (3, 9):
def cache(user_function: Callable[..., _T], /) -> _lru_cache_wrapper[_T]: ...
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
def cache(user_function: Callable[..., _T], /) -> _lru_cache_wrapper[_T]: ...
def _make_key(
args: tuple[Hashable, ...],
kwds: SupportsItems[Any, Any],