functools.singledispatchmethod: add __call__ for better results (#3899)

It doesn't actually have __call__, it does some descriptor stuff, but
this makes things work. _SingleDispatchCallable has a __call__ too,
which is what this mirrors.

Fixes #3898
This commit is contained in:
Shantanu
2020-04-03 17:17:26 -07:00
committed by GitHub
parent 5f4ad2b014
commit 591522fb6a
2 changed files with 2 additions and 0 deletions

View File

@@ -86,6 +86,7 @@ if sys.version_info >= (3, 8):
def register(self, cls: Any, method: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ...
@overload
def register(self, cls: Any, method: Callable[..., _T]) -> Callable[..., _T]: ...
def __call__(self, *args: Any, **kwargs: Any) -> _T: ...
class cached_property(Generic[_T]):
func: Callable[[Any], _T]