profile
viewpoint

Ask questionsBug: Isort dropping # noqa comment with star import

Version: 5.8.0 Python 3.7.5 (running through pre-commit but not sure) Description Isort drops # noqa comment while sorting, when two imports from the same file/module exists, and one of them is a star import. I think it might be related to https://github.com/PyCQA/isort/issues/1594 but I preferred opening a new bug if that's not the case.

Steps to reproduce Create one file with content as below. Sort test.py with isort

test.py

from typing import *  # noqa
from typing import IO, BinaryIO, Union # noqa

Actual result:

from typing import *  # noqa
from typing import IO, BinaryIO, Union

As you can see, #noqa comment was dropped from the second line, resulting in linter failling.

Expected result: Imports should be kept as is, both # noqa comments should be kept as well.

Thank you for your amazing work!

PyCQA/isort

Answer questions Lothiraldan

Thanks @anirudnits and @timothycrosley for the prompt workaround and prompt fix, you rocks!

useful!

Related questions

skip statements - isort hot 1
source:https://uonfu.com/
Github User Rank List