diff options
author | Timothy Crosley <timothy.crosley@gmail.com> | 2020-01-03 01:44:04 -0800 |
---|---|---|
committer | Timothy Crosley <timothy.crosley@gmail.com> | 2020-01-03 01:44:04 -0800 |
commit | 5cf43893ca21f8ff3a096ad6f6333a35e9494fda (patch) | |
tree | c009a05f0fb92695254e798a453467c6b6b11505 | |
parent | c54b3dd4620f9b3e7ac127c583ecb029fb90f1b7 (diff) | |
download | isort-5cf43893ca21f8ff3a096ad6f6333a35e9494fda.tar.gz |
Add SUPPORTED_EXTENSIONS configuration variable, add pyx to it
-rw-r--r-- | isort/main.py | 4 | ||||
-rw-r--r-- | isort/settings.py | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/isort/main.py b/isort/main.py index 4447545e..2c30cfa0 100644 --- a/isort/main.py +++ b/isort/main.py @@ -14,7 +14,7 @@ import setuptools from . import SortImports, __version__, sections from .logo import ASCII_ART from .profiles import profiles -from .settings import DEFAULT_CONFIG, VALID_PY_TARGETS, Config, WrapModes +from .settings import DEFAULT_CONFIG, SUPPORTED_EXTENSIONS, VALID_PY_TARGETS, Config, WrapModes shebang_re = re.compile(br"^#!.*\bpython[23w]?\b") QUICK_GUIDE = f""" @@ -35,7 +35,7 @@ Visit https://timothycrosley.github.io/isort/ for complete information about how def is_python_file(path: str) -> bool: _root, ext = os.path.splitext(path) - if ext in (".py", ".pyi"): + if ext in SUPPORTED_EXTENSIONS: return True if ext in (".pex",): return False diff --git a/isort/settings.py b/isort/settings.py index ed5e4a51..387d10e4 100644 --- a/isort/settings.py +++ b/isort/settings.py @@ -55,6 +55,7 @@ try: except ImportError: appdirs = None +SUPPORTED_EXTENSIONS = (".py", ".pyi", ".pyx") FILE_SKIP_COMMENTS: Tuple[str, ...] = ( "isort:" + "skip_file", "isort: " + "skip_file", |