Mercurial > ~darius > hgwebdir.cgi > pyinst
diff find.py @ 56:91b476ebc0f2
Run through 2to3
author | Daniel O'Connor <doconnor@gsoft.com.au> |
---|---|
date | Tue, 08 Dec 2020 14:00:45 +1030 |
parents | df1b4d7e988f |
children |
line wrap: on
line diff
--- a/find.py Tue Dec 08 13:59:05 2020 +1030 +++ b/find.py Tue Dec 08 14:00:45 2020 +1030 @@ -4,6 +4,7 @@ import getopt import numpy import sys +from functools import reduce if __name__ == "__main__": opts, args = getopt.getopt(sys.argv[1:], "e:hm:s") @@ -13,13 +14,13 @@ dostats = False for o, a in opts: if o == "-h": - print """Find data files with certain characteristics + print("""Find data files with certain characteristics %s [-h] [-e exp] [-m min] [-s] file [file ..] exp Limit to experiment tag exp min Find files with power greater than min -s Print stats about files -""" +""") elif o == "-e": exptag = a elif o == "-m": @@ -27,16 +28,16 @@ elif o == "-s": dostats = True else: - print "Unknown option " + o + print("Unknown option " + o) sys.exit(1) if len(args) == 0: - print "Need at least one file to analyse" + print("Need at least one file to analyse") sys.exit(1) minfiles = [] if dostats: - print "%-50s %7s %7s %7s (dBm)" % ("Name", "Min", "Mean", "Max") + print("%-50s %7s %7s %7s (dBm)" % ("Name", "Min", "Mean", "Max")) for fn in args: dfile = datafile.DataFile(fn) @@ -48,12 +49,12 @@ minfiles.append(fn) if dostats: - print "%-50s %7.2f %7.2f %7.2f" % (fn, dfile.powers.min(), dfile.powers.mean(), dfile.powers.max()) + print("%-50s %7.2f %7.2f %7.2f" % (fn, dfile.powers.min(), dfile.powers.mean(), dfile.powers.max())) if minlev != None: if dostats: - print "" - print "Files with any sample exceeding %.2f dBm:" % (minlev) + print("") + print("Files with any sample exceeding %.2f dBm:" % (minlev)) for fn in minfiles: - print fn + print(fn)