diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-12-14 21:14:11 +0300 |
---|---|---|
committer | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2018-12-15 17:57:43 +0300 |
commit | 6bc357140dbb074eb0d590c1226009f83f97862e (patch) | |
tree | a7c8d2087ee1f50dadb5ca78343ac10c6959b740 /sphinx/ext/graphviz.py | |
parent | 0031c9b4822ae9684888ae90bc70d6ceb3313581 (diff) |
Replace all "unicode" type by "str"
Diffstat (limited to 'sphinx/ext/graphviz.py')
-rw-r--r-- | sphinx/ext/graphviz.py | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/sphinx/ext/graphviz.py b/sphinx/ext/graphviz.py index 3532377b1..878e4bfc3 100644 --- a/sphinx/ext/graphviz.py +++ b/sphinx/ext/graphviz.py @@ -36,7 +36,6 @@ if False: from typing import Any, Dict, List, Tuple # NOQA from sphinx.application import Sphinx # NOQA from sphinx.util.docutils import SphinxTranslator # NOQA - from sphinx.util.typing import unicode # NOQA from sphinx.writers.html import HTMLTranslator # NOQA from sphinx.writers.latex import LaTeXTranslator # NOQA from sphinx.writers.manpage import ManualPageTranslator # NOQA @@ -56,16 +55,16 @@ class ClickableMapDefinition: href_re = re.compile('href=".*?"') def __init__(self, filename, content, dot=''): - # type: (unicode, unicode, unicode) -> None - self.id = None # type: unicode + # type: (str, str, str) -> None + self.id = None # type: str self.filename = filename self.content = content.splitlines() - self.clickable = [] # type: List[unicode] + self.clickable = [] # type: List[str] self.parse(dot=dot) def parse(self, dot=None): - # type: (unicode) -> None + # type: (str) -> None matched = self.maptag_re.match(self.content[0]) if not matched: raise GraphvizError('Invalid clickable map file found: %s' % self.filename) @@ -83,7 +82,7 @@ class ClickableMapDefinition: self.clickable.append(line) def generate_clickable_map(self): - # type: () -> unicode + # type: () -> str """Generate clickable map tags if clickable item exists. If not exists, this only returns empty string. @@ -99,7 +98,7 @@ class graphviz(nodes.General, nodes.Inline, nodes.Element): def figure_wrapper(directive, node, caption): - # type: (Directive, graphviz, unicode) -> nodes.figure + # type: (Directive, graphviz, str) -> nodes.figure figure_node = nodes.figure('', node) if 'align' in node: figure_node['align'] = node.attributes.pop('align') @@ -218,7 +217,7 @@ class GraphvizSimple(SphinxDirective): def render_dot(self, code, options, format, prefix='graphviz'): - # type: (SphinxTranslator, unicode, Dict, unicode, unicode) -> Tuple[unicode, unicode] # NOQA + # type: (SphinxTranslator, str, Dict, str, str) -> Tuple[str, str] """Render graphviz code into a PNG or PDF output file.""" graphviz_dot = options.get('graphviz_dot', self.builder.config.graphviz_dot) hashkey = (code + str(options) + str(graphviz_dot) + @@ -279,7 +278,7 @@ def render_dot(self, code, options, format, prefix='graphviz'): def render_dot_html(self, node, code, options, prefix='graphviz', imgcls=None, alt=None): - # type: (HTMLTranslator, graphviz, unicode, Dict, unicode, unicode, unicode) -> Tuple[unicode, unicode] # NOQA + # type: (HTMLTranslator, graphviz, str, Dict, str, str, str) -> Tuple[str, str] format = self.builder.config.graphviz_output_format try: if format not in ('png', 'svg'): @@ -337,7 +336,7 @@ def html_visit_graphviz(self, node): def render_dot_latex(self, node, code, options, prefix='graphviz'): - # type: (LaTeXTranslator, graphviz, unicode, Dict, unicode) -> None + # type: (LaTeXTranslator, graphviz, str, Dict, str) -> None try: fname, outfn = render_dot(self, code, options, 'pdf', prefix) except GraphvizError as exc: @@ -375,7 +374,7 @@ def latex_visit_graphviz(self, node): def render_dot_texinfo(self, node, code, options, prefix='graphviz'): - # type: (TexinfoTranslator, graphviz, unicode, Dict, unicode) -> None + # type: (TexinfoTranslator, graphviz, str, Dict, str) -> None try: fname, outfn = render_dot(self, code, options, 'png', prefix) except GraphvizError as exc: @@ -418,7 +417,7 @@ def on_build_finished(app, exc): def setup(app): - # type: (Sphinx) -> Dict[unicode, Any] + # type: (Sphinx) -> Dict[str, Any] app.add_node(graphviz, html=(html_visit_graphviz, None), latex=(latex_visit_graphviz, None), |