summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTill Maas <opensource@till.name>2010-04-04 01:08:23 +0200
committerTill Maas <opensource@till.name>2010-04-04 01:08:23 +0200
commit98e0af485ded1ac7031fd61929d12595d6be57cf (patch)
treee52697cf275e28872bb2e167cbb28a42d39e313c
parent80439d6ae1c4cf32ea4434a73f70c3ff5bf7772a (diff)
downloadfedora-easy-karma-98e0af485ded1ac7031fd61929d12595d6be57cf.tar.gz
fedora-easy-karma-98e0af485ded1ac7031fd61929d12595d6be57cf.tar.xz
fedora-easy-karma-98e0af485ded1ac7031fd61929d12595d6be57cf.zip
pylint related cleanups
-rwxr-xr-xfedora-easy-karma.py154
1 files changed, 77 insertions, 77 deletions
diff --git a/fedora-easy-karma.py b/fedora-easy-karma.py
index aabc90f..a3d234f 100755
--- a/fedora-easy-karma.py
+++ b/fedora-easy-karma.py
@@ -111,7 +111,7 @@ class FedoraEasyKarma(object):
bc = BodhiClient(username=self.options.fas_username, useragent="Fedora Easy Karma/GIT")
my = yum.YumBase()
- my.preconf.debuglevel=0
+ my.preconf.debuglevel = 0
if not self.options.releasever:
self.options.releasever = my.conf.yumvar["releasever"]
@@ -232,97 +232,97 @@ class FedoraEasyKarma(object):
def bodhi_update_str(self, update, bodhi_base_url="https://admin.fedoraproject.org/updates/", bugzilla_bug_url="https://bugzilla.redhat.com/", wrap_bugs=True, width=80):
+
+ # copy update to avoid side effects
+ values = dict(update)
+ format_string = (
+ "%(header_line)s\n"
+ "%(title)s\n"
+ "%(header_line)s\n"
+ "%(updateid)s"
+ " Release: %(release)s\n"
+ " Status: %(status)s\n"
+ " Type: %(type)s\n"
+ " Karma: %(karma)d\n"
+ "%(request)s"
+ "%(bugs)s"
+ "%(notes)s"
+ " Submitter: %(submitter)s\n"
+ " Submitted: %(date_submitted)s\n"
+ "%(comments)s"
+ "\n%(update_url)s"
+ )
+
+ values["header_line"] = "=" * width
+ values["title"] = "\n".join(wrap(update["title"].replace(",", ", "), width=width, initial_indent=" "*5, subsequent_indent=" "*5))
+
+ if update["updateid"]:
+ values["updateid"] = " Update ID: %s\n" % update["updateid"]
+ else:
+ values["updateid"] = ""
- # copy update to avoid side effects
- values = dict(update)
- format_string = (
- "%(header_line)s\n"
- "%(title)s\n"
- "%(header_line)s\n"
- "%(updateid)s"
- " Release: %(release)s\n"
- " Status: %(status)s\n"
- " Type: %(type)s\n"
- " Karma: %(karma)d\n"
- "%(request)s"
- "%(bugs)s"
- "%(notes)s"
- " Submitter: %(submitter)s\n"
- " Submitted: %(date_submitted)s\n"
- "%(comments)s"
- "\n%(update_url)s"
- )
-
- values["header_line"] = "=" * width
- values["title"] = "\n".join(wrap(update["title"].replace(",", ", "), width=width, initial_indent=" "*5, subsequent_indent=" "*5))
-
- if update["updateid"]:
- values["updateid"] = " Update ID: %s\n" % update["updateid"]
- else:
- values["updateid"] = ""
-
- values["release"] = update["release"]["long_name"]
+ values["release"] = update["release"]["long_name"]
- if update["request"]:
- values["request"] = " Request: %s\n" % update["request"]
- else:
- values["request"] = ""
-
- if len(update["bugs"]):
- bugs = []
- for bug in update["bugs"]:
- bz_id = bug["bz_id"]
- if bugzilla_bug_url:
- bz_id = "%s%d" % ( bugzilla_bug_url, bz_id)
- bz_title = bug["title"]
- bugs.append("%s - %s" % (bz_id, bz_title))
-
- if wrap_bugs:
- values["bugs"] = "%s\n" % self.wrap_paragraphs_prefix(bugs, first_prefix=" Bugs: ", width=width, extra_newline=True)
- else:
- values["bugs"] = " Bugs: %s\n" % ("\n" + " " * 11 + ": ").join(bugs)
+ if update["request"]:
+ values["request"] = " Request: %s\n" % update["request"]
+ else:
+ values["request"] = ""
+
+ if len(update["bugs"]):
+ bugs = []
+ for bug in update["bugs"]:
+ bz_id = bug["bz_id"]
+ if bugzilla_bug_url:
+ bz_id = "%s%d" % ( bugzilla_bug_url, bz_id)
+ bz_title = bug["title"]
+ bugs.append("%s - %s" % (bz_id, bz_title))
+
+ if wrap_bugs:
+ values["bugs"] = "%s\n" % self.wrap_paragraphs_prefix(bugs, first_prefix=" Bugs: ", width=width, extra_newline=True)
else:
- values["bugs"] = ""
+ values["bugs"] = " Bugs: %s\n" % ("\n" + " " * 11 + ": ").join(bugs)
+ else:
+ values["bugs"] = ""
- if update["notes"]:
- values["notes"] = "%s\n" % self.wrap_paragraphs_prefix(update["notes"].split("\r\n"), first_prefix=" Notes: ", width=width)
- else:
- values["notes"] = ""
+ if update["notes"]:
+ values["notes"] = "%s\n" % self.wrap_paragraphs_prefix(update["notes"].split("\r\n"), first_prefix=" Notes: ", width=width)
+ else:
+ values["notes"] = ""
- if len(update["comments"]):
- val = " Comments: "
- comments = []
- for comment in update["comments"]:
+ if len(update["comments"]):
+ val = " Comments: "
+ comments = []
+ for comment in update["comments"]:
- # copy comment to avoid side effects
- comment = dict(comment)
+ # copy comment to avoid side effects
+ comment = dict(comment)
- indent = " " * 13
- comment["indent"] = indent
+ indent = " " * 13
+ comment["indent"] = indent
- if comment["anonymous"]:
- comment["author"] += " (unauthenticated)"
+ if comment["anonymous"]:
+ comment["author"] += " (unauthenticated)"
- comments.append("%(indent)s%(author)s - %(timestamp)s (karma %(karma)s)" % comment)
+ comments.append("%(indent)s%(author)s - %(timestamp)s (karma %(karma)s)" % comment)
- if comment["text"]:
- wrapped = wrap(comment["text"], initial_indent=indent, subsequent_indent=indent, width=width)
- comments.append("\n".join(wrapped))
- val += "\n".join(comments).lstrip() + "\n"
- values["comments"] = val
- else:
- values["comments"] = ""
+ if comment["text"]:
+ wrapped = wrap(comment["text"], initial_indent=indent, subsequent_indent=indent, width=width)
+ comments.append("\n".join(wrapped))
+ val += "\n".join(comments).lstrip() + "\n"
+ values["comments"] = val
+ else:
+ values["comments"] = ""
- if update["updateid"]:
- url_path = "%s/%s" % (update["release"]["name"], update["updateid"])
- else:
- url_path = update["title"]
+ if update["updateid"]:
+ url_path = "%s/%s" % (update["release"]["name"], update["updateid"])
+ else:
+ url_path = update["title"]
- values["update_url"] = " %s%s\n" % (bodhi_base_url, url_path)
+ values["update_url"] = " %s%s\n" % (bodhi_base_url, url_path)
- return format_string % values
+ return format_string % values
def debug(self, message, update_timestamp=True):
if self.options.debug: