mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Make MyPy happy
This commit is contained in:
parent
b32841e153
commit
dc3f22a370
@ -287,14 +287,14 @@ class HTML4Translator(SphinxTranslator, BaseTranslator):
|
|||||||
else:
|
else:
|
||||||
key = figtype
|
key = figtype
|
||||||
|
|
||||||
if figure_id in self.builder.fignumbers.get(key, {}):
|
if figure_id in self.builder.fignumbers.get(key, {}): # type: ignore[has-type]
|
||||||
self.body.append('<span class="caption-number">')
|
self.body.append('<span class="caption-number">')
|
||||||
prefix = self.config.numfig_format.get(figtype)
|
prefix = self.config.numfig_format.get(figtype)
|
||||||
if prefix is None:
|
if prefix is None:
|
||||||
msg = __('numfig_format is not defined for %s') % figtype
|
msg = __('numfig_format is not defined for %s') % figtype
|
||||||
logger.warning(msg)
|
logger.warning(msg)
|
||||||
else:
|
else:
|
||||||
numbers = self.builder.fignumbers[key][figure_id]
|
numbers = self.builder.fignumbers[key][figure_id] # type: ignore[has-type]
|
||||||
self.body.append(prefix % '.'.join(map(str, numbers)) + ' ')
|
self.body.append(prefix % '.'.join(map(str, numbers)) + ' ')
|
||||||
self.body.append('</span>')
|
self.body.append('</span>')
|
||||||
|
|
||||||
@ -569,7 +569,7 @@ class HTML4Translator(SphinxTranslator, BaseTranslator):
|
|||||||
self.context.append('</a>')
|
self.context.append('</a>')
|
||||||
elif 'filename' in node:
|
elif 'filename' in node:
|
||||||
atts['class'] += ' internal'
|
atts['class'] += ' internal'
|
||||||
atts['href'] = posixpath.join(self.builder.dlpath,
|
atts['href'] = posixpath.join(self.builder.dlpath, # type: ignore[has-type]
|
||||||
urllib.parse.quote(node['filename']))
|
urllib.parse.quote(node['filename']))
|
||||||
self.body.append(self.starttag(node, 'a', '', **atts))
|
self.body.append(self.starttag(node, 'a', '', **atts))
|
||||||
self.context.append('</a>')
|
self.context.append('</a>')
|
||||||
|
@ -293,14 +293,14 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
|
|||||||
else:
|
else:
|
||||||
key = figtype
|
key = figtype
|
||||||
|
|
||||||
if figure_id in self.builder.fignumbers.get(key, {}):
|
if figure_id in self.builder.fignumbers.get(key, {}): # type: ignore[has-type]
|
||||||
self.body.append('<span class="caption-number">')
|
self.body.append('<span class="caption-number">')
|
||||||
prefix = self.config.numfig_format.get(figtype)
|
prefix = self.config.numfig_format.get(figtype)
|
||||||
if prefix is None:
|
if prefix is None:
|
||||||
msg = __('numfig_format is not defined for %s') % figtype
|
msg = __('numfig_format is not defined for %s') % figtype
|
||||||
logger.warning(msg)
|
logger.warning(msg)
|
||||||
else:
|
else:
|
||||||
numbers = self.builder.fignumbers[key][figure_id]
|
numbers = self.builder.fignumbers[key][figure_id] # type: ignore[has-type]
|
||||||
self.body.append(prefix % '.'.join(map(str, numbers)) + ' ')
|
self.body.append(prefix % '.'.join(map(str, numbers)) + ' ')
|
||||||
self.body.append('</span>')
|
self.body.append('</span>')
|
||||||
|
|
||||||
@ -544,7 +544,7 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
|
|||||||
self.context.append('</a>')
|
self.context.append('</a>')
|
||||||
elif 'filename' in node:
|
elif 'filename' in node:
|
||||||
atts['class'] += ' internal'
|
atts['class'] += ' internal'
|
||||||
atts['href'] = posixpath.join(self.builder.dlpath,
|
atts['href'] = posixpath.join(self.builder.dlpath, # type: ignore[has-type]
|
||||||
urllib.parse.quote(node['filename']))
|
urllib.parse.quote(node['filename']))
|
||||||
self.body.append(self.starttag(node, 'a', '', **atts))
|
self.body.append(self.starttag(node, 'a', '', **atts))
|
||||||
self.context.append('</a>')
|
self.context.append('</a>')
|
||||||
|
Loading…
Reference in New Issue
Block a user