Skip to content

Commit

Permalink
Add isort compatible style
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreamsorcerer authored and sigmavirus24 committed Dec 2, 2022
1 parent 59cd7cd commit 2420f82
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions flake8_import_order/styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,18 @@ def import_key(import_):
return (import_.type, import_.is_from, import_.level, import_.modules, import_.names)


class ISort(PyCharm):
@staticmethod
def name_key(name):
# Group by CONSTANT, Class, func.
group = 0 if name.isupper() else 2 if name.islower() else 1
return (group, name)

@staticmethod
def sorted_names(names):
return sorted(names, key=ISort.name_key)


class Cryptography(Style):

@staticmethod
Expand Down

0 comments on commit 2420f82

Please sign in to comment.