From 84cbff435c6f31579818ca06181cbd3c15b9cffb Mon Sep 17 00:00:00 2001 From: danghai Date: Fri, 6 Jul 2018 13:10:12 -0700 Subject: [PATCH] Improve pylint --- sktm/db.py | 16 ++++++++-------- sktm/jenkins.py | 12 ++++++------ sktm/patchwork.py | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sktm/db.py b/sktm/db.py index 823fa4a..15763b1 100644 --- a/sktm/db.py +++ b/sktm/db.py @@ -32,12 +32,12 @@ def __del__(self): self.conn.close() def createdb(self, db): - tc = sqlite3.connect(db) - c = tc.cursor() + conn = sqlite3.connect(db) + cur = conn.cursor() # FIXME The "patchsource_id" field should be a part of the primary key # for "patch" table. - c.executescript(""" + cur.executescript(""" PRAGMA foreign_keys = on; CREATE TABLE baserepo( @@ -85,9 +85,9 @@ def createdb(self, db): FOREIGN KEY(testrun_id) REFERENCES testrun(id) );""") - tc.commit() - c.close() - tc.close() + conn.commit() + cur.close() + conn.close() def create_repoid(self, baserepo): """Create a repoid for a git repo URL. @@ -598,7 +598,7 @@ def dump_baserepo_info(self): # pragma: no cover stable = self.get_stable(burl) latest = self.get_latest(burl) print("most recent stable commit: {} ({})".format( - stable, self.get_commitdate(burl, stable))) + stable, self.get_commitdate(burl, stable))) print("most recent stable commit: {} ({})".format( - latest, self.get_commitdate(burl, latest))) + latest, self.get_commitdate(burl, latest))) print("---") diff --git a/sktm/jenkins.py b/sktm/jenkins.py index 6b1eb20..0bf2021 100644 --- a/sktm/jenkins.py +++ b/sktm/jenkins.py @@ -68,9 +68,9 @@ def __get_data_list(self, jobname, buildid, stepname, key): raise Exception("No results for build %d (%s)" % (buildid, build.get_status())) - for (k, v) in build.get_resultset().iteritems(): - if k == stepname: - value_list.append(v.__dict__[key]) + for (key, value) in build.get_resultset().iteritems(): + if key == stepname: + value_list.append(value.__dict__[key]) return value_list @@ -256,9 +256,9 @@ def get_result(self, jobname, buildid): # Find earliest (worst) step failure step_failure_result_list = [ - ("skt.cmd_merge", sktm.tresult.MERGE_FAILURE), - ("skt.cmd_build", sktm.tresult.BUILD_FAILURE), - ("skt.cmd_run", sktm.tresult.TEST_FAILURE), + ("skt.cmd_merge", sktm.tresult.MERGE_FAILURE), + ("skt.cmd_build", sktm.tresult.BUILD_FAILURE), + ("skt.cmd_run", sktm.tresult.TEST_FAILURE), ] for (step, failure_result) in step_failure_result_list: if set(self.__get_data_list(jobname, buildid, step, "status")) & \ diff --git a/sktm/patchwork.py b/sktm/patchwork.py index e562735..440c3a3 100644 --- a/sktm/patchwork.py +++ b/sktm/patchwork.py @@ -924,8 +924,8 @@ def update_patch_name(self, patch): """ if 'root_comment' in patch: # internal RH only: rewrite the original subject line - e = email.message_from_string(patch['root_comment']['headers']) - subject = e.get('Subject') + msg = email.message_from_string(patch['root_comment']['headers']) + subject = msg.get('Subject') if subject is not None: subject = subject.replace('\n\t', ' ').replace('\n', ' ') # TODO What happens when subject is None?