From d50b9b9dce0600c2c4ed68da8d90833b1131caae Mon Sep 17 00:00:00 2001 From: shimizukawa Date: Wed, 16 Nov 2016 10:58:41 +0900 Subject: [PATCH] insert blank line(s) to adapt latest flake8/pycodestyle --- sphinx/addnodes.py | 2 ++ sphinx/apidoc.py | 1 + sphinx/builders/__init__.py | 1 + sphinx/builders/gettext.py | 1 + sphinx/builders/html.py | 1 + sphinx/builders/linkcheck.py | 1 + sphinx/directives/__init__.py | 1 + sphinx/ext/autodoc.py | 1 + sphinx/locale/__init__.py | 1 + sphinx/pycode/__init__.py | 2 ++ sphinx/quickstart.py | 2 ++ sphinx/util/__init__.py | 1 + sphinx/util/console.py | 1 + sphinx/util/i18n.py | 1 + sphinx/util/nodes.py | 1 + sphinx/util/pycompat.py | 1 + sphinx/util/smartypants.py | 2 +- 17 files changed, 20 insertions(+), 1 deletion(-) diff --git a/sphinx/addnodes.py b/sphinx/addnodes.py index 284bc1c75..ac07b3793 100644 --- a/sphinx/addnodes.py +++ b/sphinx/addnodes.py @@ -39,6 +39,8 @@ class desc_signature(nodes.Part, nodes.Inline, nodes.TextElement): class desc_addname(nodes.Part, nodes.Inline, nodes.TextElement): """Node for additional name parts (module name, class name).""" + + # compatibility alias desc_classname = desc_addname diff --git a/sphinx/apidoc.py b/sphinx/apidoc.py index 58724fd5a..90d0e3c8d 100644 --- a/sphinx/apidoc.py +++ b/sphinx/apidoc.py @@ -384,6 +384,7 @@ Note: By default this script will not overwrite already created files.""") elif not opts.notoc: create_modules_toc_file(modules, opts) + # So program can be started with "python -m sphinx.apidoc ..." if __name__ == "__main__": main() diff --git a/sphinx/builders/__init__.py b/sphinx/builders/__init__.py index 8863050ba..d0b6c2ca0 100644 --- a/sphinx/builders/__init__.py +++ b/sphinx/builders/__init__.py @@ -452,6 +452,7 @@ class Builder(object): optname = '%s_%s' % (default, option) return getattr(self.config, optname) + BUILTIN_BUILDERS = { 'dummy': ('dummy', 'DummyBuilder'), 'html': ('html', 'StandaloneHTMLBuilder'), diff --git a/sphinx/builders/gettext.py b/sphinx/builders/gettext.py index a7fea86fa..9edbdf1d3 100644 --- a/sphinx/builders/gettext.py +++ b/sphinx/builders/gettext.py @@ -150,6 +150,7 @@ class LocalTimeZone(tzinfo): def dst(self, dt): return timedelta(0) + ltz = LocalTimeZone() diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index d1f5792e7..f5d8cf549 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -1181,6 +1181,7 @@ class PickleHTMLBuilder(SerializingHTMLBuilder): globalcontext_filename = 'globalcontext.pickle' searchindex_filename = 'searchindex.pickle' + # compatibility alias WebHTMLBuilder = PickleHTMLBuilder diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index 5ceb8d716..bb7967e83 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -48,6 +48,7 @@ class RedirectHandler(HTTPRedirectHandler): req.redirect_code = code return new_req + # create an opener that will simulate a browser user-agent opener = build_opener(RedirectHandler) opener.addheaders = [('User-agent', 'Mozilla/5.0 (X11; Linux x86_64; rv:25.0) ' diff --git a/sphinx/directives/__init__.py b/sphinx/directives/__init__.py index d99a9bc1b..52965c0e2 100644 --- a/sphinx/directives/__init__.py +++ b/sphinx/directives/__init__.py @@ -160,6 +160,7 @@ class ObjectDescription(Directive): self.after_content() return [self.indexnode, node] + # backwards compatible old name DescDirective = ObjectDescription diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index e210e7266..405d24c88 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -131,6 +131,7 @@ def members_set_option(arg): return ALL return set(x.strip() for x in arg.split(',')) + SUPPRESS = object() diff --git a/sphinx/locale/__init__.py b/sphinx/locale/__init__.py index d2d08c628..d6ce7329b 100644 --- a/sphinx/locale/__init__.py +++ b/sphinx/locale/__init__.py @@ -152,6 +152,7 @@ def lazy_gettext(string): # return string return _TranslationProxy(mygettext, string) + l_ = lazy_gettext diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py index 3da887d6c..7746e11b1 100644 --- a/sphinx/pycode/__init__.py +++ b/sphinx/pycode/__init__.py @@ -35,6 +35,8 @@ pydriver = driver.Driver(pygrammar, convert=nodes.convert) # an object with attributes corresponding to token and symbol names class sym: pass + + for k, v in iteritems(pygrammar.symbol2number): setattr(sym, k, v) for k, v in iteritems(token.tok_name): diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py index 751f87bff..108e59352 100644 --- a/sphinx/quickstart.py +++ b/sphinx/quickstart.py @@ -1516,6 +1516,7 @@ def usage(argv, msg=None): print(msg, file=sys.stderr) print(file=sys.stderr) + USAGE = """\ Sphinx v%s Usage: %%prog [options] [projectdir] @@ -1681,5 +1682,6 @@ def main(argv=sys.argv): generate(d) + if __name__ == '__main__': sys.exit(main(sys.argv)) diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index 0c823fb1a..9c5365aa7 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -212,6 +212,7 @@ def copy_extra_entry(source, targetdir, exclude_matchers=()): for file in files: copy_extra_file(os.path.join(root, file), reltargetdir) + _DEBUG_HEADER = '''\ # Sphinx version: %s # Python version: %s (%s) diff --git a/sphinx/util/console.py b/sphinx/util/console.py index 7974ebb2b..593634b11 100644 --- a/sphinx/util/console.py +++ b/sphinx/util/console.py @@ -90,6 +90,7 @@ def create_color_func(name): return colorize(name, text) globals()[name] = inner + _attrs = { 'reset': '39;49;00m', 'bold': '01m', diff --git a/sphinx/util/i18n.py b/sphinx/util/i18n.py index d0cb1f443..5b396820c 100644 --- a/sphinx/util/i18n.py +++ b/sphinx/util/i18n.py @@ -125,6 +125,7 @@ def find_catalog_source_files(locale_dirs, locale, domains=None, gettext_compact return catalogs + # date_format mappings: ustrftime() to bable.dates.format_datetime() date_format_mappings = { '%a': 'EEE', # Weekday as locale’s abbreviated name. diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py index 98f84f2bf..e4a2fd73b 100644 --- a/sphinx/util/nodes.py +++ b/sphinx/util/nodes.py @@ -302,4 +302,5 @@ def _new_copy(self): newnode.line = self.line return newnode + nodes.Element.copy = _new_copy diff --git a/sphinx/util/pycompat.py b/sphinx/util/pycompat.py index 44f51eaeb..4503c34e1 100644 --- a/sphinx/util/pycompat.py +++ b/sphinx/util/pycompat.py @@ -147,6 +147,7 @@ class _DeprecationWrapper(object): return self._deprecated[attr] return getattr(self._mod, attr) + sys.modules[__name__] = _DeprecationWrapper(sys.modules[__name__], dict( zip_longest = zip_longest, product = product, diff --git a/sphinx/util/smartypants.py b/sphinx/util/smartypants.py index 2f4acbc8d..dee2f50ba 100644 --- a/sphinx/util/smartypants.py +++ b/sphinx/util/smartypants.py @@ -81,8 +81,8 @@ def sphinx_smarty_pants(t): t = t.replace('"', '"') return t -# Constants for quote education. +# Constants for quote education. punct_class = r"""[!"#\$\%'()*+,-.\/:;<=>?\@\[\\\]\^_`{|}~]""" end_of_word_class = r"""[\s.,;:!?)]""" close_class = r"""[^\ \t\r\n\[\{\(\-]"""