summaryrefslogtreecommitdiff
path: root/sphinx/util/nodes.py
diff options
context:
space:
mode:
authordanieleades <33452915+danieleades@users.noreply.github.com>2023-01-02 17:55:53 +0000
committerGitHub <noreply@github.com>2023-01-02 17:55:53 +0000
commit256e52180759e7205178a8aa087ee1e362b7669d (patch)
treec17897a23a4ad85c184207c3f968cabc7a78792a /sphinx/util/nodes.py
parent77a02cf696f8375791a2f5aa5c38306ca080d443 (diff)
downloadsphinx-git-256e52180759e7205178a8aa087ee1e362b7669d.tar.gz
Shrink mypy whitelist for 'util.nodes' module (#11061)
Diffstat (limited to 'sphinx/util/nodes.py')
-rw-r--r--sphinx/util/nodes.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py
index 201b547d9..884965b93 100644
--- a/sphinx/util/nodes.py
+++ b/sphinx/util/nodes.py
@@ -264,18 +264,18 @@ def extract_messages(doctree: Element) -> Iterable[tuple[Element, str]]:
yield node, msg
-def get_node_source(node: Element) -> str | None:
+def get_node_source(node: Element) -> str:
for pnode in traverse_parent(node):
if pnode.source:
return pnode.source
- return None
+ raise ValueError("node source not found")
-def get_node_line(node: Element) -> int | None:
+def get_node_line(node: Element) -> int:
for pnode in traverse_parent(node):
if pnode.line:
return pnode.line
- return None
+ raise ValueError("node line not found")
def traverse_parent(node: Element, cls: Any = None) -> Iterable[Element]: