aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2017-01-25 16:15:52 -0800
committerRoss Brattain <ross.b.brattain@intel.com>2017-02-08 06:51:04 +0000
commitc6d584f5e050cf79eb640bae3d6ca36e2788890f (patch)
treebf4a69eb9f51e989947e80a7339a11429b9bf3b9
parenta4241e6e9b121447a50fdfe0d79b322c2e2aaea9 (diff)
pylint fixes: remove redundant parens, fix comparison order
removed redundant parens in if and while clauses use var != constant, not constant != var. Python doesn't allow for assignment in if statements, so we don't have to use the old C workarounds remove unwanted commas use raw strings for regexps with backslashes, e.g. r'\s' instead of '\s' Change-Id: I7aad645dd3d7f4b4b62f4e4510a425611c9d28f2 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
-rw-r--r--api/resources/env_action.py2
-rw-r--r--api/utils/common.py2
-rw-r--r--api/utils/influx.py2
-rw-r--r--yardstick/benchmark/core/__init__.py4
-rwxr-xr-xyardstick/benchmark/runners/arithmetic.py2
-rw-r--r--yardstick/benchmark/scenarios/networking/sfc_openstack.py2
-rwxr-xr-xyardstick/common/task_template.py4
7 files changed, 9 insertions, 9 deletions
diff --git a/api/resources/env_action.py b/api/resources/env_action.py
index 8955f3cb6..917681c37 100644
--- a/api/resources/env_action.py
+++ b/api/resources/env_action.py
@@ -248,7 +248,7 @@ def _get_remote_rc_file(rc_file, installer_ip, installer_type):
cmd = [os_fetch_script, '-d', rc_file, '-i', installer_type,
'-a', installer_ip]
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
- p.communicate()[0]
+ p.communicate()
if p.returncode != 0:
logger.debug('Failed to fetch credentials from installer')
diff --git a/api/utils/common.py b/api/utils/common.py
index 1c800ce49..3e9bf8f8b 100644
--- a/api/utils/common.py
+++ b/api/utils/common.py
@@ -33,7 +33,7 @@ def get_command_list(command_list, opts, args):
command_list.append(args)
- command_list.extend(('--{}'.format(k) for k in opts if 'task-args' != k))
+ command_list.extend(('--{}'.format(k) for k in opts if k != 'task-args'))
task_args = opts.get('task-args', '')
if task_args:
diff --git a/api/utils/influx.py b/api/utils/influx.py
index 275c63a24..08996b9c9 100644
--- a/api/utils/influx.py
+++ b/api/utils/influx.py
@@ -24,7 +24,7 @@ def get_data_db_client():
try:
parser.read(conf.OUTPUT_CONFIG_FILE_PATH)
- if 'influxdb' != parser.get('DEFAULT', 'dispatcher'):
+ if parser.get('DEFAULT', 'dispatcher') != 'influxdb':
raise RuntimeError
return _get_client(parser)
diff --git a/yardstick/benchmark/core/__init__.py b/yardstick/benchmark/core/__init__.py
index 161e448cc..79ebc732f 100644
--- a/yardstick/benchmark/core/__init__.py
+++ b/yardstick/benchmark/core/__init__.py
@@ -33,6 +33,6 @@ class Param(object):
def print_hbar(barlen):
"""print to stdout a horizontal bar"""
- print("+"),
- print("-" * barlen),
+ print("+")
+ print("-" * barlen)
print("+")
diff --git a/yardstick/benchmark/runners/arithmetic.py b/yardstick/benchmark/runners/arithmetic.py
index d5605f755..65fdb9d66 100755
--- a/yardstick/benchmark/runners/arithmetic.py
+++ b/yardstick/benchmark/runners/arithmetic.py
@@ -139,7 +139,7 @@ def _worker_process(queue, cls, method_name, scenario_cfg,
sequence += 1
- if (errors and sla_action is None):
+ if errors and sla_action is None:
break
benchmark.teardown()
diff --git a/yardstick/benchmark/scenarios/networking/sfc_openstack.py b/yardstick/benchmark/scenarios/networking/sfc_openstack.py
index caaf10060..be24add32 100644
--- a/yardstick/benchmark/scenarios/networking/sfc_openstack.py
+++ b/yardstick/benchmark/scenarios/networking/sfc_openstack.py
@@ -81,7 +81,7 @@ def create_floating_ips(neutron_client): # pragma: no cover
ips = []
props = {'floating_network_id': extnet_id}
try:
- while (len(ips) < 2):
+ while len(ips) < 2:
ip_json = neutron_client.create_floatingip({'floatingip': props})
fip_addr = ip_json['floatingip']['floating_ip_address']
ips.append(fip_addr)
diff --git a/yardstick/common/task_template.py b/yardstick/common/task_template.py
index bda8a1b13..9acc21336 100755
--- a/yardstick/common/task_template.py
+++ b/yardstick/common/task_template.py
@@ -45,11 +45,11 @@ def is_really_missing(mis, task_template):
# Removing variables that have default values from
# missing. Construction that won't be properly
# check is {% set x = x or 1}
- if re.search(mis.join(["{%\s*set\s+", "\s*=\s*", "[^\w]+"]),
+ if re.search(mis.join([r"{%\s*set\s+", "\s*=\s*", r"[^\w]+"]),
task_template):
return False
# Also check for a default filter which can show up as
# a missing variable
- if re.search(mis + "\s*\|\s*default\(", task_template):
+ if re.search(mis + r"\s*\|\s*default\(", task_template):
return False
return True