mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Correct type signature of set_role_source_info()
This commit is contained in:
parent
b13a6ff3e6
commit
d194fe8f7f
@ -136,7 +136,7 @@ class XRefRole:
|
||||
refnode = self.nodeclass(rawtext, reftype=role, refdomain=domain,
|
||||
refexplicit=has_explicit_title)
|
||||
# we may need the line number for warnings
|
||||
set_role_source_info(inliner, lineno, refnode) # type: ignore
|
||||
set_role_source_info(inliner, lineno, refnode)
|
||||
title, target = self.process_link(env, refnode, has_explicit_title, title, target)
|
||||
# now that the target and title are finally determined, set them
|
||||
refnode['reftarget'] = target
|
||||
@ -375,7 +375,7 @@ def index_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
||||
entries = [('single', target, targetid, main, None)]
|
||||
indexnode = addnodes.index()
|
||||
indexnode['entries'] = entries
|
||||
set_role_source_info(inliner, lineno, indexnode) # type: ignore
|
||||
set_role_source_info(inliner, lineno, indexnode)
|
||||
textnode = nodes.Text(title, title)
|
||||
return [indexnode, targetnode, textnode], []
|
||||
|
||||
|
@ -23,6 +23,7 @@ from sphinx.util import logging
|
||||
if False:
|
||||
# For type annotation
|
||||
from typing import Any, Callable, Iterable, List, Optional, Set, Tuple, Type # NOQA
|
||||
from docutils.parsers.rst.states import Inliner # NOQA
|
||||
from docutils.statemachine import StringList # NOQA
|
||||
from sphinx.builders import Builder # NOQA
|
||||
from sphinx.utils.tags import Tags # NOQA
|
||||
@ -449,7 +450,7 @@ def set_source_info(directive, node):
|
||||
|
||||
|
||||
def set_role_source_info(inliner, lineno, node):
|
||||
# type: (Any, unicode, nodes.Node) -> None
|
||||
# type: (Inliner, int, nodes.Node) -> None
|
||||
node.source, node.line = inliner.reporter.get_source_and_line(lineno)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user