Skip to content

Commit

Permalink
fix: future import insertion error opening quotes on a line
Browse files Browse the repository at this point in the history
  • Loading branch information
frostming committed Dec 2, 2022
1 parent b39b431 commit f355b95
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fix_future_annotations/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ def _add_future_annotations(content: str) -> str:

if in_doc:
code = line.split("#")[0].rstrip()
if code.endswith(doc_quote) and not _escaped(code[: -len(doc_quote)]):
if (
code != doc_quote
and code.endswith(doc_quote)
and not _escaped(code[: -len(doc_quote)])
):
in_doc = False
first_code = lines[i].lstrip()
if not first_code.startswith("from __future__ import") and i == insert_pos:
Expand Down

0 comments on commit f355b95

Please sign in to comment.