From c6d584f5e050cf79eb640bae3d6ca36e2788890f Mon Sep 17 00:00:00 2001
From: Ross Brattain <ross.b.brattain@intel.com>
Date: Wed, 25 Jan 2017 16:15:52 -0800
Subject: 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>
---
 api/resources/env_action.py | 2 +-
 api/utils/common.py         | 2 +-
 api/utils/influx.py         | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

(limited to 'api')

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)
-- 
cgit