We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The E402 rule should permit cell magics as well as comments before the import statements. The cell magics must come first.
e.g.
%%time import expensive_module
I suspect that line magics should also be permitted before import statements, like:
%time import expensive_module import cheap_module
Error message is:
E402 Module level import not at top of cell
The text was updated successfully, but these errors were encountered:
Yeah, I agree. Certain cell magics like the one you mentioned should come before the actual code.
I don't think we flag E402 if there's a comment before the first import: https://play.ruff.rs/8d6055cc-be7c-41d9-aac3-ef991213116c
E402
Sorry, something went wrong.
dhruvmanila
Successfully merging a pull request may close this issue.
The E402 rule should permit cell magics as well as comments before the import statements. The cell magics must come first.
e.g.
I suspect that line magics should also be permitted before import statements, like:
Error message is:
The text was updated successfully, but these errors were encountered: