|
[Rivet-svn] rivet: 2 new changesetsRivet Mercurial rivet at projects.hepforge.orgTue Oct 3 21:00:01 BST 2017
details: https://rivet.hepforge.org/hg/rivet/rev/86fc96ea6b07 branches: changeset: 6073:86fc96ea6b07 user: Andy Buckley <andy at insectnation.org> date: Tue Oct 03 20:47:33 2017 +0100 description: Py3 compatibility for make-plots details: https://rivet.hepforge.org/hg/rivet/rev/46cd174b2fa9 branches: changeset: 6074:46cd174b2fa9 user: Andy Buckley <andy at insectnation.org> date: Tue Oct 03 20:56:02 2017 +0100 description: More Py3 compatibility for make-plots diffs (truncated from 1538 to 50 lines): --- a/bin/make-plots Tue Oct 03 17:15:58 2017 +0100 +++ b/bin/make-plots Tue Oct 03 20:56:02 2017 +0100 @@ -10,6 +10,8 @@ * Handle boolean values flexibly (yes, no, true, false, etc. as well as 1, 0) """ +from __future__ import print_function + ## ## This program is copyright by Hendrik Hoeth <hoeth at linta.de> and ## the Rivet team https://rivet.hepforge.org. It may be used @@ -20,7 +22,7 @@ ## Check the Python version import sys if sys.version_info[:3] < (2,6,0): - print "make-plots requires Python version >= 2.6.0... exiting" + print("make-plots requires Python version >= 2.6.0... exiting") sys.exit(1) ## Try to rename the process on Linux @@ -28,7 +30,7 @@ import ctypes libc = ctypes.cdll.LoadLibrary('libc.so.6') libc.prctl(15, 'make-plots', 0, 0, 0) -except Exception, e: +except Exception as e: pass @@ -50,7 +52,7 @@ def fuzzyeq(a, b, tolerance=1e-6): "Fuzzy equality comparison function for floats, with given fractional tolerance" # if type(a) is not float or type(a) is not float: - # print a, b + # print(a, b) if (a == 0 and abs(b) < 1e-12) or (b == 0 and abs(a) < 1e-12): return True return 2.0*abs(a-b)/abs(a+b) < tolerance @@ -91,7 +93,7 @@ pass def has_attr(self, key): - return self.description.has_key(key) + return key in self.description def set_attr(self, key, val): self.description[key] = val @@ -182,7 +184,7 @@ self.description['MainPlot'] = '1' self.description['RatioPlot'] = '0'
More information about the Rivet-svn mailing list |