Merge "Fix misplaced comparison constant warnings"
This commit is contained in:
commit
fb945cfa38
@ -57,7 +57,6 @@ disable=
|
||||
consider-using-enumerate,
|
||||
invalid-name,
|
||||
len-as-condition,
|
||||
misplaced-comparison-constant,
|
||||
missing-docstring,
|
||||
singleton-comparison,
|
||||
superfluous-parens,
|
||||
|
@ -45,7 +45,7 @@ def get_prefix_from_ns_name(ns_name):
|
||||
:returns: The prefix ending with a '-' or None if there is no '-'
|
||||
"""
|
||||
dash_index = ns_name.find('-')
|
||||
if 0 <= dash_index:
|
||||
if dash_index >= 0:
|
||||
return ns_name[:dash_index + 1]
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ def get_id_from_ns_name(ns_name):
|
||||
:returns: Identifier or None if there is no - to end the prefix
|
||||
"""
|
||||
dash_index = ns_name.find('-')
|
||||
if 0 <= dash_index:
|
||||
if dash_index >= 0:
|
||||
return ns_name[dash_index + 1:]
|
||||
|
||||
|
||||
|
@ -68,7 +68,7 @@ class SubnetRequest(object, metaclass=abc.ABCMeta):
|
||||
if previous and pool.first <= previous.last:
|
||||
raise ValueError(_("Ranges must not overlap"))
|
||||
previous = pool
|
||||
if 1 < len(allocation_pools):
|
||||
if len(allocation_pools) > 1:
|
||||
# Checks that all the ranges are in the same IP version.
|
||||
# IPRange sorts first by ip version so we can get by with just
|
||||
# checking the first and the last range having sorted them
|
||||
|
@ -349,7 +349,7 @@ class Subnet(base.NeutronDbObject):
|
||||
segment_ids = {subnet.segment_id
|
||||
for subnet, mapping in results
|
||||
if mapping}
|
||||
if 1 < len(segment_ids):
|
||||
if len(segment_ids) > 1:
|
||||
raise segment_exc.HostConnectedToMultipleSegments(
|
||||
host=host, network_id=network_id)
|
||||
|
||||
@ -395,7 +395,7 @@ class Subnet(base.NeutronDbObject):
|
||||
if subnet and subnet.segment_id not in segment_ids:
|
||||
segment_ids.append(subnet.segment_id)
|
||||
|
||||
if 1 < len(segment_ids) and not allow_multiple_segments:
|
||||
if len(segment_ids) > 1 and not allow_multiple_segments:
|
||||
raise segment_exc.FixedIpsSubnetsNotOnSameSegment()
|
||||
|
||||
if allow_multiple_segments:
|
||||
|
@ -292,7 +292,7 @@ class OvnNbSynchronizer(OvnDbSynchronizer):
|
||||
|
||||
num_acls_to_add = len(neutron_acls)
|
||||
num_acls_to_remove = len(ovn_acls) + num_acls_to_remove_from_ls
|
||||
if 0 != num_acls_to_add or 0 != num_acls_to_remove:
|
||||
if num_acls_to_add != 0 or num_acls_to_remove != 0:
|
||||
LOG.warning('ACLs-to-be-added %(add)d '
|
||||
'ACLs-to-be-removed %(remove)d',
|
||||
{'add': num_acls_to_add,
|
||||
|
@ -693,7 +693,7 @@ class OvnIdlDistributedLock(BaseOvnIdl):
|
||||
|
||||
self.update_tables(tables, row.schema[0])
|
||||
|
||||
if 'Chassis_Private' == self.driver.agent_chassis_table:
|
||||
if self.driver.agent_chassis_table == 'Chassis_Private':
|
||||
if 'Chassis_Private' not in self.tables:
|
||||
self.driver.agent_chassis_table = 'Chassis'
|
||||
else:
|
||||
|
@ -556,7 +556,7 @@ class PortForwardingPlugin(fip_pf.PortForwardingPluginBase):
|
||||
range_b = list(map(int, str(range_b).split(':')))
|
||||
|
||||
invalid_port = next((port for port in (range_a + range_b)
|
||||
if 65535 < port or port < 1), None)
|
||||
if port > 65535 or port < 1), None)
|
||||
|
||||
if invalid_port:
|
||||
raise lib_exc.BadRequest(resource=apidef.RESOURCE_NAME,
|
||||
|
Loading…
Reference in New Issue
Block a user