From 550c0fe2c509ff4c167d19031e3a9cc2ec62dbc0 Mon Sep 17 00:00:00 2001 From: Bernardo Decco Date: Tue, 21 Sep 2021 11:41:50 -0300 Subject: [PATCH] Re-enable important py3k checks for gui Re-enabling some of the disabled tox warnings present on the pylint.rc file Re-enabling: W1619: old-division W1633: round-builtin W1637: zip-builtin-not-iterating W1639: filter-builtin-not-iterating Note: W1633: Was suppressed inline and floated to keep the same behavior from py2 W1619: No change needed. Suppressed inline added. 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: 43381 Signed-off-by: Bernardo Decco Change-Id: I809adc421a155f5efcc88827b00401477eecb1f3 --- pylint.rc | 7 +------ .../starlingx_dashboard/api/sysinv.py | 13 ++++++++----- .../dashboards/admin/inventory/memories/forms.py | 7 ++++--- .../dashboards/admin/inventory/tables.py | 5 +++-- .../dashboards/admin/inventory/tabs.py | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/pylint.rc b/pylint.rc index acc89fa3..8fd6acf5 100755 --- a/pylint.rc +++ b/pylint.rc @@ -116,10 +116,6 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652, # W0613 Unused argument warning # W0703 broad except warning # W1618: no-absolute-import -# W1619: old-division -# W1633: round-builtin -# W1637: zip-builtin-not-iterating -# W1639: filter-builtin-not-iterating # E0202 method-hidden # E0203 access-member-before-definition # E1101 no-member @@ -128,8 +124,7 @@ enable=E1603,E1609,E1610,E1602,E1606,E1608,E1607,E1605,E1604,E1601,E1611,W1652, # E0401: Unable to import 'django.core.urlresolvers' (import-error) # E0611: No name 'urlresolvers' in module 'django.core' (no-name-in-module) disable=C, R, W0107, W0201, W0212, W0221, W0235, - W0403, W0511, W0613, W0703, W1618, W1619, - W1633, W1637, W1639, + W0403, W0511, W0613, W0703, W1618, E0202, E0203, E1101, E0401, E0611 [REPORTS] diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/sysinv.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/sysinv.py index 60bdfa0f..758c0970 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/sysinv.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/api/sysinv.py @@ -288,11 +288,13 @@ class Disk(base.APIResourceWrapper): @property def size_gib(self): - return math.floor(float(self.size_mib) / 1024 * 1000) / 1000.0 + return math.floor(float(self.size_mib) / # pylint: disable=W1619 + 1024 * 1000) / 1000.0 @property def available_gib(self): - return math.floor(float(self.available_mib) / 1024 * 1000) / 1000.0 + return math.floor(float(self.available_mib) / # pylint: disable=W1619 + 1024 * 1000) / 1000.0 class StorageVolume(base.APIResourceWrapper): @@ -384,7 +386,8 @@ class Partition(base.APIResourceWrapper): @property def size_gib(self): - return math.floor(float(self.size_mib) / 1024 * 1000) / 1000.0 + return math.floor(float(self.size_mib) / # pylint: disable=W1619 + 1024 * 1000) / 1000.0 def host_disk_partition_list(request, host_id, disk_id=None): @@ -443,12 +446,12 @@ class LocalVolumeGroup(base.APIResourceWrapper): @property def lvm_vg_size_gib(self): - return math.floor(float( + return math.floor(float( # pylint: disable=W1619 self.lvm_vg_size) / (1024 ** 3) * 1000) / 1000.0 @property def lvm_vg_avail_size_gib(self): - return math.floor(float( + return math.floor(float( # pylint: disable=W1619 self.lvm_vg_avail_size) / (1024 ** 3) * 1000) / 1000.0 diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/memories/forms.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/memories/forms.py index 84308752..6edf905a 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/memories/forms.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/memories/forms.py @@ -345,9 +345,10 @@ class UpdateMemory(forms.SelfHandlingForm): vm_2M_field.initial = str(m.vm_hugepages_nr_2M_pending) elif m.vm_hugepages_nr_2M: if(m.vm_pending_as_percentage == "True"): - vm_2M_field.initial = str( - round(m.vm_hugepages_nr_2M * - 100 // m.vm_hugepages_possible_2M)) + vm_2M_field.initial = str(float( + round( # pylint: disable=W1633 + m.vm_hugepages_nr_2M * 100 \ + // m.vm_hugepages_possible_2M))) else: vm_2M_field.initial = str(m.vm_hugepages_nr_2M) else: diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/tables.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/tables.py index 96853c98..589ea069 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/tables.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/tables.py @@ -605,7 +605,7 @@ class HostsWorkerFilterAction(tables.FilterAction): return True return False - return filter(comp, hosts) + return list(filter(comp, hosts)) def get_install_percent(cell): @@ -640,7 +640,8 @@ def get_task_or_status(host): if host.install_state_info and '/' in \ host.install_state_info.rstrip('+'): values = (host.install_state_info.rstrip('+')).split('/') - percent = (float(values[0]) / float(values[1])) * 100 + percent = (float(values[0]) / # pylint: disable=W1619 + float(values[1])) * 100 task_or_status += " (%d%%)" % percent elif host.task: if '-' in host.task: diff --git a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/tabs.py b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/tabs.py index a56d53ff..8662dde7 100644 --- a/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/tabs.py +++ b/starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/inventory/tabs.py @@ -598,9 +598,9 @@ class InterfacesTab(tabs.TableTab): i.host_id = host.id port_data = \ - list(map(list, zip(*[(p.get_port_display_name(), - p.neighbours) for p in host.ports if - i.uuid == p.interface_uuid]))) + list(map(list, list(zip(*[(p.get_port_display_name(), + p.neighbours) for p in host.ports if + i.uuid == p.interface_uuid])))) if port_data: # Default interface