From 5cf43893ca21f8ff3a096ad6f6333a35e9494fda Mon Sep 17 00:00:00 2001 From: Timothy Crosley Date: Fri, 3 Jan 2020 01:44:04 -0800 Subject: Add SUPPORTED_EXTENSIONS configuration variable, add pyx to it --- isort/main.py | 4 ++-- 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", -- cgit v1.2.1