summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--isort/isort.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/isort/isort.py b/isort/isort.py
index 567a2fdd..34325c6b 100644
--- a/isort/isort.py
+++ b/isort/isort.py
@@ -622,14 +622,26 @@ class SortImports(object):
next_construct = ""
self._in_quote = False
tail = self.out_lines[imports_tail:]
+ quote_started = False
+ start_of_quote = False
for index, line in enumerate(tail):
+ if self._in_quote:
+ if not quote_started:
+ start_of_quote = True
+ quote_started = True
+ else:
+ start_of_quote = False
+ elif quote_started:
+ quote_started = False
+ start_of_quote = False
+
if not self._skip_line(line) and line.strip():
if line.strip().startswith("#") and len(tail) > (index + 1) and tail[index + 1].strip():
continue
next_construct = line
break
- else:
+ elif start_of_quote:
parts = line.split()
if len(parts) >=3 and parts[1] == '=' and (parts[2].startswith('"') or parts[2].startswith("'")):
next_construct = line