Fix pylint R1714 (consider-using-in) refactor messages
Instead of checking variables are equal to one of many values, use a tuple and check if the variable is 'in' it. This is faster and less verbose. Change-Id: I429dbbd92a78fdfae3140cae8a397ff10f6d956e
This commit is contained in:
parent
7e208c3014
commit
fba5eb694b
@ -89,7 +89,6 @@ disable=
|
|||||||
# new for python3 version of pylint
|
# new for python3 version of pylint
|
||||||
chained-comparison,
|
chained-comparison,
|
||||||
consider-using-dict-comprehension,
|
consider-using-dict-comprehension,
|
||||||
consider-using-in,
|
|
||||||
consider-using-set-comprehension,
|
consider-using-set-comprehension,
|
||||||
unnecessary-pass,
|
unnecessary-pass,
|
||||||
useless-object-inheritance
|
useless-object-inheritance
|
||||||
|
@ -31,7 +31,7 @@ def main():
|
|||||||
agent_pid = sys.argv[3]
|
agent_pid = sys.argv[3]
|
||||||
prefix = os.getenv('PREFIX1', "::")
|
prefix = os.getenv('PREFIX1', "::")
|
||||||
|
|
||||||
if operation == "add" or operation == "update":
|
if operation in ["add", "update"]:
|
||||||
file_utils.replace_file(prefix_fname, "%s/64" % prefix)
|
file_utils.replace_file(prefix_fname, "%s/64" % prefix)
|
||||||
elif operation == "delete":
|
elif operation == "delete":
|
||||||
file_utils.replace_file(prefix_fname, "::/64")
|
file_utils.replace_file(prefix_fname, "::/64")
|
||||||
|
@ -76,7 +76,7 @@ class PortForwarding(base.NeutronDbObject):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def obj_load_attr(self, attrname):
|
def obj_load_attr(self, attrname):
|
||||||
if attrname == 'floating_ip_address' or attrname == 'router_id':
|
if attrname in ['floating_ip_address', 'router_id']:
|
||||||
return self._load_attr_from_fip(attrname)
|
return self._load_attr_from_fip(attrname)
|
||||||
super(PortForwarding, self).obj_load_attr(attrname)
|
super(PortForwarding, self).obj_load_attr(attrname)
|
||||||
|
|
||||||
|
@ -2054,10 +2054,9 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
|
|||||||
mech_context = driver_context.NetworkContext(
|
mech_context = driver_context.NetworkContext(
|
||||||
self, context, network_with_segments,
|
self, context, network_with_segments,
|
||||||
original_network=network_with_segments)
|
original_network=network_with_segments)
|
||||||
if (event == events.PRECOMMIT_CREATE or
|
if event in [events.PRECOMMIT_CREATE, events.PRECOMMIT_DELETE]:
|
||||||
event == events.PRECOMMIT_DELETE):
|
|
||||||
self.mechanism_manager.update_network_precommit(mech_context)
|
self.mechanism_manager.update_network_precommit(mech_context)
|
||||||
elif event == events.AFTER_CREATE or event == events.AFTER_DELETE:
|
elif event in [events.AFTER_CREATE, events.AFTER_DELETE]:
|
||||||
self.mechanism_manager.update_network_postcommit(mech_context)
|
self.mechanism_manager.update_network_postcommit(mech_context)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user