Skip to content
New issue

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

Isort is disregarding the multiply line import #2128

Open
Cheukting opened this issue Apr 30, 2023 · 3 comments
Open

Isort is disregarding the multiply line import #2128

Cheukting opened this issue Apr 30, 2023 · 3 comments

Comments

@Cheukting
Copy link

Found in version 5.12.0 of isort from solving Zac-HD/shed#94

Multiline import will automatically be put in one line.

Here is an example:

from os import (
    waitpid,
    waitstatus_to_exitcode,
    walk,
    write,
    writev,
)

print(
    waitpid,
    waitstatus_to_exitcode,
    walk,
    write,
    write,
)

Becomes

from os import waitpid, waitstatus_to_exitcode, walk, write, writev

print(
    waitpid,
    waitstatus_to_exitcode,
    walk,
    write,
    write,
)

CC @Zac-HD

@Cheukting
Copy link
Author

This is starting to give me some pain. I am happy to look into a possible solution and attempt a PR.

@Zac-HD
Copy link
Member

Zac-HD commented Aug 17, 2023

More specifically, the problem is that isort doesn't respect the "magic trailing comma" which Black uses, even when using profile=black.

@MrMino
Copy link

MrMino commented Feb 16, 2024

It doesn't do that even when given --split-on-trailing-comma option. Looks like a regression of the feature introduced in #1876?

Edit: the --split-on-trailing-comma option works fine, my bad. Looks like this option is not enabled by default with --profile=black. IMO it should, since this is black's current behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants