Re-enable important py3k checks for utilities

Re-enabling some of the disabled tox warnings present on
the pylint.rc file
Re-enabling:

W1619: old-division
W1636: map-builtin-not-iterating
W1638: range-builtin-not-iterating
W1645: exception-message-attribute

Note: W1645 was suppressed inline since the self refersto the class
attribute and not the Exception.message from BaseException PEP 352

Test Plan: Sanity test run on AIO-SX:

PASS: test_system_health_pre_session[pods]
PASS: test_system_health_pre_session[alarms]
PASS: test_system_health_pre_session[system_apps]
PASS: test_wr_analytics[deploy_and_remove]
PASS: test_horizon_host_inventory_display
PASS: test_lock_unlock_host[controller]
PASS: test_pod_to_pod_connection
PASS: test_pod_to_service_connection
PASS: test_host_to_service_connection

Story: 2006796
Task: 43376
Signed-off-by: Bernardo Decco <bernardo.deccodesiqueira@windriver.com>
Change-Id: I23ea193a3e794f28dcf0ea00f9a2aedb17283d1e
This commit is contained in:
Bernardo Decco 2021-09-21 10:11:24 -03:00 committed by Bernardo Decco de Siqueira
parent ce04afb95e
commit 5862f6a009
6 changed files with 10 additions and 14 deletions

View File

@ -21,13 +21,13 @@ class CephManagerException(Exception):
self.kwargs = kwargs self.kwargs = kwargs
if not message: if not message:
try: try:
message = self.message % kwargs message = self.message % kwargs # pylint: disable=W1645
except TypeError: except TypeError:
LOG.warn(_LW('Exception in string format operation')) LOG.warn(_LW('Exception in string format operation'))
for name, value in kwargs.items(): for name, value in kwargs.items():
LOG.error("%s: %s" % (name, value)) LOG.error("%s: %s" % (name, value))
# at least get the core message out if something happened # at least get the core message out if something happened
message = self.message message = self.message # pylint: disable=W1645
super(CephManagerException, self).__init__(message) super(CephManagerException, self).__init__(message)

View File

@ -386,7 +386,7 @@ class Monitor(HandleUpgradesMixin):
return 0 return 0
else: else:
try: try:
quota_gib = int(quota["output"]["quota_max_bytes"]) / (1024**3) quota_gib = int(quota["output"]["quota_max_bytes"]) // (1024**3)
return quota_gib return quota_gib
except IOError: except IOError:
return 0 return 0
@ -475,7 +475,7 @@ class Monitor(HandleUpgradesMixin):
if (chassis_size == 0 or if (chassis_size == 0 or
chassis_size > host['kb']): chassis_size > host['kb']):
chassis_size = host['kb'] chassis_size = host['kb']
tier_size += chassis_size / (1024**2) tier_size += chassis_size // (1024**2)
tier_sizes[tier['name']] = tier_size tier_sizes[tier['name']] = tier_size
return tier_sizes return tier_sizes

View File

@ -11,10 +11,10 @@ class CephClientException(Exception):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
if "message" not in kwargs: if "message" not in kwargs:
try: try:
message = self.message.format(*args, **kwargs) message = self.message.format(*args, **kwargs) # pylint: disable=W1645
except Exception: # noqa except Exception: # noqa
message = '{}, args:{}, kwargs: {}'.format( message = '{}, args:{}, kwargs: {}'.format(
self.message, args, kwargs) self.message, args, kwargs) # pylint: disable=W1645
else: else:
message = kwargs["message"] message = kwargs["message"]
super(CephClientException, self).__init__(message) super(CephClientException, self).__init__(message)

View File

@ -148,14 +148,10 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652,
# W1202: logging-format-interpolation # W1202: logging-format-interpolation
# W1401: anomalous-backslash-in-string # W1401: anomalous-backslash-in-string
# W1618: no-absolute-import # W1618: no-absolute-import
# W1619: old-division
# W1636: map-builtin-not-iterating
# W1638: range-builtin-not-iterating
# W1645: exception-message-attribute
disable=C,R,fixme, disable=C,R,fixme,
E0203,E0611,E1101,E1135,E1205, E0203,E0611,E1101,E1135,E1205,
W0107,W0150,W0201,W0221,W0231,W0235,W0603,W0611,W0612,W0613,W0621,W0622, W0107,W0150,W0201,W0221,W0231,W0235,W0603,W0611,W0612,W0613,W0621,W0622,
W0702,W0703,W1201,W1202,W1401,W1618,W1619,W1636,W1638,W1645 W0702,W0703,W1201,W1202,W1401,W1618
[REPORTS] [REPORTS]
# Set the output format. Available formats are text, parseable, colorized, msvs # Set the output format. Available formats are text, parseable, colorized, msvs

View File

@ -32,7 +32,7 @@ def range_to_list(csv_range=None):
""" """
if not csv_range: if not csv_range:
return [] return []
xranges = [(lambda L: range(L[0], L[-1] + 1))(map(int, r.split('-'))) xranges = [(lambda L: list(range(L[0], L[-1] + 1)))(list(map(int, r.split('-'))))
for r in csv_range.split(',')] for r in csv_range.split(',')]
return [y for x in xranges for y in x] return [y for x in xranges for y in x]

View File

@ -54,9 +54,9 @@ class instance:
def update(self, domain): def update(self, domain):
cells = set() cells = set()
for node_id in domain['nodelist']: for node_id in domain['nodelist']:
cell = numa_cell(node_id, range(domain['nr_vcpus']), domain['cpu_pinning']) cell = numa_cell(node_id, list(range(domain['nr_vcpus'])), domain['cpu_pinning'])
LOG.debug("cell_id=%s, vcpuset=%s, cpu_pinning=%s" LOG.debug("cell_id=%s, vcpuset=%s, cpu_pinning=%s"
% (node_id, range(domain['nr_vcpus']), domain['cpu_pinning'])) % (node_id, list(range(domain['nr_vcpus'])), domain['cpu_pinning']))
cells.update([cell]) cells.update([cell])
self.numa_topology = numa_topology(self.uuid, cells) self.numa_topology = numa_topology(self.uuid, cells)