Cleanup and gate on hacking E713 rule

This fixes the offending instances of the rule
and removes it from the ignore list in tox.ini
so that we can gate on the E713 rule.

Change-Id: I1f9ef23a8569252b5b6fa660d0d200b1702056d0
This commit is contained in:
Matt Riedemann
2014-07-16 02:01:15 -07:00
parent 62d4d458d6
commit 51e604f87e
7 changed files with 9 additions and 9 deletions

View File

@@ -239,7 +239,7 @@ class ServersController(wsgi.Controller):
# disabled. Note that the tenant_id parameter is filtered out
# by remove_invalid_options above unless the requestor is an
# admin.
if 'tenant_id' in search_opts and not 'all_tenants' in search_opts:
if 'tenant_id' in search_opts and 'all_tenants' not in search_opts:
# We do not need to add the all_tenants flag if the tenant
# id associated with the token is the tenant id
# specified. This is done so a request that does not need

View File

@@ -1266,7 +1266,7 @@ class Controller(wsgi.Controller):
@wsgi.action('changePassword')
def _action_change_password(self, req, id, body):
context = req.environ['nova.context']
if (not 'changePassword' in body
if ('changePassword' not in body
or 'adminPass' not in body['changePassword']):
msg = _("No adminPass was specified")
raise exc.HTTPBadRequest(explanation=msg)

View File

@@ -55,7 +55,7 @@ class ConvertedException(webob.exc.WSGIHTTPException):
def _cleanse_dict(original):
"""Strip all admin_password, new_pass, rescue_pass keys from a dict."""
return dict((k, v) for k, v in original.iteritems() if not "_pass" in k)
return dict((k, v) for k, v in original.iteritems() if "_pass" not in k)
def wrap_exception(notifier=None, get_notifier=None):

View File

@@ -117,7 +117,7 @@ class _GroupAntiAffinityFilter(AffinityFilter):
"in %(configured)s", {'host': host_state.host,
'configured': group_hosts})
if group_hosts:
return not host_state.host in group_hosts
return host_state.host not in group_hosts
# No groups configured
return True

View File

@@ -158,14 +158,14 @@ def _get_root_helper():
def execute(*cmd, **kwargs):
"""Convenience wrapper around oslo's execute() method."""
if 'run_as_root' in kwargs and not 'root_helper' in kwargs:
if 'run_as_root' in kwargs and 'root_helper' not in kwargs:
kwargs['root_helper'] = _get_root_helper()
return processutils.execute(*cmd, **kwargs)
def trycmd(*args, **kwargs):
"""Convenience wrapper around oslo's trycmd() method."""
if 'run_as_root' in kwargs and not 'root_helper' in kwargs:
if 'run_as_root' in kwargs and 'root_helper' not in kwargs:
kwargs['root_helper'] = _get_root_helper()
return processutils.trycmd(*args, **kwargs)

View File

@@ -377,7 +377,7 @@ def get_vmdk_path_and_adapter_type(hardware_devices, uuid=None):
def _find_controller_slot(controller_keys, taken, max_unit_number):
for controller_key in controller_keys:
for unit_number in range(max_unit_number):
if not unit_number in taken.get(controller_key, []):
if unit_number not in taken.get(controller_key, []):
return controller_key, unit_number

View File

@@ -57,11 +57,11 @@ sitepackages = False
# H803 skipped on purpose per list discussion.
# E125 is deliberately excluded. See https://github.com/jcrocholl/pep8/issues/126
# The rest of the ignores are TODOs
# New from hacking 0.9: E129, E131, E265, E713, H407, H405, H904
# New from hacking 0.9: E129, E131, E265, H407, H405, H904
# Stricter in hacking 0.9: F402
# E251 Skipped due to https://github.com/jcrocholl/pep8/issues/301
ignore = E121,E122,E123,E124,E125,E129,E126,E127,E128,E131,E251,E265,E711,E712,E713,F402,H405,H803,H904
ignore = E121,E122,E123,E124,E125,E129,E126,E127,E128,E131,E251,E265,E711,E712,F402,H405,H803,H904
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools
[hacking]