diff --git a/heat/engine/clients/client_plugin.py b/heat/engine/clients/client_plugin.py index 08363cc961..ff47ad81d0 100644 --- a/heat/engine/clients/client_plugin.py +++ b/heat/engine/clients/client_plugin.py @@ -28,8 +28,7 @@ from heat.common.i18n import _ class ExceptionFilter(object): - """ - A context manager that prevents some exceptions from being raised. + """A context manager that prevents some exceptions from being raised. For backwards compatibility, these objects can also be called with the exception value as an argument - any non-matching exception will be @@ -55,7 +54,6 @@ class ExceptionFilter(object): ... assert False ... except Exception as ex: ... ignore_assertions(ex) - """ def __init__(self, should_ignore_ex): @@ -73,8 +71,7 @@ class ExceptionFilter(object): return self._should_ignore_ex(exc_val) def __call__(self, ex): - """ - Re-raise any exception value not being filtered out. + """Re-raise any exception value not being filtered out. If the exception was the last to be raised, it will be re-raised with its original traceback. diff --git a/heat/engine/hot/functions.py b/heat/engine/hot/functions.py index 76bf61ec84..46b7cee96e 100644 --- a/heat/engine/hot/functions.py +++ b/heat/engine/hot/functions.py @@ -260,13 +260,12 @@ class Replace(cfn_funcs.Replace): class ReplaceJson(Replace): - ''' - A function for performing string substitutions. + """A function for performing string substitutions. Behaves the same as Replace, but tolerates non-string parameter values, e.g map/list - these are serialized as json before doing the string substitution. - ''' + """ def result(self): template = function.resolve(self._string) diff --git a/heat/engine/resource.py b/heat/engine/resource.py index cc8a824b57..0bb1dbd1cb 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -120,7 +120,7 @@ class Resource(object): signal_needs_metadata_updates = True def __new__(cls, name, definition, stack): - '''Create a new Resource of the appropriate class for its type.''' + """Create a new Resource of the appropriate class for its type.""" assert isinstance(definition, rsrc_defn.ResourceDefinition) @@ -1092,24 +1092,22 @@ class Resource(object): return name[0:2] + '-' + name[-postfix_length:] def validate(self): - ''' - Validate the resource. + """Validate the resource. This may be overridden by resource plugins to add extra validation logic specific to the resource implementation. - ''' + """ LOG.info(_LI('Validating %s'), six.text_type(self)) return self.validate_template() def validate_template(self): - ''' - Validate strucural/syntax aspects of the resource definition. + """Validate structural/syntax aspects of the resource definition. Resource plugins should not override this, because this interface is expected to be called pre-create so things normally valid in an overridden validate() such as accessing properties may not work. - ''' + """ function.validate(self.t) self.validate_deletion_policy(self.t.deletion_policy()) self.t.update_policy(self.update_policy_schema, diff --git a/heat/engine/service.py b/heat/engine/service.py index 9be824bef1..a81481d9cf 100644 --- a/heat/engine/service.py +++ b/heat/engine/service.py @@ -958,9 +958,7 @@ class EngineService(service.Service): @context.request_context def validate_template(self, cnxt, template, params=None, files=None, show_nested=False): - """ - The validate_template method uses the stack parser to check - the validity of a template. + """Uses the stack parser to check the validity of a template. :param cnxt: RPC context. :param template: Template of stack you want to create. diff --git a/tox.ini b/tox.ini index 8e6eacd9af..72e2750f54 100644 --- a/tox.ini +++ b/tox.ini @@ -61,9 +61,6 @@ deps = -r{toxinidir}/test-requirements.txt commands = bandit -c bandit.yaml -r heat -n5 -p heat_conservative [flake8] -# H404 multi line docstring should start with a summary -# H405 multi line docstring summary not separated with an empty line -ignore = H404,H405 show-source = true exclude=.*,dist,*openstack/common*,*lib/python*,*egg,tools,build,*convergence/scenarios/* max-complexity=20