-
Notifications
You must be signed in to change notification settings - Fork 157
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
Honour "# noqa: F401" comments #160
Comments
Looking through existing issues, I've seen that "# noqa" support has generally been rejected. Hopefully this request for just one specific form of noqa comment will be considered, as in my opinion, it would reduce the barrier to adoption substantially. |
Since Python 3.4 has reached EOL and Vulture stopped testing for this version recently, I don't think Vulture should add workarounds that are only needed for this version. Your problem seems to be more general though. However, I don't understand why you need imports if all your type annotations are in strings. Could you please provide some example code? |
Even if type hints are specified as strings, you still have to import the things used in type hints to tell the type checker what they are – it doesn't matter if you say |
Thanks for the clarification! I agree that honoring F401 noqa comments makes sense. I'd be happy to review a pull request that makes this change. |
Regarding honoring |
@RJ722 I think you're right! |
That's true. The question is whether we want to offer this functionality
to users of standalone Vulture as well. I have no strong opinion on
this, but I think the decision should depend on the complexity of the
patch for this functionality and how many users would like to have it.
|
@OddBloke are you okay with changing all of |
I guess it makes sense to let Vulture honour the F401 code as well. |
This has been implemented in 5e7fd66. |
Thanks very much!
…On Mon., Apr. 13, 2020, 05:06 Jendrik Seipp, ***@***.***> wrote:
Closed #160 <#160>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#160 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAPKEGCYFJSZD3MWYGOPW3RMLIY5ANCNFSM4HP6ARZA>
.
|
Our codebase has to work as far back as Python 3.4, which doesn't have the typing module available. As such, all of our type annotations are in strings (so they are lazily evaluated during type checking and ignored when running normally) and our typing imports are conditional, with "# noqa: F401" appended to silence the flake8 warnings.
vulture doesn't honour these comments, and it seems like an obvious win for it to do so.
(Per http://flake8.pycqa.org/en/2.5.5/warnings.html, F401 is specifically the warning for "
module
imported but unused"; this matches very closely with Vulture's unused import warnings.)The text was updated successfully, but these errors were encountered: