From 55b28b01984b51c0f25d8f4d6272afbd6aa28527 Mon Sep 17 00:00:00 2001 From: Jonathan Waltman Date: Sat, 3 Nov 2012 11:04:32 -0500 Subject: [PATCH] Fix whitespace / line length issues reported by "make test" --- doc/ext/linkcode.rst | 10 +++++----- sphinx/builders/linkcheck.py | 3 ++- sphinx/ext/graphviz.py | 2 +- sphinx/quickstart.py | 2 +- sphinx/util/nodes.py | 6 +++--- sphinx/util/osutil.py | 2 +- sphinx/writers/latex.py | 8 +++++--- 7 files changed, 18 insertions(+), 15 deletions(-) diff --git a/doc/ext/linkcode.rst b/doc/ext/linkcode.rst index f05a46f92..a69a5b1c5 100644 --- a/doc/ext/linkcode.rst +++ b/doc/ext/linkcode.rst @@ -13,14 +13,14 @@ somewhere on the web. The intent is similar to the ``sphinx.ext.viewcode`` extension, but assumes the source code can be found somewhere on the Internet. -In your configuration, you need to specify a :confval:`linkcode_resolve` +In your configuration, you need to specify a :confval:`linkcode_resolve` function that returns an URL based on the object. .. confval:: linkcode_resolve This is a function ``linkcode_resolve(domain, info)``, which should return the URL to source code corresponding to - the object in given domain with given information. + the object in given domain with given information. The function should return ``None`` if no link is to be added. @@ -40,7 +40,7 @@ function that returns an URL based on the object. def linkcode_resolve(domain, info): if domain != 'py': return None - if not info['module']: - return None - filename = info['module'].replace('.', '/') + if not info['module']: + return None + filename = info['module'].replace('.', '/') return "http://somesite/sourcerepo/%s.py" % filename diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index a8adcdac7..bcf42741d 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -102,7 +102,8 @@ class CheckExternalLinksBuilder(Builder): def check(): # check for various conditions without bothering the network - if len(uri) == 0 or uri[0] == '#' or uri[0:7] == 'mailto:' or uri[0:4] == 'ftp:': + if len(uri) == 0 or uri[0] == '#' or \ + uri[0:7] == 'mailto:' or uri[0:4] == 'ftp:': return 'unchecked', '' elif not (uri[0:5] == 'http:' or uri[0:6] == 'https:'): return 'local', '' diff --git a/sphinx/ext/graphviz.py b/sphinx/ext/graphviz.py index 3cb289a96..593c76e34 100644 --- a/sphinx/ext/graphviz.py +++ b/sphinx/ext/graphviz.py @@ -125,7 +125,7 @@ def render_dot(self, code, options, format, prefix='graphviz'): str(self.builder.config.graphviz_dot) + \ str(self.builder.config.graphviz_dot_args) ).encode('utf-8') - + fname = '%s-%s.%s' % (prefix, sha(hashkey).hexdigest(), format) if hasattr(self.builder, 'imgpath'): # HTML diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py index 3adccdecf..38daa36c8 100644 --- a/sphinx/quickstart.py +++ b/sphinx/quickstart.py @@ -401,7 +401,7 @@ help: \t@echo " epub to make an epub" \t@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" \t@echo " latexpdf to make LaTeX files and run them through pdflatex" -\t@echo " latexpdfja to make LaTeX files and run them through platex and dvipdfmx" +\t@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" \t@echo " text to make text files" \t@echo " man to make manual pages" \t@echo " texinfo to make Texinfo files" diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py index da7413f14..62796bece 100644 --- a/sphinx/util/nodes.py +++ b/sphinx/util/nodes.py @@ -44,14 +44,14 @@ def extract_messages(doctree): """Extract translatable messages from a document tree.""" for node in doctree.traverse(nodes.TextElement): # workaround: nodes.term doesn't have source, line and rawsource - # It should be fixed in Docutils. There is a patch for it in Docutils - # tracker: https://sourceforge.net/tracker/?func=detail&aid=3548418&group_id=38414&atid=422032 + # (fixed in Docutils r7495) if isinstance(node, nodes.term) and not node.source: definition_list_item = node.parent if definition_list_item.line is not None: node.source = definition_list_item.source node.line = definition_list_item.line - 1 - node.rawsource = definition_list_item.rawsource.split("\n", 2)[0] + node.rawsource = definition_list_item.\ + rawsource.split("\n", 2)[0] if not node.source: continue # built-in message if isinstance(node, IGNORED_NODES): diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py index 64ce74234..8ecfe692b 100644 --- a/sphinx/util/osutil.py +++ b/sphinx/util/osutil.py @@ -51,7 +51,7 @@ def relative_uri(base, to): # returns '', not 'index.html' return '' if len(b2) == 1 and t2 == ['']: - # Special case: relative_uri('f/index.html','f/') should + # Special case: relative_uri('f/index.html','f/') should # return './', not '' return '.' + SEP return ('..' + SEP) * (len(b2)-1) + SEP.join(t2) diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index cc679c5e8..aadf44011 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -100,8 +100,9 @@ class LaTeXWriter(writers.Writer): class ExtBabel(Babel): def get_shorthandoff(self): shortlang = self.language.split('_')[0] - if shortlang in ('de', 'ngerman', 'sl', 'slovene', 'pt', 'portuges', 'es', 'spanish', - 'nl', 'dutch', 'pl', 'polish', 'it', 'italian'): + if shortlang in ('de', 'ngerman', 'sl', 'slovene', 'pt', 'portuges', + 'es', 'spanish', 'nl', 'dutch', 'pl', 'polish', 'it', + 'italian'): return '\\shorthandoff{"}' return '' @@ -217,7 +218,8 @@ class LaTeXTranslator(nodes.NodeVisitor): # allow the user to override them all self.elements.update(builder.config.latex_elements) if self.elements['extraclassoptions']: - self.elements['classoptions'] += ',' + self.elements['extraclassoptions'] + self.elements['classoptions'] += ',' + \ + self.elements['extraclassoptions'] self.highlighter = highlighting.PygmentsBridge('latex', builder.config.pygments_style, builder.config.trim_doctest_flags)