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:
Brian Haley 2023-05-07 23:54:24 -04:00
parent ed274efcf7
commit 10ff1caaca
6 changed files with 8 additions and 9 deletions

View File

@ -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,

View File

@ -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(

View File

@ -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

View File

@ -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):

View File

@ -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):

View File

@ -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):