PEP8 issues fixed

Fix some PEP8 issues in file doc/source/conf.py to make the code more
pretty.

Change-Id: I2efdb39c8991bf0cae180f7c4ffd459f6b418fc5
This commit is contained in:
Ray Chen 2012-08-23 15:44:16 +08:00
parent be20419d77
commit b177299953

View File

@ -3,7 +3,8 @@
# Horizon documentation build configuration file, created by # Horizon documentation build configuration file, created by
# sphinx-quickstart on Thu Oct 27 11:38:59 2011. # sphinx-quickstart on Thu Oct 27 11:38:59 2011.
# #
# This file is execfile()d with the current directory set to its containing dir. # This file is execfile()d with the current directory set to its
# containing dir.
# #
# Note that not all possible configuration values are present in this # Note that not all possible configuration values are present in this
# autogenerated file. # autogenerated file.
@ -65,7 +66,8 @@ def write_autodoc_index():
INDEXOUT.write("=================\n") INDEXOUT.write("=================\n")
for modulename, path in SRCS.items(): for modulename, path in SRCS.items():
sys.stdout.write("Generating source documentation for %s\n" % modulename) sys.stdout.write("Generating source documentation for %s\n" %
modulename)
INDEXOUT.write("\n%s\n" % modulename.capitalize()) INDEXOUT.write("\n%s\n" % modulename.capitalize())
INDEXOUT.write("%s\n" % ("=" * len(modulename),)) INDEXOUT.write("%s\n" % ("=" * len(modulename),))
INDEXOUT.write(".. toctree::\n") INDEXOUT.write(".. toctree::\n")
@ -77,7 +79,8 @@ def write_autodoc_index():
if not(os.path.exists(MOD_DIR)): if not(os.path.exists(MOD_DIR)):
os.mkdir(MOD_DIR) os.mkdir(MOD_DIR)
for module in find_autodoc_modules(modulename, path): for module in find_autodoc_modules(modulename, path):
if any([module.startswith(exclude) for exclude in EXCLUDED_MODULES]): if any([module.startswith(exclude) for exclude \
in EXCLUDED_MODULES]):
print "Excluded module %s." % module print "Excluded module %s." % module
continue continue
mod_path = os.path.join(path, *module.split(".")) mod_path = os.path.join(path, *module.split("."))
@ -87,7 +90,8 @@ def write_autodoc_index():
# Find the __init__.py module if this is a directory # Find the __init__.py module if this is a directory
if os.path.isdir(mod_path): if os.path.isdir(mod_path):
source_file = ".".join((os.path.join(mod_path, "__init__"), "py",)) source_file = ".".join((os.path.join(mod_path, "__init__"),
"py",))
else: else:
source_file = ".".join((os.path.join(mod_path), "py")) source_file = ".".join((os.path.join(mod_path), "py"))
@ -95,8 +99,10 @@ def write_autodoc_index():
# Only generate a new file if the source has changed or we don't # Only generate a new file if the source has changed or we don't
# have a doc file to begin with. # have a doc file to begin with.
if not os.access(generated_file, os.F_OK) or \ if not os.access(generated_file, os.F_OK) or \
os.stat(generated_file).st_mtime < os.stat(source_file).st_mtime: os.stat(generated_file).st_mtime < \
print "Module %s updated, generating new documentation." % module os.stat(source_file).st_mtime:
print "Module %s updated, generating new documentation." \
% module
FILEOUT = open(generated_file, "w") FILEOUT = open(generated_file, "w")
header = "The :mod:`%s` Module" % module header = "The :mod:`%s` Module" % module
FILEOUT.write("%s\n" % ("=" * len(header),)) FILEOUT.write("%s\n" % ("=" * len(header),))
@ -126,13 +132,14 @@ write_autodoc_index()
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.')) #sys.path.insert(0, os.path.abspath('.'))
# -- General configuration ----------------------------------------------------- # -- General configuration ----------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here. # If your documentation needs a minimal Sphinx version, state it here.
#needs_sphinx = '1.0' #needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions # Add any Sphinx extension module names here, as strings.
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # They can be extensions coming with Sphinx (named 'sphinx.ext.*')
# or your custom ones.
extensions = ['sphinx.ext.autodoc', extensions = ['sphinx.ext.autodoc',
'sphinx.ext.intersphinx', 'sphinx.ext.intersphinx',
'sphinx.ext.todo', 'sphinx.ext.todo',
@ -182,7 +189,8 @@ release = horizon.version.canonical_version_string()
# directories to ignore when looking for source files. # directories to ignore when looking for source files.
exclude_patterns = ['**/#*', '**~', '**/#*#'] exclude_patterns = ['**/#*', '**~', '**/#*#']
# The reST default role (used for this markup: `text`) to use for all documents. # The reST default role (used for this markup: `text`)
# to use for all documents.
#default_role = None #default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text. # If true, '()' will be appended to :func: etc. cross-reference text.
@ -206,7 +214,7 @@ primary_domain = 'py'
nitpicky = False nitpicky = False
# -- Options for HTML output --------------------------------------------------- # -- Options for HTML output --------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
@ -291,7 +299,7 @@ html_last_updated_fmt = os.popen(git_cmd).read()
htmlhelp_basename = 'Horizondoc' htmlhelp_basename = 'Horizondoc'
# -- Options for LaTeX output -------------------------------------------------- # -- Options for LaTeX output -------------------------------------------------
latex_elements = { latex_elements = {
# The paper size ('letterpaper' or 'a4paper'). # The paper size ('letterpaper' or 'a4paper').
@ -305,10 +313,11 @@ latex_elements = {
} }
# Grouping the document tree into LaTeX files. List of tuples # 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 = [ latex_documents = [
('index', 'Horizon.tex', u'Horizon Documentation', ('index', 'Horizon.tex', u'Horizon Documentation',
u'OpenStack, LLC', 'manual'), u'OpenStack, LLC', 'manual'),
] ]
# The name of an image file (relative to this directory) to place at the top of # The name of an image file (relative to this directory) to place at the top of
@ -332,7 +341,7 @@ latex_documents = [
#latex_domain_indices = True #latex_domain_indices = True
# -- Options for manual page output -------------------------------------------- # -- Options for manual page output -------------------------------------------
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section). # (source start file, name, description, authors, manual section).
@ -345,14 +354,14 @@ man_pages = [
#man_show_urls = False #man_show_urls = False
# -- Options for Texinfo output ------------------------------------------------ # -- Options for Texinfo output -----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples # Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author, # (source start file, target name, title, author,
# dir menu entry, description, category) # dir menu entry, description, category)
texinfo_documents = [ texinfo_documents = [
('index', 'Horizon', u'Horizon Documentation', u'OpenStack', ('index', 'Horizon', u'Horizon Documentation', u'OpenStack',
'Horizon', 'One line description of project.', 'Miscellaneous'), 'Horizon', 'One line description of project.', 'Miscellaneous'),
] ]
# Documents to append as an appendix to all manuals. # Documents to append as an appendix to all manuals.
@ -365,7 +374,7 @@ texinfo_documents = [
#texinfo_show_urls = 'footnote' #texinfo_show_urls = 'footnote'
# -- Options for Epub output --------------------------------------------------- # -- Options for Epub output --------------------------------------------------
# Bibliographic Dublin Core info. # Bibliographic Dublin Core info.
epub_title = u'Horizon' epub_title = u'Horizon'
@ -410,7 +419,8 @@ epub_copyright = u'2012, OpenStack'
# Example configuration for intersphinx: refer to the Python standard library. # Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'python': ('http://docs.python.org/', None), intersphinx_mapping = {'python': ('http://docs.python.org/', None),
'django': ('http://docs.djangoproject.com/en/dev/_objects/'), 'django':
('http://docs.djangoproject.com/en/dev/_objects/'),
'nova': ('http://nova.openstack.org', None), 'nova': ('http://nova.openstack.org', None),
'swift': ('http://swift.openstack.org', None), 'swift': ('http://swift.openstack.org', None),
'keystone': ('http://keystone.openstack.org', None), 'keystone': ('http://keystone.openstack.org', None),