diff options
author | Timothy Crosley <timothy.crosley@gmail.com> | 2019-12-24 01:25:47 -0800 |
---|---|---|
committer | Timothy Crosley <timothy.crosley@gmail.com> | 2019-12-24 01:25:47 -0800 |
commit | 4add8a64ed9a1425ca2c1397b6eb06bd423214e5 (patch) | |
tree | 9fee704de65078540052b8a148ab5890e4e1e493 | |
parent | a6a32c4814df0453c468db0075dd3190f3244351 (diff) | |
download | isort-4add8a64ed9a1425ca2c1397b6eb06bd423214e5.tar.gz |
Improve top comment handling
-rw-r--r-- | isort/api.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/isort/api.py b/isort/api.py index cca2f5bb..e78b42c4 100644 --- a/isort/api.py +++ b/isort/api.py @@ -186,7 +186,8 @@ def sort_imports( if not line.startswith("#") or stripped_line in section_comments: in_top_comment = False first_comment_index_end = index - 1 - elif '"' in line or "'" in line: + + if not line.startswith("#") and '"' in line or "'" in line: char_index = 0 if first_comment_index_start == -1 and (line.startswith('"') or line.startswith("'")): first_comment_index_start = index |