Skip to content

Commit

Permalink
Clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
caffeinepills committed Apr 9, 2024
1 parent cafa0bf commit 4c772ac
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/sphinx_autodoc_typehints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
if TYPE_CHECKING:
from ast import FunctionDef, Module, stmt

from docutils.nodes import Node, document
from docutils.nodes import Node
from docutils.parsers.rst import states
from sphinx.application import Sphinx
from sphinx.config import Config
Expand Down Expand Up @@ -823,13 +823,13 @@ def get_insert_index(app: Sphinx, lines: list[str]) -> InsertIndexInfo | None:
# If there is a next sibling but we can't locate a line number, insert
# at end. (I don't know of any input where this happens.)
next_sibling = child.next_node(descend=False, siblings=True)
line_no = node_line_no(next_sibling)
line_no = node_line_no(next_sibling) if next_sibling else None
at = line_no - 2 if line_no else len(lines)
return InsertIndexInfo(insert_index=at, found_param=True)

# 4. Insert before examples
for child in doc.children:
if tag_name(child) in {"literal_block", "paragraph", "field_list", "substitution_definition"}:
if tag_name(child) in {"literal_block", "paragraph", "field_list"}:
continue
line_no = node_line_no(child)
at = line_no - 2 if line_no else len(lines)
Expand Down

0 comments on commit 4c772ac

Please sign in to comment.