-
-
Notifications
You must be signed in to change notification settings - Fork 582
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
isort 5.0+ wants two blank lines between a from ... import within a def and a following comment line - flake8 conflict. #1293
Comments
@msapiro I'm sorry you're encountering this issue! I would like to help resolve it as quickly as possible. Could you
Thanks! ~Timothy |
It's still an issue with isort 5.0.5. Here's isort --version
and isort --show-config
Here's the issue
And here, without a comment line following the import, there is no issue.
|
Good afternoon. I'm also having the same issue in isort v5.0.5. In my setup.cfg, I have
In the 4.X series, this code used to pass both flake8/isort checks. I explicitly wanted 2 lines after imports for global imports and only 1 line for imports within functions. Now, it fails isort as it wants to put two lines inside the function as well. I did that. So then, isort passes, but flake8 is complaining that there are too many blank lines. isort msg:
My OS:
isort settings:
|
Thanks for reporting and sharing your settings. They were super hepful to diagnose the issue (was able to reproduce it immediately!) This is fixed with an additional regression test added in 5.0.6. Thanks! ~Timothy |
isort 5.0+ wants 2 blank lines between a from import within a def and a following comment. E.g.
is acceptable, but 0 or 1 blank lines between the
from ... import
and the following comment is not acceptable to isort, and more than 1 blank line is not acceptable to flake8. Thus the# noqa:
to pass both.This is not an issue if the first non-blank line following the import is not a comment. In that case, isort is happy with 0 or 1 blank lines.
The text was updated successfully, but these errors were encountered: