From 62ccbe1c3ffd1ef2d157ff4050447b1d6a6d91ca Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Wed, 12 Jul 2017 10:40:37 +0100 Subject: [PATCH] doc: Enable pep8 on doc generation code As pep8 does not run on doc generation python code so we have some style violations there. As it not too hard to fix the problems and therefore enable pep8 on these files this patch proposes such a change. Change-Id: I26104ea66fc4f3e67f8227025f43202e483beb25 --- doc/ext/support_matrix.py | 11 ++++++----- doc/ext/versioned_notifications.py | 2 +- doc/source/conf.py | 16 ++++++++++++++-- tox.ini | 2 +- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/doc/ext/support_matrix.py b/doc/ext/support_matrix.py index f99ff78cd5d3..96e0b379e97c 100644 --- a/doc/ext/support_matrix.py +++ b/doc/ext/support_matrix.py @@ -25,7 +25,6 @@ It is used via a single directive in the .rst file import re import sys -import six from six.moves import configparser from docutils import nodes @@ -59,7 +58,9 @@ class SupportMatrixFeature(object): STATUS_CONDITION, STATUS_OPTIONAL] def __init__(self, key, title, status=STATUS_OPTIONAL, - group=None, notes=None, cli=[]): + group=None, notes=None, cli=None): + if not cli: + cli = [] # A unique key (eg 'foo.bar.wizz') to identify the feature self.key = key # A human friendly short title for the feature @@ -474,10 +475,10 @@ class SupportMatrixDirective(rst.Directive): notes.append(item) def _create_cli_paragraph(self, feature): - ''' Create a paragraph which represents the CLI commands of the feature + """Create a paragraph which represents the CLI commands of the feature The paragraph will have a bullet list of CLI commands. - ''' + """ para = nodes.paragraph() para.append(nodes.strong(text="CLI commands:")) commands = nodes.bullet_list() @@ -489,7 +490,7 @@ class SupportMatrixDirective(rst.Directive): return para def _create_notes_paragraph(self, notes): - """ Constructs a paragraph which represents the implementation notes + """Constructs a paragraph which represents the implementation notes The paragraph consists of text and clickable URL nodes if links were given in the notes. diff --git a/doc/ext/versioned_notifications.py b/doc/ext/versioned_notifications.py index da0b2f82bf6f..64b3babba91d 100644 --- a/doc/ext/versioned_notifications.py +++ b/doc/ext/versioned_notifications.py @@ -22,8 +22,8 @@ It is used via a single directive in the .rst file from docutils import nodes import importlib -from sphinx.util.compat import Directive import pkgutil +from sphinx.util.compat import Directive import nova.notifications.objects from nova.notifications.objects import base as notification diff --git a/doc/source/conf.py b/doc/source/conf.py index 3e36ed925458..ee058977b69c 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,12 +1,24 @@ -# nova documentation build configuration file +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# nova documentation build configuration file # # Refer to the Sphinx documentation for advice on configuring this file: # # http://www.sphinx-doc.org/en/stable/config.html +import os import subprocess import sys -import os import warnings from nova.version import version_info diff --git a/tox.ini b/tox.ini index ab8e371246ce..937b93db65c5 100644 --- a/tox.ini +++ b/tox.ini @@ -177,7 +177,7 @@ commands = bash -c tools/releasenotes_tox.sh enable-extensions = H106,H203,H904 ignore = E121,E122,E123,E124,E125,E126,E127,E128,E129,E131,E251,H405 -exclude = .venv,.git,.tox,dist,doc,*lib/python*,*egg,build,tools/xenserver*,releasenotes +exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,tools/xenserver*,releasenotes # To get a list of functions that are more complex than 25, set max-complexity # to 25 and run 'tox -epep8'. # 34 is currently the most complex thing we have