summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <baker.dylan.c@gmail.com>2014-07-09 15:20:12 -0700
committerKenneth Graunke <kenneth@whitecape.org>2014-07-13 23:31:21 -0700
commit06f5ff1582e463b6868814310b153c35da6c5111 (patch)
tree92ea07404c3a6f366e95bde1ebd9f4aa082fb30a
parent90d6493e1d9d471d9293a32d62f6bbec06199e83 (diff)
report.py: Fix PEP8 issues
Changes: - uses rawstrings (r'foo') for regex strings - compare to None using 'is' and 'is not' - break long lines - fix hanging indents Signed-off-by: Dylan Baker <baker.dylan.c@gmail.com> Acked-by: Kenneth Graunke <kenneth@whitecape.org>
-rwxr-xr-xreport.py28
1 files changed, 17 insertions, 11 deletions
diff --git a/report.py b/report.py
index d1aab27..69fa9ec 100755
--- a/report.py
+++ b/report.py
@@ -10,10 +10,10 @@ def get_results(filename):
results = {}
- re_match = re.compile("(\S*)\s*(\S*)\s*:\s*(\S*)")
+ re_match = re.compile(r"(\S*)\s*(\S*)\s*:\s*(\S*)")
for line in lines:
match = re.search(re_match, line)
- if match == None:
+ if match is None:
continue
groups = match.groups()
@@ -63,7 +63,7 @@ def main():
namestr = name + " " + type
before_count = args.before[p]
- if args.after.get(p) != None:
+ if args.after.get(p) is not None:
after_count = args.after[p]
total_before += before_count
@@ -82,7 +82,7 @@ def main():
lost.append(namestr)
for p in args.after:
- if (args.before.get(p) == None):
+ if args.before.get(p) is None:
gained.append(p[0] + " " + p[1])
helped.sort()
@@ -91,10 +91,12 @@ def main():
if len(helped) > 0:
print("")
- hurt.sort(key=lambda k: float(args.after[k] - args.before[k]) / args.before[k])
+ hurt.sort(
+ key=lambda k: float(args.after[k] - args.before[k]) / args.before[k])
for p in hurt:
namestr = p[0] + " " + p[1]
- print("HURT: " + get_result_string(namestr, args.before[p], args.after[p]))
+ print("HURT: " + get_result_string(
+ namestr, args.before[p], args.after[p]))
if len(hurt) > 0:
print("")
@@ -110,11 +112,15 @@ def main():
if len(gained) > 0:
print("")
- print("total instructions in shared programs: " + change(total_before, total_after))
- print("instructions in affected programs: " + change(affected_before, affected_after))
- print("GAINED: {0}".format(len(gained)))
- print("LOST: {0}".format(len(lost)))
+ print("total instructions in shared programs: {0}\n"
+ "instructions in affected programs: {1}\n"
+ "GAINED: {2}\n"
+ "LOST: {3}".format(
+ change(total_before, total_after),
+ change(affected_before, affected_after),
+ len(gained),
+ len(lost)))
if __name__ == "__main__":
- main()
+ main()