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-compatible style #177

Closed
Dreamsorcerer opened this issue Feb 12, 2021 · 1 comment · Fixed by #178
Closed

isort-compatible style #177

Dreamsorcerer opened this issue Feb 12, 2021 · 1 comment · Fixed by #178

Comments

@Dreamsorcerer
Copy link
Contributor

Dreamsorcerer commented Feb 12, 2021

Would be nice to have an isort-compatible style built-in.

This would appear to be the same as the pycharm style, but with ordering done as:
from foo import GLOBAL_VAR, ClassName, func
rather than
from foo import ClassName, GLOBAL_VAR, func

i.e. it needs to group the ordering into 3 parts, ALLCAPS, CapWords and lowercase.

Sorting code for this could be as simple as:

group = lambda k: 0 if k.isupper() else 2 if k.islower() else 1
key = lambda k: (group(k), k)

>>> a = ("GLOBAL_VAR", "ClassName", "func")
>>> sorted(a, key=key)
['GLOBAL_VAR', 'ClassName', 'func']
@sigmavirus24
Copy link
Member

See #163. Requests for work on the part of the maintainers ("Would be nice ...") aren't going to be actioned.

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

Successfully merging a pull request may close this issue.

2 participants