diff --git a/.pylintrc b/.pylintrc index 28706a4a12d..3b6d3f4ba83 100644 --- a/.pylintrc +++ b/.pylintrc @@ -78,9 +78,6 @@ disable= wrong-import-order, consider-using-f-string, consider-using-dict-items, - use-implicit-booleaness-not-comparison, - use-maxsplit-arg, - unnecessary-dunder-call, # "R" Refactor recommendations consider-merging-isinstance, consider-using-ternary, diff --git a/neutron/agent/linux/tc_lib.py b/neutron/agent/linux/tc_lib.py index 8aed70d8248..3719f0709ef 100644 --- a/neutron/agent/linux/tc_lib.py +++ b/neutron/agent/linux/tc_lib.py @@ -320,7 +320,7 @@ def add_tc_qdisc(device, qdisc_type, parent=None, handle=None, latency_ms=None, args = {'kind': qdisc_type} if qdisc_type in ['htb', 'ingress']: if handle: - args['handle'] = str(handle).split(':')[0] + ':0' + args['handle'] = str(handle).split(':', maxsplit=1)[0] + ':0' elif qdisc_type == 'tbf': if not latency_ms or not max_kbps or not kernel_hz: raise qos_exc.TcLibQdiscNeededArguments( diff --git a/neutron/common/utils.py b/neutron/common/utils.py index 4c240584f11..5201a9e6b52 100644 --- a/neutron/common/utils.py +++ b/neutron/common/utils.py @@ -1065,7 +1065,7 @@ def skip_exceptions(exceptions): with excutils.save_and_reraise_exception() as ctx: if issubclass(type(exc), tuple(exceptions)): LOG.info('Skipped exception %s when calling method %s', - ctx.value.__repr__(), function.__repr__()) + repr(ctx.value), repr(function)) ctx.reraise = False return wrapper return decorator diff --git a/neutron/objects/port_forwarding.py b/neutron/objects/port_forwarding.py index 200e51ba7e7..856f997e8c3 100644 --- a/neutron/objects/port_forwarding.py +++ b/neutron/objects/port_forwarding.py @@ -146,11 +146,13 @@ class PortForwarding(base.NeutronDbObject): primitive['internal_port'] = int( str(primitive.pop( 'internal_port_range', - str(primitive.get('internal_port', '')))).split(':')[0]) + str(primitive.get('internal_port', + '')))).split(':', maxsplit=1)[0]) primitive['external_port'] = int( str(primitive.pop( 'external_port_range', - str(primitive.get('external_port', '')))).split(':')[0]) + str(primitive.get('external_port', + '')))).split(':', maxsplit=1)[0]) @staticmethod def _modify_single_ports_to_db(result): diff --git a/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py b/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py index 8941a9e9967..515fe9fcd8d 100644 --- a/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py +++ b/neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py @@ -738,7 +738,7 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase): ip_version = utils.get_ip_version(ip) entry = ip_lib.dump_neigh_entries(ip_version, interface, dst=ip, lladdr=mac) - return entry != [] + return bool(entry) @staticmethod def fdb_bridge_entry_exists(mac, interface, agent_ip=None): diff --git a/neutron/tests/functional/agent/l3/test_keepalived_state_change.py b/neutron/tests/functional/agent/l3/test_keepalived_state_change.py index 60b4451436c..d916f13eb4a 100644 --- a/neutron/tests/functional/agent/l3/test_keepalived_state_change.py +++ b/neutron/tests/functional/agent/l3/test_keepalived_state_change.py @@ -32,7 +32,7 @@ def has_expected_arp_entry(device_name, namespace, ip, mac): ip_version = utils.get_ip_version(ip) entry = ip_lib.dump_neigh_entries(ip_version, device_name, namespace, dst=ip, lladdr=mac) - return entry != [] + return bool(entry) class TestMonitorDaemon(base.BaseLoggingTestCase):