From 27ba0bb324a0fe136f5fee4c205ad18aab8c638d Mon Sep 17 00:00:00 2001 From: lrqrun Date: Thu, 30 Aug 2012 11:17:56 +0800 Subject: [PATCH] Fix PEP8 issues . Fix some pep8 issues in modified: doc/source/conf.py modified: tests/api/v1/test_list_resources.py modified: tests/collector/test_dispatcher.py modified: tests/compute/test_notifications.py make the code looks pretty. Change-Id: I50c167b457b18f3789a3f8d470faa2754a77b604 --- doc/source/conf.py | 36 ++++++++++++++++------------- tests/api/v1/test_list_resources.py | 1 - tests/collector/test_dispatcher.py | 2 +- tests/compute/test_notifications.py | 3 ++- 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 1ba56a21..5c6e9477 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -3,7 +3,8 @@ # Ceilometer documentation build configuration file, created by # sphinx-quickstart on Wed Jun 27 11:36:22 2012. # -# 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 # autogenerated file. @@ -11,20 +12,21 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import os +import sys # 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.insert(0, os.path.abspath('.')) -# -- General configuration ----------------------------------------------------- +# -- General configuration ---------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +# 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.autodoc', 'sphinx.ext.todo', 'sphinxcontrib.autohttp.flask', @@ -71,7 +73,8 @@ release = '0.0' # directories to ignore when looking for source files. 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 # If true, '()' will be appended to :func: etc. cross-reference text. @@ -92,7 +95,7 @@ pygments_style = 'sphinx' #modindex_common_prefix = [] -# -- Options for HTML output --------------------------------------------------- +# -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. @@ -172,7 +175,7 @@ html_static_path = ['_static'] htmlhelp_basename = 'Ceilometerdoc' -# -- Options for LaTeX output -------------------------------------------------- +# -- Options for LaTeX output ------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). @@ -186,10 +189,11 @@ latex_elements = { } # 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 = [ - ('index', 'Ceilometer.tex', u'Ceilometer Documentation', - u'OpenStack, LLC', 'manual'), + ('index', 'Ceilometer.tex', u'Ceilometer Documentation', + u'OpenStack, LLC', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -213,7 +217,7 @@ latex_documents = [ #latex_domain_indices = True -# -- Options for manual page output -------------------------------------------- +# -- Options for manual page output ------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). @@ -226,15 +230,15 @@ man_pages = [ #man_show_urls = False -# -- Options for Texinfo output ------------------------------------------------ +# -- Options for Texinfo output ----------------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'Ceilometer', u'Ceilometer Documentation', - u'OpenStack, LLC', 'Ceilometer', 'One line description of project.', - 'Miscellaneous'), + ('index', 'Ceilometer', u'Ceilometer Documentation', + u'OpenStack, LLC', 'Ceilometer', 'One line description of project.', + 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. diff --git a/tests/api/v1/test_list_resources.py b/tests/api/v1/test_list_resources.py index d7b473b7..58489213 100644 --- a/tests/api/v1/test_list_resources.py +++ b/tests/api/v1/test_list_resources.py @@ -189,4 +189,3 @@ class TestListResources(tests_api.TestBase): data = self.get('/projects/project-id/resources') ids = [r['resource_id'] for r in data['resources']] self.assertEquals(['resource-id'], ids) - diff --git a/tests/collector/test_dispatcher.py b/tests/collector/test_dispatcher.py index 7d368e2a..ef55db87 100644 --- a/tests/collector/test_dispatcher.py +++ b/tests/collector/test_dispatcher.py @@ -114,6 +114,6 @@ def test_notify_through_plugin(): ) d.notify(TEST_NOTICE) assert len(results) >= 1 - results_name = [ result.name for result in results ] + results_name = [result.name for result in results] assert 'instance' in results_name assert 'memory' in results_name diff --git a/tests/compute/test_notifications.py b/tests/compute/test_notifications.py index eb73c821..39ff8522 100644 --- a/tests/compute/test_notifications.py +++ b/tests/compute/test_notifications.py @@ -167,7 +167,8 @@ INSTANCE_EXISTS = { class TestNotifications(unittest.TestCase): def test_process_notification(self): - info = notifications.Instance.process_notification(INSTANCE_CREATE_END)[0] + info = notifications.Instance.process_notification( + INSTANCE_CREATE_END)[0] for name, actual, expected in [ ('counter_name', info.name, 'instance'),