Handle multiline import-from statements
See original GitHub issueconsider
11:03 AM noon ∈ meh.py>cat meh.py
from math import (
sqrt,
log
)
print(log(2))
11:03 AM noon ∈ meh.py>autoflake --remove-all-unused-imports meh.py
😦
11:03 AM noon ∈ meh.py>autoflake --version
autoflake 0.6.6
Issue Analytics
- State:
- Created 8 years ago
- Reactions:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Handle multiline import-from statements · Issue #8 - GitHub
Reformat every import into one line: isort -rc -sl . Use autoflake to remove unused imports; Reformat the imports the way you want...
Read more >python - Is there a recommended format for multi-line imports?
Te real statement is from data.forms import AddressEmbeddedField, PhoneEmbeddedField, MailEmbeddedField, \ WebEmbeddedField but don't want ...
Read more >Running Multi-Line Shell Code at Once From Single Prompt
This is a useful technique that divides lengthy commands into readable statements contained within the shell session's window. Backslashes also ...
Read more >PEP 328 – Imports: Multi-Line and Absolute/Relative
The import statement has two problems: Long import statements can be difficult to write, requiring various contortions to fit Pythonic style ...
Read more >Importing multiline cells from csv file into excel - Super User
fix the bug in the Text Import Wizard so that it correctly handles multiline values. However there are some workarounds. My favourite: Open...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
There exists a possible workaround in combination with isort:
isort -rc -sl .
autoflake
to remove unused importsisort -rc -m x .
(x
being one of the different multi-line modesisort
offers for imports)Just adding here that
autoflake
is also unable to detect single-line imports with parentheses:First line is detected, second one is not. This will surely be fixed by a fix of this issue, but until then, maybe (just maybe) it makes sense to tackle it independently in the meantime.