diff --git a/neutronclient/client.py b/neutronclient/client.py index 000b422ba..ebf0b972a 100644 --- a/neutronclient/client.py +++ b/neutronclient/client.py @@ -267,7 +267,7 @@ class HTTPClient(AbstractHTTPClient): body = json.loads(body) for endpoint in body.get('endpoints', []): if (endpoint['type'] == 'network' and - endpoint.get('region') == self.region_name): + endpoint.get('region') == self.region_name): if self.endpoint_type not in endpoint: raise exceptions.EndpointTypeNotFound( type_=self.endpoint_type) diff --git a/neutronclient/common/serializer.py b/neutronclient/common/serializer.py index ef95e402a..0b5efd0cb 100644 --- a/neutronclient/common/serializer.py +++ b/neutronclient/common/serializer.py @@ -291,7 +291,7 @@ class XMLDeserializer(TextDeserializer): parseError = False # Python2.7 if (hasattr(etree, 'ParseError') and - isinstance(e, getattr(etree, 'ParseError'))): + isinstance(e, getattr(etree, 'ParseError'))): parseError = True # Python2.6 elif isinstance(e, expat.ExpatError): @@ -341,9 +341,9 @@ class XMLDeserializer(TextDeserializer): result = dict() for attr in node.keys(): if (attr == 'xmlns' or - attr.startswith('xmlns:') or - attr == constants.XSI_ATTR or - attr == constants.TYPE_ATTR): + attr.startswith('xmlns:') or + attr == constants.XSI_ATTR or + attr == constants.TYPE_ATTR): continue result[self._get_key(attr)] = node.get(attr) children = list(node) diff --git a/neutronclient/common/validators.py b/neutronclient/common/validators.py index 032444c82..e732dfdcb 100644 --- a/neutronclient/common/validators.py +++ b/neutronclient/common/validators.py @@ -29,7 +29,7 @@ def validate_int_range(parsed_args, attr_name, min_value=None, max_value=None): else: int_val = val if ((min_value is None or min_value <= int_val) and - (max_value is None or int_val <= max_value)): + (max_value is None or int_val <= max_value)): return except (ValueError, TypeError): pass diff --git a/neutronclient/neutron/v2_0/__init__.py b/neutronclient/neutron/v2_0/__init__.py index 2916ac904..cd565542b 100644 --- a/neutronclient/neutron/v2_0/__init__.py +++ b/neutronclient/neutron/v2_0/__init__.py @@ -283,7 +283,7 @@ def parse_args_to_dict(values_specs): # All others are value items # Make sure '--' occurs first and allow minus value if (not current_item or '=' in current_item or - _item.startswith('-') and not is_number(_item)): + _item.startswith('-') and not is_number(_item)): raise exceptions.CommandError( _("Invalid values_specs %s") % ' '.join(values_specs)) _value_number += 1 @@ -328,7 +328,7 @@ def _merge_args(qCmd, parsed_args, _extra_values, value_specs): if isinstance(arg_value, list): if value and isinstance(value, list): if (not arg_value or - type(arg_value[0]) == type(value[0])): + type(arg_value[0]) == type(value[0])): arg_value.extend(value) _extra_values.pop(key) diff --git a/neutronclient/neutron/v2_0/nec/packetfilter.py b/neutronclient/neutron/v2_0/nec/packetfilter.py index 12fe24d22..957a16ad9 100644 --- a/neutronclient/neutron/v2_0/nec/packetfilter.py +++ b/neutronclient/neutron/v2_0/nec/packetfilter.py @@ -224,7 +224,7 @@ class UpdatePacketFilter(PacketFilterOptionMixin, for attr in ['action', 'priority', 'name']: if (hasattr(parsed_args, attr) and - getattr(parsed_args, attr) is not None): + getattr(parsed_args, attr) is not None): body[attr] = getattr(parsed_args, attr) return {self.resource: body} diff --git a/neutronclient/neutron/v2_0/port.py b/neutronclient/neutron/v2_0/port.py index 3b628b52c..5434de28b 100644 --- a/neutronclient/neutron/v2_0/port.py +++ b/neutronclient/neutron/v2_0/port.py @@ -122,7 +122,7 @@ class UpdateExtraDhcpOptMixin(object): if opt.split('=')[0] in ['opt_value', 'opt_name']: opt_ele.update(utils.str2dict(opt)) if (('opt_name' in opt_ele) and - ('opt_value' in opt_ele)): + ('opt_value' in opt_ele)): if opt_ele['opt_value'] == 'null': opt_ele['opt_value'] = None ops.append(opt_ele) diff --git a/neutronclient/shell.py b/neutronclient/shell.py index 9d235d191..7ce585b31 100644 --- a/neutronclient/shell.py +++ b/neutronclient/shell.py @@ -724,7 +724,7 @@ class NeutronShell(app.App): self.options.os_project_id) if (not self.options.os_username - and not self.options.os_user_id): + and not self.options.os_user_id): raise exc.CommandError( _("You must provide a username or user ID via" " --os-username, env[OS_USERNAME] or" diff --git a/tox.ini b/tox.ini index b34d93606..10140ed5a 100644 --- a/tox.ini +++ b/tox.ini @@ -37,10 +37,9 @@ downloadcache = ~/cache/pip # # TODO Fix the following rules from hacking 0.9.x # E113 unexpected indentation -# E129 visually indented line with same indent as next logical line # E265 block comment should start with '# ' # H405 multi line docstring summary not separated with an empty line # H307 like imports should be grouped together -ignore = E113,E125,E129,E265,H302,H307,H405 +ignore = E113,E125,E265,H302,H307,H405 show-source = true exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools