From 36198e70ed9ac5c2e64cc21343ddde15c2a2fad7 Mon Sep 17 00:00:00 2001 From: Eric Vaandering Date: Wed, 21 Oct 2015 10:56:35 +0200 Subject: [PATCH 1/4] implicit tuple parameter unpacking is removed in python 3 --- CondCore/TagCollection/python/seqvaluedict.py | 2 +- .../ReferenceManualScripts/python/BeautifulSoup.py | 6 +++--- FWCore/ParameterSet/python/TreeCrawler.py | 3 ++- RecoLuminosity/LumiDB/plotdata/create_public_lumi_plots.py | 3 ++- .../LumiDB/plotdata/create_public_peakpu_plots.py | 3 ++- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CondCore/TagCollection/python/seqvaluedict.py b/CondCore/TagCollection/python/seqvaluedict.py index fa0aeef345a43..a357f48e9bb9b 100644 --- a/CondCore/TagCollection/python/seqvaluedict.py +++ b/CondCore/TagCollection/python/seqvaluedict.py @@ -157,7 +157,7 @@ def split(self,function,Ignore=None): splitdict[skey][key] = self.dict[key] return splitdict def swap(self): - tmp = self.__class__(map(lambda (x,y):(y,x),self.items())) + tmp = self.__class__(map(lambda x_y:(x_y[1],x_y[0]),self.items())) self.list,self.dict = tmp.list,tmp.dict def update(self,newdict): for key,value in newdict.items(): diff --git a/Documentation/ReferenceManualScripts/python/BeautifulSoup.py b/Documentation/ReferenceManualScripts/python/BeautifulSoup.py index 7278215ca2a89..6db7ec939e8fa 100644 --- a/Documentation/ReferenceManualScripts/python/BeautifulSoup.py +++ b/Documentation/ReferenceManualScripts/python/BeautifulSoup.py @@ -555,10 +555,10 @@ def __init__(self, parser, name, attrs=None, parent=None, self.escapeUnrecognizedEntities = parser.escapeUnrecognizedEntities # Convert any HTML, XML, or numeric entities in the attribute values. - convert = lambda(k, val): (k, + convert = lambda k_val: (k_val[0], re.sub("&(#\d+|#x[0-9a-fA-F]+|\w+);", self._convertEntities, - val)) + k_val[1])) self.attrs = map(convert, self.attrs) def getString(self): @@ -1824,7 +1824,7 @@ def _convertFrom(self, proposed): "iso-8859-1", "iso-8859-2"): markup = re.compile("([\x80-\x9f])").sub \ - (lambda(x): self._subMSChar(x.group(1)), + (lambda x: self._subMSChar(x.group(1)), markup) try: diff --git a/FWCore/ParameterSet/python/TreeCrawler.py b/FWCore/ParameterSet/python/TreeCrawler.py index 821a320c089c2..eb1e035f56234 100755 --- a/FWCore/ParameterSet/python/TreeCrawler.py +++ b/FWCore/ParameterSet/python/TreeCrawler.py @@ -120,7 +120,8 @@ def import_module(self,partnam,fqname,parent): if r is not None: self._depgraph.setdefault(self._last_caller.__name__,{})[r.__name__] = 1 return r - def load_module(self, fqname, fp, pathname, (suffix, mode, type)): + def load_module(self, fqname, fp, pathname, xxx_todo_changeme): + (suffix, mode, type) = xxx_todo_changeme r = modulefinder.ModuleFinder.load_module(self, fqname, fp, pathname, (suffix, mode, type)) if r is not None: self._types[r.__name__] = type diff --git a/RecoLuminosity/LumiDB/plotdata/create_public_lumi_plots.py b/RecoLuminosity/LumiDB/plotdata/create_public_lumi_plots.py index 13c732f8643ca..ad6992441d64d 100755 --- a/RecoLuminosity/LumiDB/plotdata/create_public_lumi_plots.py +++ b/RecoLuminosity/LumiDB/plotdata/create_public_lumi_plots.py @@ -417,10 +417,11 @@ def GetXLocator(ax): ###################################################################### -def TweakPlot(fig, ax, (time_begin, time_end), +def TweakPlot(fig, ax, xxx_todo_changeme, add_extra_head_room=False): # Fiddle with axes ranges etc. + (time_begin, time_end) = xxx_todo_changeme ax.relim() ax.autoscale_view(False, True, True) for label in ax.get_xticklabels(): diff --git a/RecoLuminosity/LumiDB/plotdata/create_public_peakpu_plots.py b/RecoLuminosity/LumiDB/plotdata/create_public_peakpu_plots.py index 2c8d48963fdd1..18485745be605 100644 --- a/RecoLuminosity/LumiDB/plotdata/create_public_peakpu_plots.py +++ b/RecoLuminosity/LumiDB/plotdata/create_public_peakpu_plots.py @@ -126,10 +126,11 @@ def GetXLocator(ax): ###################################################################### -def TweakPlot(fig, ax, (time_begin, time_end), +def TweakPlot(fig, ax, xxx_todo_changeme, add_extra_head_room=False): # Fiddle with axes ranges etc. + (time_begin, time_end) = xxx_todo_changeme ax.relim() ax.autoscale_view(False, True, True) for label in ax.get_xticklabels(): From fb1a788b9598607d2573d114590b7d4e8683f13f Mon Sep 17 00:00:00 2001 From: Eric Vaandering Date: Wed, 21 Oct 2015 16:05:51 +0200 Subject: [PATCH 2/4] Update temp variable per Chris Jones --- FWCore/ParameterSet/python/TreeCrawler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FWCore/ParameterSet/python/TreeCrawler.py b/FWCore/ParameterSet/python/TreeCrawler.py index eb1e035f56234..b56534595266a 100755 --- a/FWCore/ParameterSet/python/TreeCrawler.py +++ b/FWCore/ParameterSet/python/TreeCrawler.py @@ -120,8 +120,8 @@ def import_module(self,partnam,fqname,parent): if r is not None: self._depgraph.setdefault(self._last_caller.__name__,{})[r.__name__] = 1 return r - def load_module(self, fqname, fp, pathname, xxx_todo_changeme): - (suffix, mode, type) = xxx_todo_changeme + def load_module(self, fqname, fp, pathname, aux_info): + (suffix, mode, type) = aux_info r = modulefinder.ModuleFinder.load_module(self, fqname, fp, pathname, (suffix, mode, type)) if r is not None: self._types[r.__name__] = type From 06247d468c6818e9c74e683dfeb27343c66b9217 Mon Sep 17 00:00:00 2001 From: Eric Vaandering Date: Wed, 21 Oct 2015 16:07:48 +0200 Subject: [PATCH 3/4] Update temp name per Chris Jones --- RecoLuminosity/LumiDB/plotdata/create_public_lumi_plots.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoLuminosity/LumiDB/plotdata/create_public_lumi_plots.py b/RecoLuminosity/LumiDB/plotdata/create_public_lumi_plots.py index ad6992441d64d..c81f3eac15058 100755 --- a/RecoLuminosity/LumiDB/plotdata/create_public_lumi_plots.py +++ b/RecoLuminosity/LumiDB/plotdata/create_public_lumi_plots.py @@ -417,11 +417,11 @@ def GetXLocator(ax): ###################################################################### -def TweakPlot(fig, ax, xxx_todo_changeme, +def TweakPlot(fig, ax, time_range, add_extra_head_room=False): # Fiddle with axes ranges etc. - (time_begin, time_end) = xxx_todo_changeme + (time_begin, time_end) = time_range ax.relim() ax.autoscale_view(False, True, True) for label in ax.get_xticklabels(): From 39b4676553563c86e658568215ca4ac6c9ee315e Mon Sep 17 00:00:00 2001 From: Eric Vaandering Date: Wed, 21 Oct 2015 16:08:50 +0200 Subject: [PATCH 4/4] Update variable name per Chris Jones --- RecoLuminosity/LumiDB/plotdata/create_public_peakpu_plots.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RecoLuminosity/LumiDB/plotdata/create_public_peakpu_plots.py b/RecoLuminosity/LumiDB/plotdata/create_public_peakpu_plots.py index 18485745be605..9c48d5bcd655d 100644 --- a/RecoLuminosity/LumiDB/plotdata/create_public_peakpu_plots.py +++ b/RecoLuminosity/LumiDB/plotdata/create_public_peakpu_plots.py @@ -126,11 +126,11 @@ def GetXLocator(ax): ###################################################################### -def TweakPlot(fig, ax, xxx_todo_changeme, +def TweakPlot(fig, ax, time_range, add_extra_head_room=False): # Fiddle with axes ranges etc. - (time_begin, time_end) = xxx_todo_changeme + (time_begin, time_end) = time_range ax.relim() ax.autoscale_view(False, True, True) for label in ax.get_xticklabels():