Prefer "val !=/== ref" over "val (not) in [ref]" in conditions

This change increases readibility with the following replacements in
conditions:

 * val in [ref] ==> val == ref
 * val not in [ref] ==> val != ref

Change-Id: I52a77aff60c8e46fa5f6290e3a565f58425d9a68
This commit is contained in:
Cedric Brandily 2014-08-26 19:45:22 +02:00
parent 07aed08413
commit 5a66895a4f
3 changed files with 3 additions and 3 deletions

View File

@ -45,7 +45,7 @@ class LocalTypeDriver(api.TypeDriver):
def validate_provider_segment(self, segment):
for key, value in segment.iteritems():
if value and key not in [api.NETWORK_TYPE]:
if value and key != api.NETWORK_TYPE:
msg = _("%s prohibited for local provider network") % key
raise exc.InvalidInput(error_message=msg)

View File

@ -243,7 +243,7 @@ class FirewallPlugin(firewall_db.Firewall_db_mixin):
def delete_db_firewall_object(self, context, id):
firewall = self.get_firewall(context, id)
if firewall['status'] in [const.PENDING_DELETE]:
if firewall['status'] == const.PENDING_DELETE:
super(FirewallPlugin, self).delete_firewall(context, id)
def delete_firewall(self, context, id):

View File

@ -468,7 +468,7 @@ class LoadBalancerDriver(abstract_driver.LoadBalancerAbstractDriver):
resource = '/api/workflow/%s' % (wf_name)
rest_return = self.rest_client.call('DELETE', resource, None, None)
response = _rest_wrapper(rest_return, [204, 202, 404])
if rest_return[RESP_STATUS] in [404]:
if rest_return[RESP_STATUS] == 404:
if post_remove_function:
try:
post_remove_function(True)