From 00276e417ee7112549405e7c490a8e00bd1118ca Mon Sep 17 00:00:00 2001 From: Jordan Rupprecht Date: Fri, 28 Feb 2020 14:11:21 -0800 Subject: [PATCH] [NFC] Fix minor python issues. * llvm-gisel-cov.py: extra `)` after print * chunk-print-before-all.py: py2-only print method --- utils/chunk-print-before-all.py | 6 ++++-- utils/llvm-gisel-cov.py | 8 ++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/utils/chunk-print-before-all.py b/utils/chunk-print-before-all.py index ce17c68c742..b036e380ef9 100755 --- a/utils/chunk-print-before-all.py +++ b/utils/chunk-print-before-all.py @@ -5,6 +5,8 @@ # "crashinfo.txt" file leaving only the valid input IR in the last chunk. # Files are written to current working directory. +from __future__ import print_function + import sys basename = "chunk-" @@ -15,7 +17,7 @@ def print_chunk(lines): global basename fname = basename + str(chunk_id) + ".ll" chunk_id = chunk_id + 1 - print "writing chunk " + fname + " (" + str(len(lines)) + " lines)" + print("writing chunk " + fname + " (" + str(len(lines)) + " lines)") with open(fname, "w") as f: f.writelines(lines) @@ -35,7 +37,7 @@ for line in sys.stdin: cur.append(line) if is_dump: - print "writing crashinfo.txt (" + str(len(cur)) + " lines)" + print("writing crashinfo.txt (" + str(len(cur)) + " lines)") with open("crashinfo.txt", "w") as f: f.writelines(cur) else: diff --git a/utils/llvm-gisel-cov.py b/utils/llvm-gisel-cov.py index 820fceab0d0..88b19455ac3 100755 --- a/utils/llvm-gisel-cov.py +++ b/utils/llvm-gisel-cov.py @@ -15,11 +15,11 @@ class FileFormatError(Exception): def backend_int_pair(s): backend, sep, value = s.partition('=') - if (sep is None): + if sep is None: raise argparse.ArgumentTypeError("'=' missing, expected name=value") - if (not backend): + if not backend: raise argparse.ArgumentTypeError("Expected name=value") - if (not value): + if not value: raise argparse.ArgumentTypeError("Expected name=value") return backend, int(value) @@ -60,7 +60,7 @@ def main(): num_rules = dict(args.num_rules) for backend, rules_for_backend in covered_rules.items(): if backend in num_rules: - print("%s: %3.2f%% of rules covered" % (backend, float(len(rules_for_backend)) / num_rules[backend]) * 100)) + print("%s: %3.2f%% of rules covered" % (backend, float(len(rules_for_backend)) / num_rules[backend]) * 100) else: print("%s: %d rules covered" % (backend, len(rules_for_backend)))