From 34879f8ea0b718d0f7e270cb5c712663340300f6 Mon Sep 17 00:00:00 2001 From: gengchc2 Date: Wed, 28 Sep 2016 14:07:42 +0800 Subject: [PATCH] Do not ignore E123, E125 per PEP 8-Style Guide for Python Code Do not ignore E123, E125 per PEP 8-Style Guide for Python Code.[1] To ignore E123 and E125 is not recommended by PEP 8-Style Guide for Python Code Guildeline practice as it creates style/indentation mis-match. [1]http://pep8.readthedocs.io/en/latest/intro.html#id3 Change-Id: I6dc4358a4a3e9e9d854f2f76e3c8acc5cf58d434 --- toscaparser/elements/capabilitytype.py | 2 +- toscaparser/elements/grouptype.py | 2 +- toscaparser/elements/policytype.py | 2 +- toscaparser/elements/portspectype.py | 2 +- toscaparser/functions.py | 4 ++-- toscaparser/imports.py | 2 +- toscaparser/nodetemplate.py | 2 +- toscaparser/topology_template.py | 6 +++--- toscaparser/utils/validateutils.py | 2 +- tox.ini | 3 --- 10 files changed, 12 insertions(+), 15 deletions(-) diff --git a/toscaparser/elements/capabilitytype.py b/toscaparser/elements/capabilitytype.py index 865690e..54cd9fe 100644 --- a/toscaparser/elements/capabilitytype.py +++ b/toscaparser/elements/capabilitytype.py @@ -44,7 +44,7 @@ class CapabilityTypeDef(StatefulEntityType): for prop, schema in props.items(): # add parent property if not overridden by children type if not self.properties or \ - prop not in self.properties.keys(): + prop not in self.properties.keys(): properties.append(PropertyDef(prop, None, schema)) return properties diff --git a/toscaparser/elements/grouptype.py b/toscaparser/elements/grouptype.py index 02c285a..4e58d64 100644 --- a/toscaparser/elements/grouptype.py +++ b/toscaparser/elements/grouptype.py @@ -87,7 +87,7 @@ class GroupType(StatefulEntityType): 'metadata' % (meta_data.get('type')))) for entry_schema, entry_schema_type in meta_data.items(): if isinstance(entry_schema_type, dict) and not \ - entry_schema_type.get('type') == 'string': + entry_schema_type.get('type') == 'string': ExceptionCollector.appendException( InvalidTypeError(what='"%s" defined in group for ' 'metadata "%s"' diff --git a/toscaparser/elements/policytype.py b/toscaparser/elements/policytype.py index 8fbb0f0..805de95 100644 --- a/toscaparser/elements/policytype.py +++ b/toscaparser/elements/policytype.py @@ -112,7 +112,7 @@ class PolicyType(StatefulEntityType): for entry_schema, entry_schema_type in meta_data.items(): if isinstance(entry_schema_type, dict) and not \ - entry_schema_type.get('type') == 'string': + entry_schema_type.get('type') == 'string': ExceptionCollector.appendException( InvalidTypeError(what='"%s" defined in policy for ' 'metadata "%s"' diff --git a/toscaparser/elements/portspectype.py b/toscaparser/elements/portspectype.py index d32e97e..0218305 100644 --- a/toscaparser/elements/portspectype.py +++ b/toscaparser/elements/portspectype.py @@ -58,7 +58,7 @@ class PortSpec(object): # verify one of the specified values is set if source is None and source_range is None and \ - target is None and target_range is None: + target is None and target_range is None: ExceptionCollector.appendException( InvalidTypeAdditionalRequirementsError( type=PortSpec.TYPE_URI)) diff --git a/toscaparser/functions.py b/toscaparser/functions.py index b0fd6ae..a77d714 100644 --- a/toscaparser/functions.py +++ b/toscaparser/functions.py @@ -205,7 +205,7 @@ class GetAttribute(Function): def _find_node_template_containing_attribute(self): node_tpl = self._find_node_template(self.args[0]) if node_tpl and \ - not self._attribute_exists_in_type(node_tpl.type_definition): + not self._attribute_exists_in_type(node_tpl.type_definition): ExceptionCollector.appendException( KeyError(_('Attribute "%(att)s" was not found in node ' 'template "%(ntpl)s".') % @@ -229,7 +229,7 @@ class GetAttribute(Function): target_type = target_node.type_definition for capability in target_type.get_capabilities_objects(): if capability.type in \ - hosted_on_rel['valid_target_types']: + hosted_on_rel['valid_target_types']: if self._attribute_exists_in_type(target_type): return target_node return self._find_host_containing_attribute( diff --git a/toscaparser/imports.py b/toscaparser/imports.py index 451c952..b69bf4d 100644 --- a/toscaparser/imports.py +++ b/toscaparser/imports.py @@ -221,7 +221,7 @@ class ImportsLoader(object): dir_path = os.path.dirname(os.path.abspath( self.path)) if file_path[0] != '' and dir_path.endswith( - file_path[0]): + file_path[0]): import_template = dir_path + "/" +\ file_path[2] if not os.path.isfile(import_template): diff --git a/toscaparser/nodetemplate.py b/toscaparser/nodetemplate.py index 5ea1c27..5b456b1 100644 --- a/toscaparser/nodetemplate.py +++ b/toscaparser/nodetemplate.py @@ -229,7 +229,7 @@ class NodeTemplate(EntityTemplate): for value in occurrences: DataEntity.validate_datatype('integer', value) if len(occurrences) != 2 or not (0 <= occurrences[0] <= occurrences[1]) \ - or occurrences[1] == 0: + or occurrences[1] == 0: ExceptionCollector.appendException( InvalidPropertyValueError(what=(occurrences))) diff --git a/toscaparser/topology_template.py b/toscaparser/topology_template.py index 7fdd5ad..463e083 100644 --- a/toscaparser/topology_template.py +++ b/toscaparser/topology_template.py @@ -75,7 +75,7 @@ class TopologyTemplate(object): input.validate(default) if (self.parsed_params and input.name not in self.parsed_params or self.parsed_params is None) and input.required \ - and input.default is None: + and input.default is None: exception.ExceptionCollector.appendException( exception.MissingRequiredParameterError( what='Template', @@ -153,7 +153,7 @@ class TopologyTemplate(object): if member_names is not None: DataEntity.validate_datatype('list', member_names) if len(member_names) < 1 or \ - len(member_names) != len(set(member_names)): + len(member_names) != len(set(member_names)): exception.ExceptionCollector.appendException( exception.InvalidGroupTargetException( message=_('Member nodes "%s" should be >= 1 ' @@ -292,7 +292,7 @@ class TopologyTemplate(object): for interface in rel_tpl.interfaces: if interface.inputs: for name, value in \ - interface.inputs.items(): + interface.inputs.items(): interface.inputs[name] = \ functions.get_function(self, rel_tpl, diff --git a/toscaparser/utils/validateutils.py b/toscaparser/utils/validateutils.py index 43e14d6..b280576 100644 --- a/toscaparser/utils/validateutils.py +++ b/toscaparser/utils/validateutils.py @@ -198,7 +198,7 @@ class TOSCAVersionProperty(object): """ if self.minor_version is None and self.build_version is None and \ - value != '0': + value != '0': log.warning(_('Minor version assumed "0".')) self.version = '.'.join([value, '0']) return value diff --git a/tox.ini b/tox.ini index 67d6fa5..b8e51e7 100644 --- a/tox.ini +++ b/tox.ini @@ -28,9 +28,6 @@ commands = python setup.py build_sphinx commands = oslo_debug_helper -t toscaparser/tests {posargs} [flake8] -# E123, E125 skipped as they are invalid PEP-8. - show-source = True -ignore = E123,E125 builtins = _ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build