Fix E129 hacking check

Remove E129 from the ignored checks and fix them

Change-Id: Ibd3a98ceb173e9a1fa106ac6c4ecdebb1a9a1e4f
This commit is contained in:
Jaume Devesa 2014-10-06 12:25:48 +02:00
parent eae3211e8d
commit 64b2d8a01b
8 changed files with 12 additions and 13 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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}

View File

@ -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)

View File

@ -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"

View File

@ -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