Browse Source

Re-enable important py3k checks for fault

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

Re-enabling:

W1641: eq-without-hash
W1619: old-division

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: 43429
Signed-off-by: Bernardo Decco <bernardo.deccodesiqueira@windriver.com>
Change-Id: I333a936bd2ee10c19e5d9e6dae23a0b9be6fc2a1
changes/68/810768/4
Bernardo Decco 4 months ago
parent
commit
8b64e53985
  1. 3
      fm-rest-api/fm/fm/api/controllers/v1/base.py
  2. 10
      pylint.rc
  3. 3
      python-fmclient/fmclient/fmclient/common/base.py
  4. 10
      python-fmclient/fmclient/fmclient/common/wrapping_formatters.py

3
fm-rest-api/fm/fm/api/controllers/v1/base.py

@ -127,5 +127,8 @@ class Version(object):
def __eq__(self, other):
return (self.major, self.minor) == (other.major, other.minor)
def __hash__(self):
return hash((self.major, self.minor))
def __ne__(self, other):
return not self.__eq__(other)

10
pylint.rc

@ -146,8 +146,6 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652,
# W0703 broad-except
# W1401 anomalous-backslash-in-string
# W1618: no-absolute-import
# W1619: old-division
# W1641: eq-without-hash
# E are error codes
# E0604 invalid-all-object
# E1101 no-member
@ -157,10 +155,10 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652,
# NOTE: these are suppressed until py3 support merges:
# W0143,W1505,E0604,E0611,E0702,E1136,E0401
disable=C, R, fixme,
W0102,W0106,W0107,W0110,W0201,W0212,W0221,W0223,W0231,W0237,W0235,
W0311,W0403,W0603,W0612,W0613,W0621,W0622,W0703,W1401,
W0143,W1505,W1618,W1619,W1641,E0604,E0611,E0702,E1136,
E0401,E0604,E1101,E1102,E1120,E1121
W0102,W0106,W0107,W0110,W0201,W0212,W0221,W0223,W0231,
W0237,W0235,W0311,W0403,W0603,W0612,W0613,W0621,W0622,
W0703,W1401,W0143,W1505,W1618,E0604,E0611,E0702,E1136,
E0401,E0604,E1101,E1102,E1120,E1121
[REPORTS]
# Set the output format. Available formats are text, parseable, colorized, msvs

3
python-fmclient/fmclient/fmclient/common/base.py

@ -139,6 +139,9 @@ class Resource(object):
return self.id == other.id
return self._info == other._info
def __hash__(self):
return hash((self._info, self.manager, self._loaded))
def is_loaded(self):
return self._loaded

10
python-fmclient/fmclient/fmclient/common/wrapping_formatters.py

@ -454,15 +454,15 @@ def build_column_stats_for_best_guess_formatting(objs, fields, field_labels, cus
if value_width > self.max_width:
self.max_width = value_width
if self.count > 0:
self.average_width = float(self.total_width) / float(self.count)
self.average_width = float(self.total_width) / float(self.count) # pylint: disable=old-division
def set_max_percent(self, max_total_width):
if max_total_width > 0:
self.max_percent = float(self.max_width) / float(max_total_width)
self.max_percent = float(self.max_width) / float(max_total_width) # pylint: disable=old-division
def set_avg_percent(self, avg_total_width):
if avg_total_width > 0:
self.average_percent = float(self.average_width) / float(avg_total_width)
self.average_percent = float(self.average_width) / float(avg_total_width) # pylint: disable=old-division
def __str__(self):
return str([self.field,
@ -514,7 +514,7 @@ def build_best_guess_formatters_using_average_widths(objs, fields, field_labels,
if total_avg_width <= 0:
return format_spec
for f in [ff for ff in fields if ff not in no_wrap_fields]:
format_spec[f] = float(column_info["stats"][f].average_width) / total_avg_width
format_spec[f] = float(column_info["stats"][f].average_width) / total_avg_width # pylint: disable=old-division
custom_formatter = custom_formatters.get(f, None)
if custom_formatter:
format_spec[f] = {"formatter": custom_formatter, "wrapperFormatter": format_spec[f]}
@ -532,7 +532,7 @@ def build_best_guess_formatters_using_max_widths(objs, fields, field_labels, cus
column_info = build_column_stats_for_best_guess_formatting(objs, fields, field_labels, custom_formatters)
format_spec = {}
for f in [ff for ff in fields if ff not in no_wrap_fields]:
format_spec[f] = float(column_info["stats"][f].max_width) / float(column_info["total_max_width"])
format_spec[f] = float(column_info["stats"][f].max_width) / float(column_info["total_max_width"]) # pylint: disable=old-division
custom_formatter = custom_formatters.get(f, None)
if custom_formatter:
format_spec[f] = {"formatter": custom_formatter, "wrapperFormatter": format_spec[f]}

Loading…
Cancel
Save