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

Tuple sorting doesn't consider profile #1815

Open
kasium opened this issue Sep 24, 2021 · 4 comments
Open

Tuple sorting doesn't consider profile #1815

kasium opened this issue Sep 24, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@kasium
Copy link

kasium commented Sep 24, 2021

The tuple, list, etc sorting options don't consider the profile option.

Code:

# isort: tuple
data = ("therearesuperlong", "therearesuperlong", "therearesuperlong", "therearesuperlong", "therearesuperlong")

isort dummy.py --profile black

# isort: tuple
data = ('therearesuperlong', 'therearesuperlong', 'therearesuperlong', 'therearesuperlong',
 'therearesuperlong')

black dummy.py

# isort: tuple
data = (
    "therearesuperlong",
    "therearesuperlong",
    "therearesuperlong",
    "therearesuperlong",
    "therearesuperlong",
)

I would expect that these sorting options consider the profile as normal. Also, the sorting options are not documented but noted here #1358

@jherman3
Copy link

I'm also experiencing this with # isort: list. It'd be great to have this so we can sort __all__.

@tueda
Copy link

tueda commented Oct 20, 2021

The same for # isort: unique-tuple, # isort: unique-list, #isort: set and # isort: dict. I would like to use # isort: unique-tuple for __all__ that contains many members.

@tueda
Copy link

tueda commented Nov 22, 2021

Actually, the tuple sorting should follow the multi_line_output option (or possibly a similar new option for the tuple sorting) rather than the profile.

As a first step, it would be OK if the output is compatible with black (as described in #1358), but in general literal.assignment needs to implement calling a variant of wrap.import_statement. (Maybe the author is aware of it, but he is too busy to implement it...)

@timothycrosley
Copy link
Member

timothycrosley commented Nov 23, 2021

This is true for all literal / type sorts, and is why they aren't documented / advertised features, even though If they were in a good spot I would do so because I think they are useful!

As a first step, it would be OK if the output is compatible with black (as described in #1358), but in general literal.assignment needs to implement calling a variant of wrap.import_statement. (Maybe the author is aware of it, but he is too busy to implement it...)

That's exactly right, I've just been busy, will accept PRs for this or will get to it at some point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants