PyCQA / isort

A Python utility / library to sort imports.
https://pycqa.github.io/isort/
MIT License
6.49k stars 580 forks source link

isort does not correctly handle concating imports from same source if lines end with \ in a comment #1891

Open PetrasPurlys opened 2 years ago

PetrasPurlys commented 2 years ago

isort version 5.10.1

Code in file:

from foo.bar import a # \ from foo.bar import b # \ from foo.bar import c, d, e # \

After running isort: from foo.bar import a # \ from foo.bar import foo.bar, b, c, d, e, from, import # \

anirudnits commented 2 years ago

Hello @PetrasPurlys thanks for reaching out. I can't seem to recreate the error, I tried with

from math import floor # /
from math import ceil # /
from math import sqrt, log2 # /

which was sorted into

from math import ceil  # /
from math import floor  # /
from math import log2, sqrt  # /

I am also using isort 5.10.1, is there any other config setting you've set?