-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed as not planned
Closed as not planned
Copy link
Labels
bugmypy got something wrongmypy got something wrong
Description
I've been struggling with this one, and I'm not sure if I'm doing something wrong or mypy is doing something wrong:
from typing import Callable, Generic, ParamSpec, TypeVar
P = ParamSpec("P")
R = TypeVar("R")
class A(Generic[P, R]):
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> R: ...
def decorator(fn: Callable[P, R]) -> A[P, R]: ...
class B:
@decorator
def foo(self) -> None: ...
b = B()
b.foo() # error: Missing positional argument "self" in call to "__call__" of "A" [call-arg]
I need the decorator, which returns the A
wrapper, to work with both functions and methods.
Full project is at: aio-libs/async-lru#508
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong