Skip to content

Commit

Permalink
Simpler strategy for following line continuations
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Sep 20, 2020
1 parent 67fb11b commit 7960bf7
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions isort/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def process(
made_changes: bool = False
stripped_line: str = ""
end_of_file: bool = False
in_line_continuation: bool = False

if config.float_to_top:
new_input = ""
Expand Down Expand Up @@ -229,7 +228,7 @@ def process(
):
import_section += line
elif (
stripped_line.startswith(IMPORT_START_IDENTIFIERS) and not in_line_continuation
stripped_line.startswith(IMPORT_START_IDENTIFIERS)
):
contains_imports = True

Expand Down Expand Up @@ -273,10 +272,9 @@ def process(
indent = new_indent
import_section += import_statement
else:
if stripped_line.endswith("\\"):
in_line_continuation = True
else:
in_line_continuation = False
while stripped_line.endswith("\\"):
line += input_stream.readline()
stripped_line = line.strip().split("#")[0]
not_imports = True

if not_imports:
Expand Down

0 comments on commit 7960bf7

Please sign in to comment.