Fix some flake8 warnings in doc/resources.py

remove doc from the ignore and just fix the issues in conf.py

Change-Id: I30833dd24409087c3482d2034a797fea3f90aa85
This commit is contained in:
Angus Salkeld 2013-08-22 11:42:31 +10:00
parent 67b4e94be6
commit ca0bea47e5
3 changed files with 54 additions and 39 deletions

View File

@ -1,5 +1,17 @@
# -*- coding: utf-8 -*-
#
# 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.
#
# Heat documentation build configuration file, created by
# sphinx-quickstart on Thu Dec 13 11:23:35 2012.
#
@ -28,9 +40,9 @@ sys.path.insert(0, os.path.abspath('../../'))
# 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.ifconfig',
'sphinx.ext.viewcode',
'heat.doc.resources']
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'heat.doc.resources']
# Add any paths that contain templates here, relative to this directory.
#templates_path = ['_templates']
@ -170,21 +182,21 @@ htmlhelp_basename = 'Heatdoc'
# -- Options for LaTeX output -------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# The font size ('10pt', '11pt' or '12pt').
#'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
# Additional stuff for the LaTeX preamble.
#'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual])
latex_documents = [
('index', 'Heat.tex', u'Heat Documentation',
u'Heat Developers', 'manual'),
('index', 'Heat.tex', u'Heat Documentation',
u'Heat Developers', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
@ -214,23 +226,23 @@ latex_documents = [
# (source start file, name, description, authors, manual section).
man_pages = [
('man/heat-api', 'heat-api',
u'REST API service to the heat project.',
[u'Heat Developers'], 1),
u'REST API service to the heat project.',
[u'Heat Developers'], 1),
('man/heat-api-cfn', 'heat-api-cfn',
u'CloudFormation compatible API service to the heat project.',
[u'Heat Developers'], 1),
u'CloudFormation compatible API service to the heat project.',
[u'Heat Developers'], 1),
('man/heat-api-cloudwatch', 'heat-api-cloudwatch',
u'CloudWatch alike API service to the heat project',
[u'Heat Developers'], 1),
u'CloudWatch alike API service to the heat project',
[u'Heat Developers'], 1),
('man/heat-db-setup', 'heat-db-setup',
u'Command line utility to setup the Heat database',
[u'Heat Developers'], 1),
u'Command line utility to setup the Heat database',
[u'Heat Developers'], 1),
('man/heat-engine', 'heat-engine',
u'Service which performs the actions from the API calls made by the user',
[u'Heat Developers'], 1),
u'Service which performs the actions from the API calls made by the user',
[u'Heat Developers'], 1),
('man/heat-keystone-setup', 'heat-keystone-setup',
u'Script which sets up keystone for usage by Heat',
[u'Heat Developers'], 1),
u'Script which sets up keystone for usage by Heat',
[u'Heat Developers'], 1),
]
# If true, show URL addresses after external links.
@ -243,9 +255,9 @@ man_pages = [
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'Heat', u'Heat Documentation',
u'Heat Developers', 'Heat', 'One line description of project.',
'Miscellaneous'),
('index', 'Heat', u'Heat Documentation',
u'Heat Developers', 'Heat', 'One line description of project.',
'Miscellaneous'),
]
# Documents to append as an appendix to all manuals.

View File

@ -21,7 +21,8 @@ from docutils import nodes
from sphinx.util.compat import Directive
class resourcepages(nodes.General, nodes.Element): pass
class resourcepages(nodes.General, nodes.Element):
pass
class ResourcePages(Directive):
@ -31,7 +32,6 @@ class ResourcePages(Directive):
final_argument_whitespace = False
option_spec = {}
def run(self):
prefix = self.arguments and self.arguments.pop() or None
content = []
@ -65,7 +65,7 @@ class ResourcePages(Directive):
def _prop_syntax_example(self, prop):
if not prop or not prop.get('Type'):
return 'Value'
prop_type=prop.get('Type')
prop_type = prop.get('Type')
if prop_type == 'List':
sub_prop = prop.get('Schema')
sub_type = self._prop_syntax_example(sub_prop)
@ -88,7 +88,8 @@ class ResourcePages(Directive):
for prop_key in sorted(schema.keys()):
prop = schema[prop_key]
if prop.get('Implemented', True):
props.append('%s: %s' % (prop_key, self._prop_syntax_example(prop)))
props.append('%s: %s' % (prop_key,
self._prop_syntax_example(prop)))
template = '''heat_template_version: 2013-05-23
...
@ -109,7 +110,8 @@ resources:
for prop_key in sorted(schema.keys()):
prop = schema[prop_key]
if prop.get('Implemented', True):
props.append('%s: %s' % (prop_key, self._prop_syntax_example(prop)))
props.append('%s: %s' % (prop_key,
self._prop_syntax_example(prop)))
template = '''HeatTemplateFormatVersion: '2012-12-12'
...
@ -131,7 +133,8 @@ Resources:
for prop_key in sorted(schema.keys()):
prop = schema[prop_key]
if prop.get('Implemented', True):
props.append('"%s": %s' % (prop_key, self._prop_syntax_example(prop)))
props.append('"%s": %s' % (prop_key,
self._prop_syntax_example(prop)))
template = '''{
"AWSTemplateFormatVersion" : "2010-09-09",
...
@ -147,10 +150,9 @@ Resources:
block = nodes.literal_block('', template)
section.append(block)
def contribute_property(self, prop_list, prop_key, prop):
prop_item = nodes.definition_list_item(
'',nodes.term('', prop_key))
'', nodes.term('', prop_key))
prop_list.append(prop_item)
prop_type = prop.get('Type')
@ -184,7 +186,8 @@ Resources:
elif prop.get('Default'):
para = nodes.paragraph(
'',
_('Optional property, defaults to "%s".') % prop.get('Default'))
_('Optional property, defaults to "%s".') %
prop.get('Default'))
else:
para = nodes.paragraph('', _('Optional property.'))
definition.append(para)
@ -195,7 +198,8 @@ Resources:
definition.append(para)
if prop.get('AllowedValues'):
allowed = [str(a) for a in prop.get('AllowedValues') if a is not None]
allowed = [str(a) for a in prop.get('AllowedValues')
if a is not None]
para = nodes.paragraph('', _(
'Allowed values: %s') % ', '.join(allowed))
definition.append(para)
@ -230,7 +234,6 @@ Resources:
prop = schema[prop_key]
self.contribute_property(prop_list, prop_key, prop)
def contribute_attributes(self, parent):
schema = self.resource_class.attributes_schema
if not schema:
@ -241,7 +244,7 @@ Resources:
for prop_key in sorted(schema.keys()):
description = schema[prop_key]
prop_item = nodes.definition_list_item(
'',nodes.term('', prop_key))
'', nodes.term('', prop_key))
prop_list.append(prop_item)
definition = nodes.definition()

View File

@ -32,4 +32,4 @@ commands =
ignore = F841,H201,H302,H306,H404
show-source = true
builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,build
exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,tools,build