Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2664 +/- ##
=======================================
Coverage 99.44% 99.44%
=======================================
Files 41 41
Lines 3222 3228 +6
Branches 692 694 +2
=======================================
+ Hits 3204 3210 +6
Misses 11 11
Partials 7 7 🚀 New features to boost your workflow:
|
| The continuation must not be parsed for names; the lines go out unchanged. | ||
| See: https://github.com/PyCQA/isort/issues/1918 | ||
| """ | ||
| source = "from os import \\\n name; print(name)\n" |
There was a problem hiding this comment.
"from os import name\nprint(name)\n"
Wouldn't it make more sense if this was the new output after running isort on this?
There was a problem hiding this comment.
I agree, but skip_line() preserves the single-line equivalent, so normalizing only the multi-line form would make equivalent statements behave differently. I think that needs a broader behavior decision covering both forms.
There was a problem hiding this comment.
What are the options for this decision?
There was a problem hiding this comment.
- Preserve both forms unchanged (what this PR does). This keeps the existing
skip_line()behavior for the single-line form and fixes only the corruption. - Normalize both forms into separate import and non-import statements. Cleaner output, but changes existing single-line behavior and broadens the scope.
- Keep Input with semicolon after multi-line import is corrupted #1918 narrow and track normalization separately. This lets us decide the single-line and multi-line behavior together in a follow-up.
I’d go with 3. What do you think?
There was a problem hiding this comment.
Can we just create a stacked PR on top of this? I like to keep this narrow, but I think it is also good to see final impact.
Closes #1918.
Supersedes #2508.