Skip to content

Commit

Permalink
Resolve #1382: float to top
Browse files Browse the repository at this point in the history
  • Loading branch information
timothycrosley committed Sep 3, 2020
1 parent 31f26da commit e2b2f8d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions isort/parse.py
Expand Up @@ -200,6 +200,10 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte
if skipping_line:
out_lines.append(line)
continue
elif config.float_to_top and import_index == -1 and line and not in_quote and not line.strip().startswith("#"):
import_index = index - 1
while import_index and not in_lines[import_index - 1]:
import_index -= 1

line, *end_of_line_comment = line.split("#", 1)
if ";" in line:
Expand Down

0 comments on commit e2b2f8d

Please sign in to comment.