Rev 6613: Fix pep8 issues in bzrlib_doc_generate. in file:///home/vila/src/bzr/experimental/py3/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Wed Sep 2 10:23:42 UTC 2015
At file:///home/vila/src/bzr/experimental/py3/
------------------------------------------------------------
revno: 6613
revision-id: v.ladeuil+lp at free.fr-20150902102342-2av807suiysxqv6w
parent: v.ladeuil+lp at free.fr-20150902101320-q12lpv52bdfkwycm
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: pep8
timestamp: Wed 2015-09-02 12:23:42 +0200
message:
Fix pep8 issues in bzrlib_doc_generate.
-------------- next part --------------
=== modified file 'bzrlib/doc_generate/__init__.py'
--- a/bzrlib/doc_generate/__init__.py 2011-12-18 15:28:38 +0000
+++ b/bzrlib/doc_generate/__init__.py 2015-09-02 10:23:42 +0000
@@ -24,4 +24,3 @@
for comp in components[1:]:
mod = getattr(mod, comp)
return mod
-
=== modified file 'bzrlib/doc_generate/autodoc_bash_completion.py'
--- a/bzrlib/doc_generate/autodoc_bash_completion.py 2011-12-19 13:23:58 +0000
+++ b/bzrlib/doc_generate/autodoc_bash_completion.py 2015-09-02 10:23:42 +0000
@@ -32,12 +32,11 @@
def infogen(options, outfile):
t = time.time()
tt = time.gmtime(t)
- params = \
- { "bzrcmd": options.bzr_name,
- "datestamp": time.strftime("%Y-%m-%d",tt),
- "timestamp": time.strftime("%Y-%m-%d %H:%M:%S +0000",tt),
- "version": bzrlib.__version__,
- }
+ params = {"bzrcmd": options.bzr_name,
+ "datestamp": time.strftime("%Y-%m-%d", tt),
+ "timestamp": time.strftime("%Y-%m-%d %H:%M:%S +0000", tt),
+ "version": bzrlib.__version__,
+ }
outfile.write(preamble % params)
@@ -50,4 +49,3 @@
#
# Generation time: %(timestamp)s
"""
-
=== modified file 'bzrlib/doc_generate/autodoc_man.py'
--- a/bzrlib/doc_generate/autodoc_man.py 2015-03-14 23:44:01 +0000
+++ b/bzrlib/doc_generate/autodoc_man.py 2015-09-02 10:23:42 +0000
@@ -46,12 +46,11 @@
"""Assembles a man page"""
t = time.time()
tt = time.gmtime(t)
- params = \
- { "bzrcmd": options.bzr_name,
- "datestamp": time.strftime("%Y-%m-%d",tt),
- "timestamp": time.strftime("%Y-%m-%d %H:%M:%S +0000",tt),
- "version": bzrlib.__version__,
- }
+ params = {"bzrcmd": options.bzr_name,
+ "datestamp": time.strftime("%Y-%m-%d", tt),
+ "timestamp": time.strftime("%Y-%m-%d %H:%M:%S +0000", tt),
+ "version": bzrlib.__version__,
+ }
outfile.write(man_preamble % params)
outfile.write(man_escape(man_head % params))
outfile.write(man_escape(getcommand_list(params)))
@@ -62,10 +61,10 @@
def man_escape(string):
"""Escapes strings for man page compatibility"""
- result = string.replace("\\","\\\\")
- result = result.replace("`","\\'")
- result = result.replace("'","\\*(Aq")
- result = result.replace("-","\\-")
+ result = string.replace("\\", "\\\\")
+ result = result.replace("`", "\\'")
+ result = result.replace("'", "\\*(Aq")
+ result = result.replace("-", "\\-")
return result
@@ -75,15 +74,14 @@
for cmdname in bzrlib.commands.plugin_command_names():
cmd_object = bzrlib.commands.get_cmd_object(cmdname)
if (PLUGINS_TO_DOCUMENT is None or
- cmd_object.plugin_name() in PLUGINS_TO_DOCUMENT):
+ cmd_object.plugin_name() in PLUGINS_TO_DOCUMENT):
command_names.append(cmdname)
command_names.sort()
return command_names
-def getcommand_list (params):
+def getcommand_list(params):
"""Builds summary help for command names in manpage format"""
- bzrcmd = params["bzrcmd"]
output = '.SH "COMMAND OVERVIEW"\n'
for cmd_name in command_name_list():
cmd_object = bzrlib.commands.get_cmd_object(cmd_name)
@@ -96,13 +94,13 @@
tmp = '.TP\n.B "%s"\n%s\n' % (usage, firstline)
output = output + tmp
else:
- raise RuntimeError, "Command '%s' has no help text" % (cmd_name)
+ raise RuntimeError("Command '%s' has no help text" % (cmd_name))
return output
def getcommand_help(params):
"""Shows individual options for a bzr command"""
- output='.SH "COMMAND REFERENCE"\n'
+ output = '.SH "COMMAND REFERENCE"\n'
formatted = {}
for cmd_name in command_name_list():
cmd_object = bzrlib.commands.get_cmd_object(cmd_name)
@@ -141,10 +139,9 @@
if short_name:
l += ', -' + short_name
l += (30 - len(l)) * ' ' + (help or '')
- wrapped = textwrap.fill(l, initial_indent='',
- subsequent_indent=30*' ',
- break_long_words=False,
- )
+ wrapped = textwrap.fill(
+ l, initial_indent='', subsequent_indent=30*' ',
+ break_long_words=False)
option_str += wrapped + '\n'
aliases_str = ""
@@ -163,7 +160,8 @@
see_also_str += ', '.join(see_also)
see_also_str += '\n'
- return subsection_header + option_str + aliases_str + see_also_str + "\n" + doc + "\n"
+ return (subsection_header + option_str + aliases_str + see_also_str + "\n"
+ + doc + "\n")
def format_alias(params, alias, cmd_name):
@@ -214,9 +212,9 @@
.I "command"
.SH "DESCRIPTION"
-Bazaar (or %(bzrcmd)s) is a distributed version control system that is powerful,
-friendly, and scalable. Bazaar is a project of Canonical Ltd and part of
-the GNU Project to develop a free operating system.
+Bazaar (or %(bzrcmd)s) is a distributed version control system that is
+powerful, friendly, and scalable. Bazaar is a project of Canonical Ltd and
+part of the GNU Project to develop a free operating system.
Bazaar keeps track of changes to software source code (or similar information);
lets you explore who changed it, when, and why; merges concurrent changes; and
@@ -251,4 +249,3 @@
.UR http://bazaar.canonical.com/
.BR http://bazaar.canonical.com/
"""
-
=== modified file 'bzrlib/doc_generate/autodoc_rstx.py'
--- a/bzrlib/doc_generate/autodoc_rstx.py 2015-03-14 23:44:01 +0000
+++ b/bzrlib/doc_generate/autodoc_rstx.py 2015-09-02 10:23:42 +0000
@@ -40,12 +40,11 @@
"""Create manual in RSTX format"""
t = time.time()
tt = time.gmtime(t)
- params = \
- { "bzrcmd": options.bzr_name,
- "datestamp": time.strftime("%Y-%m-%d",tt),
- "timestamp": time.strftime("%Y-%m-%d %H:%M:%S +0000",tt),
- "version": bzrlib.__version__,
- }
+ params = {"bzrcmd": options.bzr_name,
+ "datestamp": time.strftime("%Y-%m-%d", tt),
+ "timestamp": time.strftime("%Y-%m-%d %H:%M:%S +0000", tt),
+ "version": bzrlib.__version__,
+ }
nominated_filename = getattr(options, 'filename', None)
if nominated_filename is None:
topic_dir = None
@@ -59,21 +58,24 @@
def _get_body(params, topic_dir):
"""Build the manual content."""
- from bzrlib.help_topics import SECT_CONCEPT, SECT_LIST, SECT_PLUGIN
+ from bzrlib.help_topics import (
+ SECT_CONCEPT,
+ SECT_LIST,
+ )
registry = bzrlib.help_topics.topic_registry
result = []
result.append(_get_section(registry, SECT_CONCEPT, "Concepts",
- output_dir=topic_dir))
+ output_dir=topic_dir))
result.append(_get_section(registry, SECT_LIST, "Lists",
- output_dir=topic_dir))
+ output_dir=topic_dir))
result.append(_get_commands_section(registry, output_dir=topic_dir))
return "\n".join(result)
def _get_section(registry, section, title, hdg_level1="#", hdg_level2="=",
- output_dir=None):
+ output_dir=None):
"""Build the manual part from topics matching that section.
-
+
If output_dir is not None, topics are dumped into text files there
during processing, as well as being included in the return result.
"""
@@ -101,7 +103,7 @@
def _get_commands_section(registry, title="Commands", hdg_level1="#",
- hdg_level2="=", output_dir=None):
+ hdg_level2="=", output_dir=None):
"""Build the commands reference section of the manual."""
file_per_topic = output_dir is not None
lines = [title, hdg_level1 * len(title), ""]
@@ -130,9 +132,8 @@
"""Dump text for a topic to a file."""
topic_id = "%s-%s" % (topic, "help")
filename = bzrlib.osutils.pathjoin(output_dir, topic_id + ".txt")
- f = open(filename, "w")
- f.write(text)
- f.close()
+ with open(filename, "w") as f:
+ f.write(text)
return topic_id
=== modified file 'bzrlib/doc_generate/conf.py'
--- a/bzrlib/doc_generate/conf.py 2012-03-09 16:48:55 +0000
+++ b/bzrlib/doc_generate/conf.py 2015-09-02 10:23:42 +0000
@@ -14,14 +14,14 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
-#sys.path.append(os.path.abspath('.'))
-
-
-# -- General configuration -----------------------------------------------------
-
-# Add any Sphinx extension module names here, as strings. They can be extensions
-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ['sphinx.ext.ifconfig',]
+# sys.path.append(os.path.abspath('.'))
+
+
+# -- General configuration ----------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.ifconfig']
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@@ -30,7 +30,7 @@
source_suffix = '.txt'
# The encoding of source files.
-#source_encoding = 'utf-8'
+# source_encoding = 'utf-8'
# The master toctree document.
master_doc = 'index'
@@ -51,43 +51,44 @@
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
-#language = None
+# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
-#today = ''
+# today = ''
# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
+# today_fmt = '%B %d, %Y'
# List of documents that shouldn't be included in the build.
-#unused_docs = []
+# unused_docs = []
# List of directories, relative to source directory, that shouldn't be searched
# for source files.
exclude_trees = ['_build']
-# The reST default role (used for this markup: `text`) to use for all documents.
-#default_role = None
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
+# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
+# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
-#add_module_names = True
+# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
-#show_authors = False
+# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
-
-
-# -- Options for HTML output ---------------------------------------------------
+# modindex_common_prefix = []
+
+
+# -- Options for HTML output --------------------------------------------------
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
@@ -100,7 +101,7 @@
# Unfortunately, the right sidebar breaks under IE6 and maybe IE7.
# So we stick with the default left placement to cater for users stuck
# on those browsers.
- #'rightsidebar': True,
+ # 'rightsidebar': True,
# Non-document areas: header (relbar), footer, sidebar, etc.
# Some useful colours here:
@@ -119,18 +120,18 @@
}
# Add any paths that contain custom themes here, relative to this directory.
-#html_theme_path = []
+# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation".
-#html_title = None
+# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
+# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
-#html_logo = None
+# html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
@@ -144,18 +145,18 @@
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
+# html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
-#html_use_smartypants = True
+# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
+# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
-#html_additional_pages = {}
+# html_additional_pages = {}
# If false, no module index is generated.
html_use_modindex = False
@@ -164,7 +165,7 @@
html_use_index = False
# If true, the index is split into individual pages for each letter.
-#html_split_index = False
+# html_split_index = False
# If true, links to the reST sources are added to the pages.
html_show_sourcelink = True
@@ -172,25 +173,26 @@
# If true, an OpenSearch description file will be output, and all pages will
# contain a <link> tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
+# html_use_opensearch = ''
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = ''
+# html_file_suffix = ''
# Output file base name for HTML help builder.
htmlhelp_basename = 'bzr-docs'
-# -- Options for LaTeX output --------------------------------------------------
+# -- Options for LaTeX output -------------------------------------------------
# The paper size ('letter' or 'a4').
-#latex_paper_size = 'letter'
+# latex_paper_size = 'letter'
# The font size ('10pt', '11pt' or '12pt').
-#latex_font_size = '10pt'
+# latex_font_size = '10pt'
# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title, author, documentclass [howto/manual]).
+# (source start file, target name, title, author,
+# documentclass [howto/manual]).
latex_documents = []
# The name of an image file (relative to this directory) to place at the top of
@@ -199,19 +201,19 @@
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
-#latex_use_parts = False
+# latex_use_parts = False
# Additional stuff for the LaTeX preamble.
-#latex_preamble = ''
+# latex_preamble = ''
# Documents to append as an appendix to all manuals.
-#latex_appendices = []
+# latex_appendices = []
# If false, no module index is generated.
-#latex_use_modindex = True
-
-
-# -- Bazaar-specific configuration ---------------------------------------------
+# latex_use_modindex = True
+
+
+# -- Bazaar-specific configuration --------------------------------------------
# Authors of the documents
bzr_team = u'Bazaar Developers'
More information about the bazaar-commits
mailing list