|
[yoda-svn] yoda: Python 3 compatibilityYODA Mercurial yoda at projects.hepforge.orgFri Nov 17 10:15:01 GMT 2017
details: https://yoda.hepforge.org/hg/yoda/rev/3a7d9de3976b branches: changeset: 1428:3a7d9de3976b user: David Grellscheid <david.grellscheid at durham.ac.uk> date: Fri Nov 17 10:05:03 2017 +0000 description: Python 3 compatibility diffs (truncated from 274 to 50 lines): --- a/bin/yodascale Sun Oct 15 11:09:29 2017 +0100 +++ b/bin/yodascale Fri Nov 17 10:05:03 2017 +0000 @@ -1,5 +1,5 @@ #! /usr/bin/env python - +from __future__ import print_function """\ Usage: %prog <yodafile1> [<yodafile2> ...] -r <yodareffile_or_dir> [-r ...] @@ -131,20 +131,20 @@ aos_ref = {} for r in reffiles: aos = yoda.read(r) - for aopath, ao in aos.iteritems(): + for aopath, ao in aos.items(): ## Use /REF_PREFIX/foo as a ref plot for /foo, if the ref prefix is set if opts.REF_PREFIX and aopath.startswith("/%s/" % opts.REF_PREFIX): aopath = aopath.replace("/%s/" % opts.REF_PREFIX, "/", 1) # NB. ao.path is unchanged aos_ref[aopath] = ao if opts.VERBOSITY > 1: - print "DEBUG: %d reference histos" % len(aos_ref) + print("DEBUG: %d reference histos" % len(aos_ref)) ## Loop over input files for rescaling for infile in args: aos_out = {} aos_in = yoda.read(infile) - for aopath, ao in sorted(aos_in.iteritems()): + for aopath, ao in sorted(aos_in.items()): ## Default is to write out the unrescaled AO if no match is found aos_out[aopath] = ao @@ -152,7 +152,7 @@ ## Don't rescale /REF_PREFIX objects if aopath.startswith("/%s/" % opts.REF_PREFIX): if opts.VERBOSITY > 1: - print "DEBUG: not rescaling ref object '%s'" % aopath + print("DEBUG: not rescaling ref object '%s'" % aopath) continue @@ -166,19 +166,19 @@ if s[1].path is not None: refpaths = [] if s[1].path.pattern == "REF": - if aos_ref.has_key(aopath): + if aopath in aos_ref: refpaths = [aopath] else:
More information about the yoda-svn mailing list |