From: Cedric Brandily Date: Tue, 26 Aug 2014 17:45:22 +0000 (+0200) Subject: Prefer "val !=/== ref" over "val (not) in [ref]" in conditions X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=2f717b83996d78198868dd93af5740af199e81f8;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/neutron/plugins/ml2/drivers/type_local.py b/neutron/plugins/ml2/drivers/type_local.py index ec6a3e146..2c8747c7b 100644 --- a/neutron/plugins/ml2/drivers/type_local.py +++ b/neutron/plugins/ml2/drivers/type_local.py @@ -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) diff --git a/neutron/services/firewall/fwaas_plugin.py b/neutron/services/firewall/fwaas_plugin.py index 6a9fd1c54..9bbe9fd0e 100644 --- a/neutron/services/firewall/fwaas_plugin.py +++ b/neutron/services/firewall/fwaas_plugin.py @@ -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): diff --git a/neutron/services/loadbalancer/drivers/radware/driver.py b/neutron/services/loadbalancer/drivers/radware/driver.py index e480c2f69..7c2e5eb65 100644 --- a/neutron/services/loadbalancer/drivers/radware/driver.py +++ b/neutron/services/loadbalancer/drivers/radware/driver.py @@ -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)