-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
F811 (redefinition of unused variable) incorrectly triggered with @overload decorator #320
Comments
facing the same issue. do you have a workaround? |
|
How does pydocstyle config fix a pyflakes bug? |
I took a stab at this: #371 |
Hi, it's good to see #371 solved this partially, but import typing
from typing import overload
class Foo:
@overload
def f(self, s): # type: (None) -> None
pass
@overload
def f(self, s): # type: (int) -> int
pass
def f(self, s):
return s
@typing.overload
def g(self, s): # type: (None) -> None
pass
@typing.overload
def g(self, s): # type: (int) -> int
pass
def g(self, s):
return s
I'm now working around this by using full |
I still have this issue when the overload decorator is wrapped by another decorator.
|
that's not possible to detect statically -- I'd suggest not doing that (I don't think mypy can detect that either) I'd suggest explicitly using the overload decorator |
Gotcha. I don't think this works either.
|
Have you tried on master? it works for me |
actually, it even works with the released version of pyflakes so you're probably on an old one |
This is my version info that doesn't work:
What do you think about counting a decorator as a use of a function? Edit: the redefinition error would still exist even if the unused wouldn't |
actually, I'm wrong about it being already released -- it is fixed on master though, please try that and confirm |
see #435 |
yea works on master, thanks! |
PEP 484 introduced the
@overload
decorator for type annotations.The following should pass PyFlakes without errors, but currently triggers F811 errors:
The text was updated successfully, but these errors were encountered: