From 896d6ce0ca81f49fee5816e1af55dcde3e51c075 Mon Sep 17 00:00:00 2001 From: Timothy Crosley Date: Fri, 6 Dec 2019 23:03:44 -0800 Subject: Attempt to deal with \ and ( \n \n ) continuouations --- isort/parse.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/isort/parse.py b/isort/parse.py index f5c792d5..b5b285ae 100644 --- a/isort/parse.py +++ b/isort/parse.py @@ -510,6 +510,22 @@ def identify_contiguous_imports( import_section += line elif stripped_line.startswith(IMPORT_START_IDENTIFIERS): import_section += line + if "(" in stripped_line and not ")" in stripped_line: + nested_line = line + nested_stripped_line = nested_line.strip() + while not ")" in nested_stripped_line: + nested_line = input_stream.readline() + nested_stripped_line = nested_line.strip() + import_section += nested_line + + if stripped_line.endswith("\\"): + nested_line = line + nested_stripped_line = nested_line.strip() + while nested_line and nested_stripped_line.endswith("\\"): + nested_line = input_stream.readline() + nested_stripped_line = nested_line.strip() + import_section += nested_line + contains_imports = True else: not_imports = True -- cgit v1.2.1