Skip to content

Improve stubs for classmethod and staticmethod #10421

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdlib/abc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def abstractmethod(funcobj: _FuncT) -> _FuncT: ...

class abstractclassmethod(classmethod[_T, _P, _R_co]):
__isabstractmethod__: Literal[True]
def __init__(self, callable: Callable[Concatenate[_T, _P], _R_co]) -> None: ...
def __init__(self, callable: Callable[Concatenate[type[_T], _P], _R_co]) -> None: ...

class abstractstaticmethod(staticmethod[_P, _R_co]):
__isabstractmethod__: Literal[True]
Expand Down
12 changes: 9 additions & 3 deletions stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ class staticmethod(Generic[_P, _R_co]):
@property
def __isabstractmethod__(self) -> bool: ...
def __init__(self, __f: Callable[_P, _R_co]) -> None: ...
@overload
def __get__(self, __instance: None, __owner: type) -> Callable[_P, _R_co]: ...
@overload
def __get__(self, __instance: _T, __owner: type[_T] | None = None) -> Callable[_P, _R_co]: ...
if sys.version_info >= (3, 10):
__name__: str
Expand All @@ -142,16 +145,19 @@ class staticmethod(Generic[_P, _R_co]):

class classmethod(Generic[_T, _P, _R_co]):
@property
def __func__(self) -> Callable[Concatenate[_T, _P], _R_co]: ...
def __func__(self) -> Callable[Concatenate[type[_T], _P], _R_co]: ...
@property
def __isabstractmethod__(self) -> bool: ...
def __init__(self, __f: Callable[Concatenate[_T, _P], _R_co]) -> None: ...
def __init__(self, __f: Callable[Concatenate[type[_T], _P], _R_co]) -> None: ...
@overload
def __get__(self, __instance: _T, __owner: type[_T] | None = None) -> Callable[_P, _R_co]: ...
@overload
def __get__(self, __instance: None, __owner: type[_T]) -> Callable[_P, _R_co]: ...
if sys.version_info >= (3, 10):
__name__: str
__qualname__: str
@property
def __wrapped__(self) -> Callable[Concatenate[_T, _P], _R_co]: ...
def __wrapped__(self) -> Callable[Concatenate[type[_T], _P], _R_co]: ...

class type:
@property
Expand Down