summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Edmund Crosley <timothy.crosley@gmail.com>2018-02-02 08:36:11 -0800
committerGitHub <noreply@github.com>2018-02-02 08:36:11 -0800
commit724069b2114c7feedbc7e335eaaf4352faf48706 (patch)
tree7a2cfc9f1cd71d22282cdec7656bf6ac608a424f
parent68e5f61c1108e287b291a8272f36ec9969c9e60f (diff)
parentb85facec32c87f0e64a3ba7c68ce6a76be4854a7 (diff)
downloadisort-724069b2114c7feedbc7e335eaaf4352faf48706.tar.gz
Merge pull request #660 from timothycrosley/feature/fix-issue-654
Finish fixing 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'])]