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
ANN201 false positive when functions are defined within functions #69
Comments
This isn’t a false positive, |
Sorry, meant to mention that this happens even when |
Well I know why this is happening but it's looking like the fix is going to be challenging. While the return node visitor approach is an elegant one for most cases, it breaks for nested functions because it is visiting the return nodes without any knowledge of their containing function. In the code snippet above, for example, the return node ends up being visited twice, once for Conceptually, this is simply fixed by skipping nested function nodes, but the actual implementation of the fix doesn't seem to be a simple one. |
Hi @sumnerevans, these issues should be fixed now by |
Thanks for getting to this so quickly! Just upgraded, and this issue appears to be fixed. |
Describe the bug
When an outer function returns
None
, but a function which is defined within it returns something that isn'tNone
, the outer function is falsly marked with anANN2**
error.Edit: Note this happens even when
suppress-none-returning = True
.To Reproduce
Minimal code example to reproduce the behavior:
When running with
--supress-none-returning
:Version Information
As well as your Python version:
The text was updated successfully, but these errors were encountered: