Copy a better definition of abstractmethod from 3/abc to 2/abc. (#3242)

This commit is contained in:
Rebecca Chen
2019-09-18 02:04:53 -07:00
committed by Sebastian Rittau
parent 8b28753b64
commit 9488b58fb3

View File

@@ -1,9 +1,11 @@
from typing import Any, Dict, Set, Tuple, Type
from typing import Any, Callable, Dict, Set, Tuple, Type, TypeVar
import _weakrefset
_FuncT = TypeVar('_FuncT', bound=Callable[..., Any])
# NOTE: mypy has special processing for ABCMeta and abstractmethod.
def abstractmethod(funcobj: Any) -> Any: ...
def abstractmethod(funcobj: _FuncT) -> _FuncT: ...
class ABCMeta(type):
# TODO: FrozenSet