You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
T=TypeVar("T", bound="Foo")
P=ParamSpec("P")
# this class serves as a decoratorclassprint_y_first:
def__call__(
self, method: Callable[Concatenate[T, P], str]
) ->Callable[Concatenate[T, P], str]:
defwrapper(_self: T, *args: P.args, **kwargs: P.kwargs) ->str:
print(_self.y)
returnmethod(*args, **kwargs)
returnwrapperclassFoo:
y: int@print_y_first()defstringify(self, x: int) ->str:
returnstr(x)
Mypy reports
error: Incompatible return value type (got "Callable[[Arg(T, '_self'), **P], str]", expected "Callable[[T, **P], str]") [return-value]
note: This may be because "wrapper" has arguments named: "_self"
Heya! This was a bit confusing while I was implementing Concatenate which is why I added that note -- it doesn't seem to be helping so I may have to reconsider wording...
Given the code
Mypy reports
It does not recognize that
Mypy version:
mypy 0.971 (compiled: yes)
Mypy config options:
--strict=True
Python version: 3.10.4
The text was updated successfully, but these errors were encountered: