summaryrefslogtreecommitdiff
path: root/isort/parse.py
diff options
context:
space:
mode:
authorTimothy Crosley <timothy.crosley@gmail.com>2020-01-05 04:05:35 -0800
committerTimothy Crosley <timothy.crosley@gmail.com>2020-01-05 04:05:35 -0800
commit55b9aac25e9527badd5ae7139be8ba08dfa7e58f (patch)
tree55db9a424b592473fa87bd870a0afb55782cb0b3 /isort/parse.py
parent0e8f7a3ace269ad0229b6cef56ff6aef5e06a8b0 (diff)
downloadisort-55b9aac25e9527badd5ae7139be8ba08dfa7e58f.tar.gz
Fix issue #1065, multiple noqa commentsfeature/fix-issue-1065
Diffstat (limited to 'isort/parse.py')
-rw-r--r--isort/parse.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/isort/parse.py b/isort/parse.py
index 92bb46b5..8172808d 100644
--- a/isort/parse.py
+++ b/isort/parse.py
@@ -332,7 +332,8 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte
categorized_comments["nested"].setdefault(import_from, {})[
import_name
] = associated_comment
- comments.pop(comments.index(associated_comment))
+ if associated_comment in comments:
+ comments.pop(comments.index(associated_comment))
if comments:
categorized_comments["from"].setdefault(import_from, []).extend(comments)