summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sphinx/domains/__init__.py10
-rw-r--r--sphinx/domains/changeset.py13
-rw-r--r--sphinx/domains/cpp.py10
-rw-r--r--sphinx/domains/javascript.py8
-rw-r--r--sphinx/domains/math.py8
-rw-r--r--sphinx/domains/python.py41
-rw-r--r--sphinx/domains/rst.py9
-rw-r--r--sphinx/domains/std.py41
8 files changed, 70 insertions, 70 deletions
diff --git a/sphinx/domains/__init__.py b/sphinx/domains/__init__.py
index 5a5e3e94a..ef17e5295 100644
--- a/sphinx/domains/__init__.py
+++ b/sphinx/domains/__init__.py
@@ -25,7 +25,7 @@ if False:
from sphinx.builders import Builder # NOQA
from sphinx.environment import BuildEnvironment # NOQA
from sphinx.roles import XRefRole # NOQA
- from sphinx.util.typing import RoleFunction, unicode # NOQA
+ from sphinx.util.typing import N_co, RoleFunction, unicode # NOQA
class ObjType:
@@ -223,7 +223,7 @@ class Domain:
fullname = '%s:%s' % (self.name, name)
def role_adapter(typ, rawtext, text, lineno, inliner, options={}, content=[]):
- # type: (unicode, unicode, unicode, int, Inliner, Dict, List[unicode]) -> Tuple[List[nodes.Node], List[nodes.Node]] # NOQA
+ # type: (unicode, unicode, unicode, int, Inliner, Dict, List[unicode]) -> Tuple[List[nodes.Node], List[nodes.system_message]] # NOQA
return self.roles[name](fullname, rawtext, text, lineno,
inliner, options, content)
self._role_cache[name] = role_adapter
@@ -243,7 +243,7 @@ class Domain:
class DirectiveAdapter(BaseDirective): # type: ignore
def run(self):
- # type: () -> List[nodes.Node]
+ # type: () -> List[N_co]
self.name = fullname
return super(DirectiveAdapter, self).run()
self._directive_cache[name] = DirectiveAdapter
@@ -345,12 +345,12 @@ class Domain:
return _('%s %s') % (self.label, type.lname)
def get_enumerable_node_type(self, node):
- # type: (nodes.Node) -> unicode
+ # type: (nodes.Element) -> unicode
"""Get type of enumerable nodes (experimental)."""
enum_node_type, _ = self.enumerable_nodes.get(node.__class__, (None, None))
return enum_node_type
def get_full_qualified_name(self, node):
- # type: (nodes.Node) -> unicode
+ # type: (nodes.Element) -> unicode
"""Return full qualified name for given node."""
return None
diff --git a/sphinx/domains/changeset.py b/sphinx/domains/changeset.py
index be974e635..c97de65d6 100644
--- a/sphinx/domains/changeset.py
+++ b/sphinx/domains/changeset.py
@@ -9,7 +9,7 @@
:license: BSD, see LICENSE for details.
"""
-from typing import NamedTuple
+from typing import NamedTuple, cast
from docutils import nodes
@@ -27,7 +27,7 @@ if False:
from typing import Any, Dict, List # NOQA
from sphinx.application import Sphinx # NOQA
from sphinx.environment import BuildEnvironment # NOQA
- from sphinx.util.typing import unicode # NOQA
+ from sphinx.util.typing import N_co, unicode # NOQA
versionlabels = {
@@ -63,8 +63,8 @@ class VersionChange(SphinxDirective):
option_spec = {} # type: Dict
def run(self):
- # type: () -> List[nodes.Node]
- node = addnodes.versionmodified() # type: nodes.Node
+ # type: () -> List[N_co]
+ node = addnodes.versionmodified()
node.document = self.state.document
set_source_info(self, node)
node['type'] = self.name
@@ -96,7 +96,8 @@ class VersionChange(SphinxDirective):
translatable=False)
node.append(para)
- self.env.get_domain('changeset').note_changeset(node) # type: ignore
+ domain = cast(ChangeSetDomain, self.env.get_domain('changeset'))
+ domain.note_changeset(node)
return [node] + messages
@@ -131,7 +132,7 @@ class ChangeSetDomain(Domain):
pass # nothing to do here. All changesets are registered on calling directive.
def note_changeset(self, node):
- # type: (nodes.Node) -> None
+ # type: (addnodes.versionmodified) -> None
version = node['version']
module = self.env.ref_context.get('py:module')
objname = self.env.temp_data.get('object')
diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py
index 86e2c2c6b..515e62cab 100644
--- a/sphinx/domains/cpp.py
+++ b/sphinx/domains/cpp.py
@@ -36,7 +36,7 @@ if False:
from sphinx.builders import Builder # NOQA
from sphinx.config import Config # NOQA
from sphinx.environment import BuildEnvironment # NOQA
- from sphinx.util.typing import unicode # NOQA
+ from sphinx.util.typing import N_co, unicode # NOQA
logger = logging.getLogger(__name__)
@@ -6472,7 +6472,7 @@ class CPPNamespaceObject(SphinxDirective):
self.state_machine.reporter.warning(msg, line=self.lineno)
def run(self):
- # type: () -> List[nodes.Node]
+ # type: () -> List[N_co]
rootSymbol = self.env.domaindata['cpp']['root_symbol']
if self.arguments[0].strip() in ('NULL', '0', 'nullptr'):
symbol = rootSymbol
@@ -6506,7 +6506,7 @@ class CPPNamespacePushObject(SphinxDirective):
self.state_machine.reporter.warning(msg, line=self.lineno)
def run(self):
- # type: () -> List[nodes.Node]
+ # type: () -> List[N_co]
if self.arguments[0].strip() in ('NULL', '0', 'nullptr'):
return []
parser = DefinitionParser(self.arguments[0], self, self.config)
@@ -6541,7 +6541,7 @@ class CPPNamespacePopObject(SphinxDirective):
self.state_machine.reporter.warning(msg, line=self.lineno)
def run(self):
- # type: () -> List[nodes.Node]
+ # type: () -> List[N_co]
stack = self.env.temp_data.get('cpp:namespace_stack', None)
if not stack or len(stack) == 0:
self.warn("C++ namespace pop on empty stack. Defaulting to gobal scope.")
@@ -6890,7 +6890,7 @@ class CPPDomain(Domain):
yield (name, dispname, objectType, docname, newestId, 1)
def get_full_qualified_name(self, node):
- # type: (nodes.Node) -> unicode
+ # type: (nodes.Element) -> unicode
target = node.get('reftarget', None)
if target is None:
return None
diff --git a/sphinx/domains/javascript.py b/sphinx/domains/javascript.py
index a552c8f04..594ac8db9 100644
--- a/sphinx/domains/javascript.py
+++ b/sphinx/domains/javascript.py
@@ -29,7 +29,7 @@ if False:
from sphinx.application import Sphinx # NOQA
from sphinx.builders import Builder # NOQA
from sphinx.environment import BuildEnvironment # NOQA
- from sphinx.util.typing import unicode # NOQA
+ from sphinx.util.typing import N_co, unicode # NOQA
class JSObject(ObjectDescription):
@@ -250,7 +250,7 @@ class JSModule(SphinxDirective):
}
def run(self):
- # type: () -> List[nodes.Node]
+ # type: () -> List[N_co]
mod_name = self.arguments[0].strip()
self.env.ref_context['js:module'] = mod_name
noindex = 'noindex' in self.options
@@ -273,7 +273,7 @@ class JSModule(SphinxDirective):
class JSXRefRole(XRefRole):
def process_link(self, env, refnode, has_explicit_title, title, target):
- # type: (BuildEnvironment, nodes.Node, bool, unicode, unicode) -> Tuple[unicode, unicode] # NOQA
+ # type: (BuildEnvironment, nodes.reference, bool, unicode, unicode) -> Tuple[unicode, unicode] # NOQA
# basically what sphinx.domains.python.PyXRefRole does
refnode['js:object'] = env.ref_context.get('js:object')
refnode['js:module'] = env.ref_context.get('js:module')
@@ -400,7 +400,7 @@ class JavaScriptDomain(Domain):
refname.replace('$', '_S_'), 1
def get_full_qualified_name(self, node):
- # type: (nodes.Node) -> unicode
+ # type: (nodes.Element) -> unicode
modname = node.get('js:module')
prefix = node.get('js:object')
target = node.get('reftarget')
diff --git a/sphinx/domains/math.py b/sphinx/domains/math.py
index 7a1348ed1..d598b98ed 100644
--- a/sphinx/domains/math.py
+++ b/sphinx/domains/math.py
@@ -33,7 +33,7 @@ logger = logging.getLogger(__name__)
class MathReferenceRole(XRefRole):
def result_nodes(self, document, env, node, is_ref):
- # type: (nodes.Node, BuildEnvironment, nodes.Node, bool) -> Tuple[List[nodes.Node], List[nodes.Node]] # NOQA
+ # type: (nodes.Node, BuildEnvironment, nodes.Element, bool) -> Tuple[List[nodes.Node], List[nodes.system_message]] # NOQA
node['refdomain'] = 'math'
return [node], []
@@ -53,7 +53,7 @@ class MathDomain(Domain):
enumerable_nodes = { # node_class -> (figtype, title_getter)
displaymath: ('displaymath', None),
nodes.math_block: ('displaymath', None),
- } # type: Dict[Type[nodes.Node], Tuple[unicode, Callable]]
+ }
roles = {
'numref': MathReferenceRole(),
}
@@ -109,12 +109,12 @@ class MathDomain(Domain):
return None
def resolve_any_xref(self, env, fromdocname, builder, target, node, contnode):
- # type: (BuildEnvironment, unicode, Builder, unicode, addnodes.pending_xref, nodes.Element) -> List[nodes.Element] # NOQA
+ # type: (BuildEnvironment, unicode, Builder, unicode, addnodes.pending_xref, nodes.Element) -> List[Tuple[unicode, nodes.Element]] # NOQA
refnode = self.resolve_xref(env, fromdocname, builder, 'eq', target, node, contnode)
if refnode is None:
return []
else:
- return [refnode]
+ return [('eq', refnode)]
def get_objects(self):
# type: () -> List
diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py
index 6769bafad..3b90786df 100644
--- a/sphinx/domains/python.py
+++ b/sphinx/domains/python.py
@@ -27,11 +27,11 @@ from sphinx.util.nodes import make_refnode
if False:
# For type annotation
- from typing import Any, Dict, Iterable, Iterator, List, Tuple, Union # NOQA
+ from typing import Any, Dict, Iterable, Iterator, List, Tuple, Type, Union # NOQA
from sphinx.application import Sphinx # NOQA
from sphinx.builders import Builder # NOQA
from sphinx.environment import BuildEnvironment # NOQA
- from sphinx.util.typing import unicode # NOQA
+ from sphinx.util.typing import N_co, unicode # NOQA
logger = logging.getLogger(__name__)
@@ -73,7 +73,7 @@ def _pseudo_parse_arglist(signode, arglist):
string literal (e.g. default argument value).
"""
paramlist = addnodes.desc_parameterlist()
- stack = [paramlist]
+ stack = [paramlist] # type: List[nodes.Element]
try:
for argument in arglist.split(','):
argument = argument.strip()
@@ -106,8 +106,9 @@ def _pseudo_parse_arglist(signode, arglist):
# if there are too few or too many elements on the stack, just give up
# and treat the whole argument list as one argument, discarding the
# already partially populated paramlist node
- signode += addnodes.desc_parameterlist()
- signode[-1] += addnodes.desc_parameter(arglist, arglist)
+ paramlist = addnodes.desc_parameterlist()
+ paramlist += addnodes.desc_parameter(arglist, arglist)
+ signode += paramlist
else:
signode += paramlist
@@ -119,7 +120,7 @@ class PyXrefMixin:
rolename, # type: unicode
domain, # type: unicode
target, # type: unicode
- innernode=nodes.emphasis, # type: nodes.Node
+ innernode=nodes.emphasis, # type: Type[nodes.TextElement]
contnode=None, # type: nodes.Node
env=None, # type: BuildEnvironment
):
@@ -142,7 +143,7 @@ class PyXrefMixin:
rolename, # type: unicode
domain, # type: unicode
target, # type: unicode
- innernode=nodes.emphasis, # type: nodes.Node
+ innernode=nodes.emphasis, # type: Type[nodes.TextElement]
contnode=None, # type: nodes.Node
env=None, # type: BuildEnvironment
):
@@ -170,7 +171,7 @@ class PyXrefMixin:
class PyField(PyXrefMixin, Field):
def make_xref(self, rolename, domain, target,
innernode=nodes.emphasis, contnode=None, env=None):
- # type: (unicode, unicode, unicode, nodes.Node, nodes.Node, BuildEnvironment) -> nodes.Node # NOQA
+ # type: (unicode, unicode, unicode, Type[nodes.TextElement], nodes.Node, BuildEnvironment) -> nodes.Node # NOQA
if rolename == 'class' and target == 'None':
# None is not a type, so use obj role instead.
rolename = 'obj'
@@ -186,7 +187,7 @@ class PyGroupedField(PyXrefMixin, GroupedField):
class PyTypedField(PyXrefMixin, TypedField):
def make_xref(self, rolename, domain, target,
innernode=nodes.emphasis, contnode=None, env=None):
- # type: (unicode, unicode, unicode, nodes.Node, nodes.Node, BuildEnvironment) -> nodes.Node # NOQA
+ # type: (unicode, unicode, unicode, Type[nodes.TextElement], nodes.Node, BuildEnvironment) -> nodes.Node # NOQA
if rolename == 'class' and target == 'None':
# None is not a type, so use obj role instead.
rolename = 'obj'
@@ -556,7 +557,7 @@ class PyDecoratorFunction(PyDecoratorMixin, PyModulelevel):
Directive to mark functions meant to be used as decorators.
"""
def run(self):
- # type: () -> List[nodes.Node]
+ # type: () -> List[N_co]
# a decorator function is a function after all
self.name = 'py:function'
return super(PyDecoratorFunction, self).run()
@@ -567,7 +568,7 @@ class PyDecoratorMethod(PyDecoratorMixin, PyClassmember):
Directive to mark methods meant to be used as decorators.
"""
def run(self):
- # type: () -> List[nodes.Node]
+ # type: () -> List[N_co]
self.name = 'py:method'
return super(PyDecoratorMethod, self).run()
@@ -589,7 +590,7 @@ class PyModule(SphinxDirective):
}
def run(self):
- # type: () -> List[nodes.Node]
+ # type: () -> List[N_co]
modname = self.arguments[0].strip()
noindex = 'noindex' in self.options
self.env.ref_context['py:module'] = modname
@@ -628,7 +629,7 @@ class PyCurrentModule(SphinxDirective):
option_spec = {} # type: Dict
def run(self):
- # type: () -> List[nodes.Node]
+ # type: () -> List[N_co]
modname = self.arguments[0].strip()
if modname == 'None':
self.env.ref_context.pop('py:module', None)
@@ -639,7 +640,7 @@ class PyCurrentModule(SphinxDirective):
class PyXRefRole(XRefRole):
def process_link(self, env, refnode, has_explicit_title, title, target):
- # type: (BuildEnvironment, nodes.Node, bool, unicode, unicode) -> Tuple[unicode, unicode] # NOQA
+ # type: (BuildEnvironment, nodes.Element, bool, unicode, unicode) -> Tuple[unicode, unicode] # NOQA
refnode['py:module'] = env.ref_context.get('py:module')
refnode['py:class'] = env.ref_context.get('py:class')
if not has_explicit_title:
@@ -884,18 +885,16 @@ class PythonDomain(Domain):
name, obj = matches[0]
if obj[1] == 'module':
- return self._make_module_refnode(builder, fromdocname, name,
- contnode)
+ return self._make_module_refnode(builder, fromdocname, name, contnode)
else:
- return make_refnode(builder, fromdocname, obj[0], name,
- contnode, name)
+ return make_refnode(builder, fromdocname, obj[0], name, contnode, name)
def resolve_any_xref(self, env, fromdocname, builder, target,
node, contnode):
# type: (BuildEnvironment, unicode, Builder, unicode, addnodes.pending_xref, nodes.Element) -> List[Tuple[unicode, nodes.Element]] # NOQA
modname = node.get('py:module')
clsname = node.get('py:class')
- results = [] # type: List[Tuple[unicode, nodes.Node]]
+ results = [] # type: List[Tuple[unicode, nodes.Element]]
# always search in "refspecific" mode with the :any: role
matches = self.find_obj(env, modname, clsname, target, None, 1)
@@ -911,7 +910,7 @@ class PythonDomain(Domain):
return results
def _make_module_refnode(self, builder, fromdocname, name, contnode):
- # type: (Builder, unicode, unicode, nodes.Node) -> nodes.Node
+ # type: (Builder, unicode, unicode, nodes.Node) -> nodes.Element
# get additional info for modules
docname, synopsis, platform, deprecated = self.data['modules'][name]
title = name
@@ -933,7 +932,7 @@ class PythonDomain(Domain):
yield (refname, refname, type, docname, refname, 1)
def get_full_qualified_name(self, node):
- # type: (nodes.Node) -> unicode
+ # type: (nodes.Element) -> unicode
modname = node.get('py:module')
clsname = node.get('py:class')
target = node.get('reftarget')
diff --git a/sphinx/domains/rst.py b/sphinx/domains/rst.py
index 344ca6bcd..c803835e3 100644
--- a/sphinx/domains/rst.py
+++ b/sphinx/domains/rst.py
@@ -143,8 +143,7 @@ class ReSTDomain(Domain):
if doc in docnames:
self.data['objects'][typ, name] = doc
- def resolve_xref(self, env, fromdocname, builder, typ, target, node,
- contnode):
+ def resolve_xref(self, env, fromdocname, builder, typ, target, node, contnode):
# type: (BuildEnvironment, unicode, Builder, unicode, unicode, addnodes.pending_xref, nodes.Element) -> nodes.Element # NOQA
objects = self.data['objects']
objtypes = self.objtypes_for_role(typ)
@@ -154,10 +153,10 @@ class ReSTDomain(Domain):
objects[objtype, target],
objtype + '-' + target,
contnode, target + ' ' + objtype)
+ return None
- def resolve_any_xref(self, env, fromdocname, builder, target,
- node, contnode):
- # type: (BuildEnvironment, unicode, Builder, unicode, addnodes.pending_xref, nodes.Element) -> List[nodes.Element] # NOQA
+ def resolve_any_xref(self, env, fromdocname, builder, target, node, contnode):
+ # type: (BuildEnvironment, unicode, Builder, unicode, addnodes.pending_xref, nodes.Element) -> List[Tuple[unicode, nodes.Element]] # NOQA
objects = self.data['objects']
results = []
for objtype in self.object_types:
diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py
index 55e03c87a..d86e5b1c5 100644
--- a/sphinx/domains/std.py
+++ b/sphinx/domains/std.py
@@ -36,7 +36,7 @@ if False:
from sphinx.application import Sphinx # NOQA
from sphinx.builders import Builder # NOQA
from sphinx.environment import BuildEnvironment # NOQA
- from sphinx.util.typing import RoleFunction, unicode # NOQA
+ from sphinx.util.typing import N_co, RoleFunction, unicode # NOQA
logger = logging.getLogger(__name__)
@@ -95,7 +95,7 @@ class EnvVarXRefRole(XRefRole):
"""
def result_nodes(self, document, env, node, is_ref):
- # type: (nodes.Node, BuildEnvironment, nodes.Node, bool) -> Tuple[List[nodes.Node], List[nodes.Node]] # NOQA
+ # type: (nodes.document, BuildEnvironment, nodes.Element, bool) -> Tuple[List[nodes.Element], List[nodes.system_message]] # NOQA
if not is_ref:
return [node], []
varname = node['reftarget']
@@ -123,13 +123,13 @@ class Target(SphinxDirective):
option_spec = {} # type: Dict
def run(self):
- # type: () -> List[nodes.Node]
+ # type: () -> List[N_co]
# normalize whitespace in fullname like XRefRole does
fullname = ws_re.sub(' ', self.arguments[0].strip())
targetname = '%s-%s' % (self.name, fullname)
node = nodes.target('', '', ids=[targetname])
self.state.document.note_explicit_target(node)
- ret = [node] # type: List[nodes.Node]
+ ret = [node]
if self.indextemplate:
indexentry = self.indextemplate % (fullname,)
indextype = 'single'
@@ -222,7 +222,7 @@ class Program(SphinxDirective):
option_spec = {} # type: Dict
def run(self):
- # type: () -> List[nodes.Node]
+ # type: () -> List[N_co]
program = ws_re.sub('-', self.arguments[0].strip())
if program == 'None':
self.env.ref_context.pop('std:program', None)
@@ -233,7 +233,7 @@ class Program(SphinxDirective):
class OptionXRefRole(XRefRole):
def process_link(self, env, refnode, has_explicit_title, title, target):
- # type: (BuildEnvironment, nodes.Node, bool, unicode, unicode) -> Tuple[unicode, unicode] # NOQA
+ # type: (BuildEnvironment, nodes.Element, bool, unicode, unicode) -> Tuple[unicode, unicode] # NOQA
refnode['std:program'] = env.ref_context.get('std:program')
return title, target
@@ -290,7 +290,7 @@ class Glossary(SphinxDirective):
}
def run(self):
- # type: () -> List[nodes.Node]
+ # type: () -> List[N_co]
node = addnodes.glossary()
node.document = self.state.document
@@ -419,10 +419,10 @@ class ProductionList(SphinxDirective):
option_spec = {} # type: Dict
def run(self):
- # type: () -> List[nodes.Node]
+ # type: () -> List[nodes.Element]
domain = cast(StandardDomain, self.env.get_domain('std'))
- node = addnodes.productionlist() # type: nodes.Node
- messages = [] # type: List[nodes.Node]
+ node = addnodes.productionlist() # type: nodes.Element
+ messages = [] # type: List[nodes.Element]
i = 0
for rule in self.arguments[0].split('\n'):
@@ -526,7 +526,7 @@ class StandardDomain(Domain):
nodes.figure: ('figure', None),
nodes.table: ('table', None),
nodes.container: ('code-block', None),
- } # type: Dict[Type[nodes.Node], Tuple[unicode, Callable]]
+ } # type: Dict[Type[nodes.Element], Tuple[unicode, Callable]]
def __init__(self, env):
# type: (BuildEnvironment) -> None
@@ -619,7 +619,8 @@ class StandardDomain(Domain):
if labelid is None:
continue
node = document.ids[labelid]
- if node.tagname == 'target' and 'refid' in node: # indirect hyperlink targets
+ if isinstance(node, nodes.target) and 'refid' in node:
+ # indirect hyperlink targets
node = document.ids.get(node['refid'])
labelid = node['names'][0]
if (node.tagname == 'footnote' or
@@ -668,7 +669,7 @@ class StandardDomain(Domain):
def build_reference_node(self, fromdocname, builder, docname, labelid,
sectname, rolename, **options):
- # type: (unicode, Builder, unicode, unicode, unicode, unicode, Any) -> nodes.Node
+ # type: (unicode, Builder, unicode, unicode, unicode, unicode, Any) -> nodes.Element
nodeclass = options.pop('nodeclass', nodes.reference)
newnode = nodeclass('', '', internal=True, **options)
innernode = nodes.inline(sectname, sectname)
@@ -875,7 +876,7 @@ class StandardDomain(Domain):
def resolve_any_xref(self, env, fromdocname, builder, target, node, contnode):
# type: (BuildEnvironment, unicode, Builder, unicode, addnodes.pending_xref, nodes.Element) -> List[Tuple[unicode, nodes.Element]] # NOQA
- results = [] # type: List[Tuple[unicode, nodes.Node]]
+ results = [] # type: List[Tuple[unicode, nodes.Element]]
ltarget = target.lower() # :ref: lowercases its target automatically
for role in ('ref', 'option'): # do not try "keyword"
res = self.resolve_xref(env, fromdocname, builder, role,
@@ -927,7 +928,7 @@ class StandardDomain(Domain):
return node.__class__ in self.enumerable_nodes
def get_numfig_title(self, node):
- # type: (nodes.Node) -> unicode
+ # type: (nodes.Element) -> unicode
"""Get the title of enumerable nodes to refer them using its title"""
if self.is_enumerable_node(node):
_, title_getter = self.enumerable_nodes.get(node.__class__, (None, None))
@@ -941,10 +942,10 @@ class StandardDomain(Domain):
return None
def get_enumerable_node_type(self, node):
- # type: (nodes.Node) -> unicode
+ # type: (nodes.Element) -> unicode
"""Get type of enumerable nodes."""
def has_child(node, cls):
- # type: (nodes.Node, Type) -> bool
+ # type: (nodes.Element, Type) -> bool
return any(isinstance(child, cls) for child in node)
if isinstance(node, nodes.section):
@@ -959,7 +960,7 @@ class StandardDomain(Domain):
return figtype
def get_figtype(self, node):
- # type: (nodes.Node) -> unicode
+ # type: (nodes.Element) -> unicode
"""Get figure type of nodes.
.. deprecated:: 1.8
@@ -970,7 +971,7 @@ class StandardDomain(Domain):
return self.get_enumerable_node_type(node)
def get_fignumber(self, env, builder, figtype, docname, target_node):
- # type: (BuildEnvironment, Builder, unicode, unicode, nodes.Node) -> Tuple[int, ...]
+ # type: (BuildEnvironment, Builder, unicode, unicode, nodes.Element) -> Tuple[int, ...]
if figtype == 'section':
if builder.name == 'latex':
return tuple()
@@ -993,7 +994,7 @@ class StandardDomain(Domain):
raise ValueError
def get_full_qualified_name(self, node):
- # type: (nodes.Node) -> unicode
+ # type: (nodes.Element) -> unicode
if node.get('reftype') == 'option':
progname = node.get('std:program')
command = ws_re.split(node.get('reftarget'))