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']
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 thanfrom 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: