summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Crosley <tcrosley@domaintools.com>2018-02-02 08:31:16 -0800
committerTimothy Crosley <tcrosley@domaintools.com>2018-02-02 08:31:16 -0800
commitb85facec32c87f0e64a3ba7c68ce6a76be4854a7 (patch)
tree7a2cfc9f1cd71d22282cdec7656bf6ac608a424f
parent1db36205f016ae4b72bb713aedf7f96b1be43723 (diff)
downloadisort-feature/fix-issue-654.tar.gz
Finish fixing issue #654feature/fix-issue-654
-rw-r--r--isort/isort.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/isort/isort.py b/isort/isort.py
index 0a672db3..beab947f 100644
--- a/isort/isort.py
+++ b/isort/isort.py
@@ -622,12 +622,18 @@ class SortImports(object):
next_construct = ""
self._in_quote = False
tail = self.out_lines[imports_tail:]
+
for index, line in enumerate(tail):
+ in_quote = self._in_quote
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
+ elif not in_quote:
+ parts = line.split()
+ if len(parts) >= 3 and parts[1] == '=' and "'" not in parts[0] and '"' not in parts[0]:
+ next_construct = line
if self.config['lines_after_imports'] != -1:
self.out_lines[imports_tail:0] = ["" for line in range(self.config['lines_after_imports'])]