-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Incorrect ANN201 autofix #9304
Labels
bug
Something isn't working
Comments
Presumably relates to #9206 |
charliermarsh
added a commit
that referenced
this issue
Dec 29, 2023
## Summary Given: ```python from somewhere import get_cfg def lookup_cfg(cfg_description): cfg = get_cfg(cfg_description) if cfg is not None: return cfg raise AttributeError(f"No cfg found matching {cfg_description}") ``` We were analyzing the method from last-to-first statement. So we saw the `raise`, then assumed the method _always_ raised. In reality, though, it _might_ return. This PR improves the branch analysis to respect these mixed cases. Closes #9269. Closes #9304.
Thanks! :-) |
I think the behaviour still isn't quite right:
|
🤦 One more try... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Given:
ANN201 suggests the following incorrect fix:
The text was updated successfully, but these errors were encountered: