Fix some new pylint "C" warnings
After updating pylint, it started emitting additional "C" warnings in some cases, fix some of them. use-implicit-booleaness-not-comparison, use-maxsplit-arg, unnecessary-dunder-call Trivialfix Change-Id: I53558e6bc52aaea590f6c147aacc062c08099464
This commit is contained in:
parent
ed274efcf7
commit
10ff1caaca
@ -78,9 +78,6 @@ disable=
|
|||||||
wrong-import-order,
|
wrong-import-order,
|
||||||
consider-using-f-string,
|
consider-using-f-string,
|
||||||
consider-using-dict-items,
|
consider-using-dict-items,
|
||||||
use-implicit-booleaness-not-comparison,
|
|
||||||
use-maxsplit-arg,
|
|
||||||
unnecessary-dunder-call,
|
|
||||||
# "R" Refactor recommendations
|
# "R" Refactor recommendations
|
||||||
consider-merging-isinstance,
|
consider-merging-isinstance,
|
||||||
consider-using-ternary,
|
consider-using-ternary,
|
||||||
|
@ -320,7 +320,7 @@ def add_tc_qdisc(device, qdisc_type, parent=None, handle=None, latency_ms=None,
|
|||||||
args = {'kind': qdisc_type}
|
args = {'kind': qdisc_type}
|
||||||
if qdisc_type in ['htb', 'ingress']:
|
if qdisc_type in ['htb', 'ingress']:
|
||||||
if handle:
|
if handle:
|
||||||
args['handle'] = str(handle).split(':')[0] + ':0'
|
args['handle'] = str(handle).split(':', maxsplit=1)[0] + ':0'
|
||||||
elif qdisc_type == 'tbf':
|
elif qdisc_type == 'tbf':
|
||||||
if not latency_ms or not max_kbps or not kernel_hz:
|
if not latency_ms or not max_kbps or not kernel_hz:
|
||||||
raise qos_exc.TcLibQdiscNeededArguments(
|
raise qos_exc.TcLibQdiscNeededArguments(
|
||||||
|
@ -1065,7 +1065,7 @@ def skip_exceptions(exceptions):
|
|||||||
with excutils.save_and_reraise_exception() as ctx:
|
with excutils.save_and_reraise_exception() as ctx:
|
||||||
if issubclass(type(exc), tuple(exceptions)):
|
if issubclass(type(exc), tuple(exceptions)):
|
||||||
LOG.info('Skipped exception %s when calling method %s',
|
LOG.info('Skipped exception %s when calling method %s',
|
||||||
ctx.value.__repr__(), function.__repr__())
|
repr(ctx.value), repr(function))
|
||||||
ctx.reraise = False
|
ctx.reraise = False
|
||||||
return wrapper
|
return wrapper
|
||||||
return decorator
|
return decorator
|
||||||
|
@ -146,11 +146,13 @@ class PortForwarding(base.NeutronDbObject):
|
|||||||
primitive['internal_port'] = int(
|
primitive['internal_port'] = int(
|
||||||
str(primitive.pop(
|
str(primitive.pop(
|
||||||
'internal_port_range',
|
'internal_port_range',
|
||||||
str(primitive.get('internal_port', '')))).split(':')[0])
|
str(primitive.get('internal_port',
|
||||||
|
'')))).split(':', maxsplit=1)[0])
|
||||||
primitive['external_port'] = int(
|
primitive['external_port'] = int(
|
||||||
str(primitive.pop(
|
str(primitive.pop(
|
||||||
'external_port_range',
|
'external_port_range',
|
||||||
str(primitive.get('external_port', '')))).split(':')[0])
|
str(primitive.get('external_port',
|
||||||
|
'')))).split(':', maxsplit=1)[0])
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _modify_single_ports_to_db(result):
|
def _modify_single_ports_to_db(result):
|
||||||
|
@ -738,7 +738,7 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
|
|||||||
ip_version = utils.get_ip_version(ip)
|
ip_version = utils.get_ip_version(ip)
|
||||||
entry = ip_lib.dump_neigh_entries(ip_version, interface, dst=ip,
|
entry = ip_lib.dump_neigh_entries(ip_version, interface, dst=ip,
|
||||||
lladdr=mac)
|
lladdr=mac)
|
||||||
return entry != []
|
return bool(entry)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def fdb_bridge_entry_exists(mac, interface, agent_ip=None):
|
def fdb_bridge_entry_exists(mac, interface, agent_ip=None):
|
||||||
|
@ -32,7 +32,7 @@ def has_expected_arp_entry(device_name, namespace, ip, mac):
|
|||||||
ip_version = utils.get_ip_version(ip)
|
ip_version = utils.get_ip_version(ip)
|
||||||
entry = ip_lib.dump_neigh_entries(ip_version, device_name, namespace,
|
entry = ip_lib.dump_neigh_entries(ip_version, device_name, namespace,
|
||||||
dst=ip, lladdr=mac)
|
dst=ip, lladdr=mac)
|
||||||
return entry != []
|
return bool(entry)
|
||||||
|
|
||||||
|
|
||||||
class TestMonitorDaemon(base.BaseLoggingTestCase):
|
class TestMonitorDaemon(base.BaseLoggingTestCase):
|
||||||
|
Loading…
Reference in New Issue
Block a user