summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2019-12-20 23:56:15 -0800
committerTimothy Crosley <timothy.crosley@gmail.com>2019-12-20 23:56:15 -0800
commit2ba782fb1a74294f2a67cd64fe4b6bf98dddba30 (patch)
treee0fd0db4a5cd4c9dc6b3bbed4eb79181fc0c4848
parentf5ef546ede9450b19d7c615ab7e7c833f88a7dcf (diff)
downloadisort-2ba782fb1a74294f2a67cd64fe4b6bf98dddba30.tar.gz
Use new congiuous import sorter
-rw-r--r--isort/api.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/isort/api.py b/isort/api.py
index 30c9f0f3..76886625 100644
--- a/isort/api.py
+++ b/isort/api.py
@@ -1,4 +1,5 @@
import re
+from io import StringIO
from pathlib import Path
from typing import Any, NamedTuple, Optional, TextIO, Tuple
@@ -62,9 +63,10 @@ def sorted_imports(
except SyntaxError:
raise ExistingSyntaxErrors(content_source)
- parsed_output = output.sorted_imports(
- parse.file_contents(file_contents, config=config), config, extension
- )
+ parsed_output = StringIO()
+ sort_imports(StringIO(file_contents), parsed_output, extension=extension, config=config)
+ parsed_output.seek(0)
+ parsed_output = parsed_output.read()
if config.atomic:
try:
compile(file_contents, content_source, "exec", 0, 1)