diff options
author | Timothy Crosley <timothy.crosley@gmail.com> | 2018-02-02 06:47:21 -0800 |
---|---|---|
committer | Timothy Crosley <timothy.crosley@gmail.com> | 2018-02-02 06:47:21 -0800 |
commit | 72ba55f248ea858331f2cccec129d2f0862834f1 (patch) | |
tree | 0bf9111c32fa485ad0d2eea4cf0800293f950a53 | |
parent | f70dcc769290b7247fa05239054c0b37f81b9306 (diff) | |
download | isort-feature/fix-issue-651.tar.gz |
Current progressfeature/fix-issue-651
-rw-r--r-- | isort/isort.py | 14 |
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 |