Use ParamSpec for classmethod and staticmethod (#9771)

This commit is contained in:
Alex Waygood
2023-03-14 09:59:17 +00:00
committed by GitHub
parent 51870544db
commit 28dd6c1a2e
2 changed files with 20 additions and 18 deletions

View File

@@ -54,7 +54,7 @@ from typing import ( # noqa: Y022
overload,
type_check_only,
)
from typing_extensions import Literal, LiteralString, Self, SupportsIndex, TypeAlias, TypeGuard, final
from typing_extensions import Concatenate, Literal, LiteralString, ParamSpec, Self, SupportsIndex, TypeAlias, TypeGuard, final
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -75,6 +75,7 @@ _SupportsNextT = TypeVar("_SupportsNextT", bound=SupportsNext[Any], covariant=Tr
_SupportsAnextT = TypeVar("_SupportsAnextT", bound=SupportsAnext[Any], covariant=True)
_AwaitableT = TypeVar("_AwaitableT", bound=Awaitable[Any])
_AwaitableT_co = TypeVar("_AwaitableT_co", bound=Awaitable[Any], covariant=True)
_P = ParamSpec("_P")
class object:
__doc__: str | None
@@ -113,32 +114,32 @@ class object:
@classmethod
def __subclasshook__(cls, __subclass: type) -> bool: ...
class staticmethod(Generic[_R_co]):
class staticmethod(Generic[_P, _R_co]):
@property
def __func__(self) -> Callable[..., _R_co]: ...
def __func__(self) -> Callable[_P, _R_co]: ...
@property
def __isabstractmethod__(self) -> bool: ...
def __init__(self: staticmethod[_R_co], __f: Callable[..., _R_co]) -> None: ...
def __get__(self, __instance: _T, __owner: type[_T] | None = None) -> Callable[..., _R_co]: ...
def __init__(self, __f: Callable[_P, _R_co]) -> None: ...
def __get__(self, __instance: _T, __owner: type[_T] | None = None) -> Callable[_P, _R_co]: ...
if sys.version_info >= (3, 10):
__name__: str
__qualname__: str
@property
def __wrapped__(self) -> Callable[..., _R_co]: ...
def __call__(self, *args: Any, **kwargs: Any) -> _R_co: ...
def __wrapped__(self) -> Callable[_P, _R_co]: ...
def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R_co: ...
class classmethod(Generic[_R_co]):
class classmethod(Generic[_T, _P, _R_co]):
@property
def __func__(self) -> Callable[..., _R_co]: ...
def __func__(self) -> Callable[Concatenate[_T, _P], _R_co]: ...
@property
def __isabstractmethod__(self) -> bool: ...
def __init__(self: classmethod[_R_co], __f: Callable[..., _R_co]) -> None: ...
def __get__(self, __instance: _T, __owner: type[_T] | None = None) -> Callable[..., _R_co]: ...
def __init__(self, __f: Callable[Concatenate[_T, _P], _R_co]) -> None: ...
def __get__(self, __instance: _T, __owner: type[_T] | None = None) -> Callable[_P, _R_co]: ...
if sys.version_info >= (3, 10):
__name__: str
__qualname__: str
@property
def __wrapped__(self) -> Callable[..., _R_co]: ...
def __wrapped__(self) -> Callable[Concatenate[_T, _P], _R_co]: ...
class type:
@property