diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2018-12-11 17:46:04 +0300 |
---|---|---|
committer | Jon Dufresne <jon.dufresne@gmail.com> | 2018-12-11 17:50:20 +0300 |
commit | 8bb73c9fd3555deb83f01e1d18fa10c563202f78 (patch) | |
tree | affde9d2c1580e38138c860cd298b384cfde5b96 /sphinx/ext/graphviz.py | |
parent | 689b9ffd047b12b0fe30e2b25bbc3f50f4756785 (diff) |
Simplify open() call by removing default mode
The open() function opens files in read-only text mode by default. Drop
the mode argument to be slightly simpler and more idiomatic.
https://docs.python.org/3/library/functions.html#open
> The default mode is 'r' (open for reading text, synonym of 'rt').
Diffstat (limited to 'sphinx/ext/graphviz.py')
-rw-r--r-- | sphinx/ext/graphviz.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sphinx/ext/graphviz.py b/sphinx/ext/graphviz.py index 3c0cbed68..f0ffcf3ef 100644 --- a/sphinx/ext/graphviz.py +++ b/sphinx/ext/graphviz.py @@ -145,7 +145,7 @@ class Graphviz(SphinxDirective): rel_filename, filename = self.env.relfn2path(argument) self.env.note_dependency(rel_filename) try: - with open(filename, 'r', encoding='utf-8') as fp: # type: ignore + with open(filename, encoding='utf-8') as fp: # type: ignore dotcode = fp.read() except (IOError, OSError): return [document.reporter.warning( @@ -310,7 +310,7 @@ def render_dot_html(self, node, code, options, prefix='graphviz', self.body.append('<p class="warning">%s</p>' % alt) self.body.append('</object></div>\n') else: - with open(outfn + '.map', 'r', encoding='utf-8') as mapfile: # type: ignore + with open(outfn + '.map', encoding='utf-8') as mapfile: # type: ignore imgmap = ClickableMapDefinition(outfn + '.map', mapfile.read(), dot=code) if imgmap.clickable: # has a map |