Merge branch '2.1.3' into 2.0

This commit is contained in:
Takeshi KOMIYA 2019-06-21 11:36:58 +09:00
commit fd5b3c47b6
7 changed files with 11 additions and 10 deletions

View File

@ -47,7 +47,7 @@ extras_require = {
'html5lib', 'html5lib',
'flake8>=3.5.0', 'flake8>=3.5.0',
'flake8-import-order', 'flake8-import-order',
'mypy>=0.590', 'mypy>=0.710',
'docutils-stubs', 'docutils-stubs',
], ],
} }

View File

@ -910,12 +910,13 @@ class StandardDomain(Domain):
# type: (nodes.Node) -> str # type: (nodes.Node) -> str
"""Get the title of enumerable nodes to refer them using its title""" """Get the title of enumerable nodes to refer them using its title"""
if self.is_enumerable_node(node): if self.is_enumerable_node(node):
_, title_getter = self.enumerable_nodes.get(node.__class__, (None, None)) elem = cast(nodes.Element, node)
_, title_getter = self.enumerable_nodes.get(elem.__class__, (None, None))
if title_getter: if title_getter:
return title_getter(node) return title_getter(elem)
else: else:
for subnode in node: for subnode in elem:
if subnode.tagname in ('caption', 'title'): if isinstance(subnode, (nodes.caption, nodes.title)):
return clean_astext(subnode) return clean_astext(subnode)
return None return None

View File

@ -123,7 +123,7 @@ def isenumattribute(x: Any) -> bool:
def ispartial(obj: Any) -> bool: def ispartial(obj: Any) -> bool:
"""Check if the object is partial.""" """Check if the object is partial."""
return isinstance(obj, (partial, partialmethod)) return isinstance(obj, (partial, partialmethod)) # type: ignore
def isclassmethod(obj: Any) -> bool: def isclassmethod(obj: Any) -> bool:

View File

@ -30,7 +30,7 @@ class PyStemmer(BaseStemmer):
return self.stemmer.stemWord(word) return self.stemmer.stemWord(word)
class StandardStemmer(PorterStemmer, BaseStemmer): # type: ignore class StandardStemmer(PorterStemmer, BaseStemmer):
"""All those porter stemmer implementations look hideous; """All those porter stemmer implementations look hideous;
make at least the stem method nicer. make at least the stem method nicer.
""" """

View File

@ -2598,7 +2598,7 @@ class LaTeXTranslator(SphinxTranslator):
RemovedInSphinx30Warning) RemovedInSphinx30Warning)
def visit_admonition(self, node): def visit_admonition(self, node):
# type: (nodes.Element) -> None # type: (LaTeXTranslator, nodes.Element) -> None
self.body.append('\n\\begin{sphinxadmonition}{%s}{%s:}' % self.body.append('\n\\begin{sphinxadmonition}{%s}{%s:}' %
(name, admonitionlabels[name])) (name, admonitionlabels[name]))
return visit_admonition return visit_admonition

View File

@ -1752,6 +1752,6 @@ class TexinfoTranslator(SphinxTranslator):
RemovedInSphinx30Warning) RemovedInSphinx30Warning)
def visit(self, node): def visit(self, node):
# type: (nodes.Element) -> None # type: (TexinfoTranslator, nodes.Element) -> None
self.visit_admonition(node, admonitionlabels[name]) self.visit_admonition(node, admonitionlabels[name])
return visit return visit

View File

@ -1375,6 +1375,6 @@ class TextTranslator(SphinxTranslator):
RemovedInSphinx30Warning) RemovedInSphinx30Warning)
def depart_admonition(self, node): def depart_admonition(self, node):
# type: (nodes.Element) -> None # type: (TextTranslator, nodes.Element) -> None
self.end_state(first=admonitionlabels[name] + ': ') self.end_state(first=admonitionlabels[name] + ': ')
return depart_admonition return depart_admonition