Commit d3693342 authored by Jordan Rupprecht's avatar Jordan Rupprecht
Browse files

[NFC] Fix minor python issues.

* llvm-gisel-cov.py: extra `)` after print
* chunk-print-before-all.py: py2-only print method
parent dc1056a3
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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:
+4 −4
Original line number Diff line number Diff line
@@ -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)))