[Rivet-svn] rivet: 2 new changesets

Rivet Mercurial rivet at projects.hepforge.org
Tue Oct 3 17:30:01 BST 2017


details:   https://rivet.hepforge.org/hg/rivet/rev/81e0562e5ee0
branches:  
changeset: 6071:81e0562e5ee0
user:      Andy Buckley <andy at insectnation.org>
date:      Tue Oct 03 17:09:59 2017 +0100
description:
Py3 fix to relative imports

details:   https://rivet.hepforge.org/hg/rivet/rev/89d6261eee2b
branches:  
changeset: 6072:89d6261eee2b
user:      Andy Buckley <andy at insectnation.org>
date:      Tue Oct 03 17:15:58 2017 +0100
description:
Py3 fixes to rivet.xxx.py modules

diffs (truncated from 107 to 50 lines):

--- a/pyext/rivet/__init__.py	Tue Oct 03 16:27:12 2017 +0100
+++ b/pyext/rivet/__init__.py	Tue Oct 03 17:15:58 2017 +0100
@@ -12,6 +12,6 @@
 from rivet.core import *
 __version__ = core.version()
 
-from rivet.plotinfo import *
-from rivet.aopaths import *
-import spiresbib, util
+from .plotinfo import *
+from .aopaths import *
+from . import spiresbib, util
--- a/pyext/rivet/plotinfo.py	Tue Oct 03 16:27:12 2017 +0100
+++ b/pyext/rivet/plotinfo.py	Tue Oct 03 17:15:58 2017 +0100
@@ -1,3 +1,4 @@
+from __future__ import print_function
 import os, re
 from .util import texpand
 
@@ -35,7 +36,7 @@
             try:
                 import rivet
                 self.plotpaths = rivet.getAnalysisPlotPaths()
-            except Exception, e:
+            except Exception as e:
                 sys.stderr.write("Failed to load Rivet analysis plot paths: %s\n" % e)
                 raise ValueError("No plot paths given and the rivet module could not be loaded!")
 
@@ -61,7 +62,7 @@
         try:
             aop = AOPath(hpath)
         except:
-            print "Found analysis object with non-standard path structure:", hpath, "... skipping"
+            print("Found analysis object with non-standard path structure:", hpath, "... skipping")
             return None
 
         ## Assemble the list of headers from any matching plotinfo paths and additional style files
@@ -93,7 +94,7 @@
             if m:
                 tag, pathpat = m.group(2,3)
                 # pathpat could be a regex
-                if not self.pat_paths.has_key(pathpat):
+                if pathpat not in self.pat_paths:
                     self.pat_paths[pathpat] = re.compile(pathpat)
                 if tag == section:
                     m2 = self.pat_paths[pathpat].match(hpath)
@@ -118,15 +119,15 @@
                         oldval = value
                         try:
                             ## First escape backslashes *except* regex groups, then expand regex groups from path match


More information about the Rivet-svn mailing list