diff --git a/Validation/RecoTrack/python/plotting/html.py b/Validation/RecoTrack/python/plotting/html.py index 3985f8edc9abf..41289cc835054 100644 --- a/Validation/RecoTrack/python/plotting/html.py +++ b/Validation/RecoTrack/python/plotting/html.py @@ -426,7 +426,7 @@ def _formatPlotSets(self): fileTable = [] - sections = self._orderSets(self._plotSets.keys()) + sections = self._orderSets(list(self._plotSets.keys())) for isec, section in enumerate(sections): leg = self._appendLegend(section) @@ -489,7 +489,7 @@ def _allNone(row): return False return True - sections = self._orderSets(self._tables.keys()) + sections = self._orderSets(list(self._tables.keys())) for isec, section in enumerate(sections): leg = self._appendLegend(section) @@ -625,7 +625,7 @@ def write(self, baseDir): #print "TrackingPageSet.write" ret = [] - keys = self._orderPages(self._pages.keys()) + keys = self._orderPages(list(self._pages.keys())) for key in keys: page = self._pages[key] if page.isEmpty(): @@ -815,7 +815,7 @@ def addTable(self, *args, **kwargs): def write(self): # Reorder sections such that Fast vs. Full becomes just after the corresponding Fast - keys = self._sections.iterkeys() + keys = self._sections.keys() newkeys = [] for key in keys: if not key[1]: diff --git a/Validation/RecoTrack/python/plotting/plotting.py b/Validation/RecoTrack/python/plotting/plotting.py index e09b6530e6c5d..eff7bab9f34bb 100644 --- a/Validation/RecoTrack/python/plotting/plotting.py +++ b/Validation/RecoTrack/python/plotting/plotting.py @@ -1021,7 +1021,7 @@ def create(self, tdirectory): # the iteration timing plots), so let's test them all for lab in labels: if lab in values: - ivalue = values.keys().index(lab) + ivalue = list(values.keys()).index(lab) break binIndexOrder.append( (ivalue, i) ) @@ -1934,9 +1934,9 @@ def _modifyHisto(th1, profileX): return th1 if self._fallback is not None: - self._histograms = map(_modifyHisto, self._histograms, profileX) + self._histograms = list(map(_modifyHisto, self._histograms, profileX)) else: - self._histograms = map(lambda h: _modifyHisto(h, self._profileX), self._histograms) + self._histograms =list(map(lambda h: _modifyHisto(h, self._profileX), self._histograms)) if requireAllHistograms and None in self._histograms: self._histograms = [None]*len(self._histograms) @@ -2737,8 +2737,7 @@ def __init__(self, name, possibleDqmFolders, dqmSubFolders, plotFolder, fallback if sf_translated is not None and not sf_translated in subfolders: subfolders[sf_translated] = DQMSubFolder(sf, sf_translated) - self._dqmSubFolders = subfolders.values() - self._dqmSubFolders.sort(key=lambda sf: sf.subfolder) + self._dqmSubFolders = sorted(subfolders.values(), key=lambda sf: sf.subfolder) self._fallbackNames = fallbackNames self._fallbackDqmSubFolders = fallbackDqmSubFolders diff --git a/Validation/RecoTrack/python/plotting/validation.py b/Validation/RecoTrack/python/plotting/validation.py index 6021261181289..e19487b27489f 100644 --- a/Validation/RecoTrack/python/plotting/validation.py +++ b/Validation/RecoTrack/python/plotting/validation.py @@ -5,7 +5,7 @@ import sys import shutil import subprocess -import urllib +import urllib.request import ROOT ROOT.gROOT.SetBatch(True) @@ -720,7 +720,7 @@ def download(self): """Download DQM files. Requires grid certificate and asks your password for it.""" filenames = [s.filename(self._newRelease) for s in self._fullsimSamples+self._fastsimSamples] if self._newFileModifier is not None: - filenames = map(self._newFileModifier, filenames) + filenames = list(map(self._newFileModifier, filenames)) filenames = [f for f in filenames if not os.path.exists(f)] if len(filenames) == 0: print("All files already downloaded") @@ -987,7 +987,7 @@ def _doPlots(self, sample, harvestedFile, plotterFolder, dqmSubFolder, htmlRepor # Move plots to new directory print("Created plots and %s in %s" % (valname, newdir)) - return map(lambda n: n.replace(newdir, newsubdir), fileList) + return list(map(lambda n: n.replace(newdir, newsubdir), fileList)) def _doPlotsFastFull(self, fastSample, fullSample, plotterFolder, dqmSubFolder, htmlReport): """Do the real plotting work for FastSim vs. FullSim for a given algorithm, quality flag, and sample.""" @@ -1053,7 +1053,7 @@ def _doPlotsFastFull(self, fastSample, fullSample, plotterFolder, dqmSubFolder, # Move plots to new directory print("Created plots in %s" % (newdir)) - return map(lambda n: n.replace(newdir, newsubdir), fileList) + return list(map(lambda n: n.replace(newdir, newsubdir), fileList)) def _doPlotsPileup(self, pu140Sample, pu200Sample, plotterFolder, dqmSubFolder, htmlReport): """Do the real plotting work for two pileup scenarios for a given algorithm, quality flag, and sample.""" @@ -1120,7 +1120,7 @@ def _doPlotsPileup(self, pu140Sample, pu200Sample, plotterFolder, dqmSubFolder, # Move plots to new directory print("Created plots in %s" % (newdir)) - return map(lambda n: n.replace(newdir, newsubdir), fileList) + return list(map(lambda n: n.replace(newdir, newsubdir), fileList)) def _copySubDir(oldfile, newfile, basenames, dirname): @@ -1300,10 +1300,10 @@ def _doPlots(self, plotterFolder, dqmSubFolder): downloadables = ["index.php", "res/jquery-ui.js", "res/jquery.js", "res/style.css", "res/style.js", "res/theme.css"] for d in downloadables: if not os.path.exists("%s/%s" % (newdir,d)): - urllib.urlretrieve("https://raw.githubusercontent.com/musella/php-plots/master/%s"%d, "%s/%s"%(newdir,d)) + urllib.request.urlretrieve("https://raw.githubusercontent.com/musella/php-plots/master/%s"%d, "%s/%s"%(newdir,d)) print("Created plots in %s" % newdir) - return map(lambda n: n.replace(newdir, newsubdir), fileList) + return list(map(lambda n: n.replace(newdir, newsubdir), fileList)) class SeparateValidation: #Similar to the SimpleValidation @@ -1389,7 +1389,7 @@ def _doPlots(self, plotterFolder, dqmSubFolder): downloadables = ["index.php", "res/jquery-ui.js", "res/jquery.js", "res/style.css", "res/style.js", "res/theme.css"] for d in downloadables: if not os.path.exists("%s/%s" % (link,d)): - urllib.urlretrieve("https://raw.githubusercontent.com/rovere/php-plots/master/%s"%d, "%s/%s"%(link,d)) + urllib.request.urlretrieve("https://raw.githubusercontent.com/rovere/php-plots/master/%s"%d, "%s/%s"%(link,d)) print("Created separated plots in %s" % newdir) - return map(lambda n: n.replace(newdir, newsubdir), linkList) + return list(map(lambda n: n.replace(newdir, newsubdir), linkList))