summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2019-12-26 22:41:12 -0800
committerTimothy Crosley <timothy.crosley@gmail.com>2019-12-26 22:41:12 -0800
commit6009a180237aa9ba070cb0b14178b83d457e6069 (patch)
tree5b530701b351d78389e204e09c194a95825319ae
parent8baea2dd7c1ae2ee2c9331fed81b01c8f4d2569e (diff)
downloadisort-6009a180237aa9ba070cb0b14178b83d457e6069.tar.gz
Black formattingp
-rw-r--r--isort/_future/__init__.py1
-rw-r--r--isort/api.py10
-rw-r--r--isort/finders.py3
-rw-r--r--isort/settings.py1
4 files changed, 12 insertions, 3 deletions
diff --git a/isort/_future/__init__.py b/isort/_future/__init__.py
index 9f5e9d18..4d9ef4b7 100644
--- a/isort/_future/__init__.py
+++ b/isort/_future/__init__.py
@@ -2,6 +2,7 @@ import sys
if sys.version_info.major <= 3 and sys.version_info.minor <= 6:
from . import _dataclasses as dataclasses # type: ignore
+
else:
import dataclasses # type: ignore
diff --git a/isort/api.py b/isort/api.py
index fa512d61..c53fe98a 100644
--- a/isort/api.py
+++ b/isort/api.py
@@ -215,7 +215,7 @@ def sort_imports(
elif stripped_line.startswith(IMPORT_START_IDENTIFIERS):
contains_imports = True
- indent = line[:-len(line.lstrip())]
+ indent = line[: -len(line.lstrip())]
import_section += line
while stripped_line.endswith("\\") or (
"(" in stripped_line and ")" not in stripped_line
@@ -263,12 +263,16 @@ def sort_imports(
first_import_section = False
if indent:
- import_section = line_separator.join(line.lstrip() for line in import_section.split(line_separator))
+ import_section = line_separator.join(
+ line.lstrip() for line in import_section.split(line_separator)
+ )
sorted_import_section = output.sorted_imports(
parse.file_contents(import_section, config=config), config, extension
)
if indent:
- sorted_import_section = textwrap.indent(sorted_import_section, indent) + line_separator
+ sorted_import_section = (
+ textwrap.indent(sorted_import_section, indent) + line_separator
+ )
output_stream.write(sorted_import_section)
diff --git a/isort/finders.py b/isort/finders.py
index d63cc94b..5a7c74a7 100644
--- a/isort/finders.py
+++ b/isort/finders.py
@@ -30,16 +30,19 @@ from .utils import chdir, exists_case_sensitive
try:
from pipreqs import pipreqs
+
except ImportError:
pipreqs = None
try:
from pip_api import parse_requirements
+
except ImportError:
parse_requirements = None
try:
from requirementslib import Pipfile
+
except ImportError:
Pipfile = None
diff --git a/isort/settings.py b/isort/settings.py
index 607c67b6..1bdc35cb 100644
--- a/isort/settings.py
+++ b/isort/settings.py
@@ -43,6 +43,7 @@ from .wrap_modes import from_string as wrap_mode_from_string
try:
import toml
+
except ImportError:
toml = None # type: ignore