mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
Improve abc module and builtin function decorators (#5703)
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
import sys
|
||||
from _typeshed import SupportsWrite
|
||||
from typing import Any, Callable, TypeVar
|
||||
from collections.abc import Callable
|
||||
from typing import Any, Generic, TypeVar
|
||||
from typing_extensions import Literal
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_R_co = TypeVar("_R_co", covariant=True)
|
||||
_FuncT = TypeVar("_FuncT", bound=Callable[..., Any])
|
||||
|
||||
# These definitions have special processing in mypy
|
||||
@@ -16,12 +19,15 @@ class ABCMeta(type):
|
||||
|
||||
def abstractmethod(funcobj: _FuncT) -> _FuncT: ...
|
||||
|
||||
class abstractclassmethod(classmethod[_R_co], Generic[_R_co]):
|
||||
__isabstractmethod__: Literal[True]
|
||||
def __init__(self: abstractclassmethod[_R_co], callable: Callable[..., _R_co]) -> None: ...
|
||||
|
||||
class abstractstaticmethod(staticmethod[_R_co], Generic[_R_co]):
|
||||
__isabstractmethod__: Literal[True]
|
||||
def __init__(self, callable: Callable[..., _R_co]) -> None: ...
|
||||
|
||||
class abstractproperty(property): ...
|
||||
|
||||
# These two are deprecated and not supported by mypy
|
||||
def abstractstaticmethod(callable: _FuncT) -> _FuncT: ...
|
||||
def abstractclassmethod(callable: _FuncT) -> _FuncT: ...
|
||||
|
||||
class ABC(metaclass=ABCMeta): ...
|
||||
|
||||
def get_cache_token() -> object: ...
|
||||
|
||||
Reference in New Issue
Block a user