Merge pull request #6515 from tk0miya/mypy-0.710

Fix mypy violations (for mypy-0.710)
This commit is contained in:
Takeshi KOMIYA authored and GitHub committed 2019-06-21 11:33:11 +09:00
commit bd09f009bf
7 files changed
+11 -10

No files matched your search

+1 -1
View File
@@ -47,7 +47,7 @@ extras_require = {
'html5lib',
'flake8>=3.5.0',
'flake8-import-order',
'mypy>=0.590',
'mypy>=0.710',
'docutils-stubs',
],
}
+5 -4
View File
@@ -910,12 +910,13 @@ class StandardDomain(Domain):
# type: (nodes.Node) -> str
"""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))
elem = cast(nodes.Element, node)
_, title_getter = self.enumerable_nodes.get(elem.__class__, (None, None))
if title_getter:
return title_getter(node)
return title_getter(elem)
else:
for subnode in node:
if subnode.tagname in ('caption', 'title'):
for subnode in elem:
if isinstance(subnode, (nodes.caption, nodes.title)):
return clean_astext(subnode)
return None
+1 -1
View File
@@ -129,7 +129,7 @@ def isenumattribute(x):
def ispartial(obj):
# type: (Any) -> bool
"""Check if the object is partial."""
return isinstance(obj, (partial, partialmethod))
return isinstance(obj, (partial, partialmethod)) # type: ignore
def isclassmethod(obj):
+1 -1
View File
@@ -33,7 +33,7 @@ class PyStemmer(BaseStemmer):
return self.stemmer.stemWord(word)
class StandardStemmer(PorterStemmer, BaseStemmer): # type: ignore
class StandardStemmer(PorterStemmer, BaseStemmer):
"""All those porter stemmer implementations look hideous;
make at least the stem method nicer.
"""
+1 -1
View File
@@ -2598,7 +2598,7 @@ class LaTeXTranslator(SphinxTranslator):
RemovedInSphinx30Warning)
def visit_admonition(self, node):
# type: (nodes.Element) -> None
# type: (LaTeXTranslator, nodes.Element) -> None
self.body.append('\n\\begin{sphinxadmonition}{%s}{%s:}' %
(name, admonitionlabels[name]))
return visit_admonition
+1 -1
View File
@@ -1752,6 +1752,6 @@ class TexinfoTranslator(SphinxTranslator):
RemovedInSphinx30Warning)
def visit(self, node):
# type: (nodes.Element) -> None
# type: (TexinfoTranslator, nodes.Element) -> None
self.visit_admonition(node, admonitionlabels[name])
return visit
+1 -1
View File
@@ -1375,6 +1375,6 @@ class TextTranslator(SphinxTranslator):
RemovedInSphinx30Warning)
def depart_admonition(self, node):
# type: (nodes.Element) -> None
# type: (TextTranslator, nodes.Element) -> None
self.end_state(first=admonitionlabels[name] + ': ')
return depart_admonition