From 2344de88df41dea6ea503c74db16fec2c561fe9c Mon Sep 17 00:00:00 2001 From: Eric Barrett Date: Tue, 26 Mar 2019 15:02:53 -0400 Subject: [PATCH] Enable Flake8 Whitespace Errors Flake8 currently ignores a number of whitespace related errors: E201: whitespace after '[' E202: whitespace before '}' E203: whitespace before ':' E211: whitespace before '(' E221: multiple spaces before operator E222: multiple spaces after operator E225: missing whitespace around operator E226: missing whitespace around arithmetic operator E231: missing whitespace after ',' E251: unexpected spaces around keyword / parameter equals E261: at least two spaces before inline comment Enable them for more thorough testing of code Change-Id: Id03f36070b8f16694a12f4d36858680b6e00d530 Story: 2004515 Task: 30076 Signed-off-by: Eric Barrett --- collectd-extensions/src/cpu.py | 2 +- collectd-extensions/src/interface.py | 2 +- collectd-extensions/src/remotels.py | 2 +- vm-topology/vm-topology/vm_topology/exec/vm_topology.py | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/collectd-extensions/src/cpu.py b/collectd-extensions/src/cpu.py index 0983255..7789350 100755 --- a/collectd-extensions/src/cpu.py +++ b/collectd-extensions/src/cpu.py @@ -217,7 +217,7 @@ def read_func(): else: _delta = (c.cpu_time[_cpu_count] - c.cpu_time_last[_cpu_count]) _delta = _delta / 1000000 / _time_delta - cpu_occupancy.append(float((100*(_delta))/1000)) + cpu_occupancy.append(float((100 * (_delta)) / 1000)) c.total_avg_cpu += cpu_occupancy[_cpu_count] if debug: collectd.info('%s cpu %d - count:%d [%s]' % diff --git a/collectd-extensions/src/interface.py b/collectd-extensions/src/interface.py index 7b44de8..2145475 100755 --- a/collectd-extensions/src/interface.py +++ b/collectd-extensions/src/interface.py @@ -416,7 +416,7 @@ def get_timestamp(lmon_time): if lmon_time: try: - return(float(float(lmon_time)/1000000)) + return(float(float(lmon_time) / 1000000)) except: collectd.error("%s failed to parse timestamp ;" " using current time" % PLUGIN) diff --git a/collectd-extensions/src/remotels.py b/collectd-extensions/src/remotels.py index 9a766d9..0f7aa46 100755 --- a/collectd-extensions/src/remotels.py +++ b/collectd-extensions/src/remotels.py @@ -268,7 +268,7 @@ def read_func(): UPPER_HEX_IP += val UPPER_HEX_IP += ':' tmp = hex(int(port)).split('x')[-1].upper() - for i in range(4-len(tmp)): + for i in range(4 - len(tmp)): UPPER_HEX_IP += '0' UPPER_HEX_IP += tmp diff --git a/vm-topology/vm-topology/vm_topology/exec/vm_topology.py b/vm-topology/vm-topology/vm_topology/exec/vm_topology.py index 0968ced..f6a5fe6 100644 --- a/vm-topology/vm-topology/vm_topology/exec/vm_topology.py +++ b/vm-topology/vm-topology/vm_topology/exec/vm_topology.py @@ -91,7 +91,7 @@ show = {} # Constants Ki = 1024 -Mi = Ki*Ki +Mi = Ki * Ki # Active worker pids active_pids = multiprocessing.Manager().dict() @@ -605,8 +605,8 @@ def do_libvirt_domain_info(tuple_hosts): with suppress_stdout_stderr(): d_vcpus = dom.vcpus() except Exception as e: - d_vcpus = tuple([d_nrVirtCpu*[], - d_nrVirtCpu*[tuple(total_cpus * [False])]]) + d_vcpus = tuple([d_nrVirtCpu * [], + d_nrVirtCpu * [tuple(total_cpus * [False])]]) # Obtain cpulist of pcpus in the order of vcpus. This applies to either # pinned or floating vcpus, Note that the cpuinfo pcpu value can be @@ -1379,7 +1379,7 @@ def print_all_tables(tenants=None, I.name, I.min_disk, I.min_ram, - '%.2f' % (I.size/1024.0/1024.0), + '%.2f' % (I.size / 1024.0 / 1024.0), I.status, I.properties, ])