From 1476caf281defe67f0d76701092815058b8a2320 Mon Sep 17 00:00:00 2001 From: looooo Date: Sat, 8 Dec 2018 00:03:31 +0100 Subject: [PATCH] py3: iteritems -> items, iterkeys -> keys --- src/Mod/Arch/importIFC.py | 2 +- src/Mod/Arch/importIFClegacy.py | 12 ++++++------ src/Mod/Draft/importSVG.py | 2 +- src/Mod/Fem/femsolver/elmer/sifio.py | 2 +- src/Mod/Material/importFCMat.py | 4 ++-- src/Mod/Path/PathScripts/PathUtil.py | 2 +- src/Mod/Plot/plotAxes/TaskPanel.py | 2 +- src/Mod/Ship/shipHydrostatics/PlotAux.py | 6 +++--- src/Tools/generateBase/generateDS.py | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Mod/Arch/importIFC.py b/src/Mod/Arch/importIFC.py index 9860a0afef..9f5f5e72f6 100644 --- a/src/Mod/Arch/importIFC.py +++ b/src/Mod/Arch/importIFC.py @@ -814,7 +814,7 @@ def insert(filename,docname,skip=[],only=[],root=None): else: # pre-0.18 objects, only support a small subset of types r = ptype[3:] - tr = dict((v,k) for k, v in translationtable.iteritems()) + tr = dict((v,k) for k, v in translationtable.items()) if r in tr.keys(): r = tr[r] # remove the "StandardCase" diff --git a/src/Mod/Arch/importIFClegacy.py b/src/Mod/Arch/importIFClegacy.py index 6752583ac9..ab389260ac 100644 --- a/src/Mod/Arch/importIFClegacy.py +++ b/src/Mod/Arch/importIFClegacy.py @@ -1145,7 +1145,7 @@ def export(exportList,filename): if DEBUG: print("Object type ", otype, " is not supported yet.") # processing groups - for name,entities in groups.iteritems(): + for name,entities in groups.items(): if entities: o = FreeCAD.ActiveDocument.getObject(name) if o: @@ -1681,14 +1681,14 @@ class IfcDocument: self.filename = filename self.data = f.entById self.Entities = {0:f.header} - for k,e in self.data.iteritems(): + for k,e in self.data.items(): eid = int(e['id']) self.Entities[eid] = IfcEntity(e,self) if DEBUG: print(len(self.Entities),"entities created. Creating attributes...") - for k,ent in self.Entities.iteritems(): + for k,ent in self.Entities.items(): if DEBUG: print("attributing entity ",ent) if hasattr(ent,"attributes"): - for k,v in ent.attributes.iteritems(): + for k,v in ent.attributes.items(): if DEBUG: print("parsing attribute: ",k," value ",v) if isinstance(v,str): val = self.__clean__(v) @@ -1754,7 +1754,7 @@ class IfcDocument: elif isinstance(ref,str): l = [] ref = ref.upper() - for k,ob in self.Entities.iteritems(): + for k,ob in self.Entities.items(): if hasattr(ob,"type"): if ob.type == ref: l.append(ob) @@ -1765,7 +1765,7 @@ class IfcDocument: "searches entities types for partial match" l = [] pat = pat.upper() - for k,ob in self.Entities.iteritems(): + for k,ob in self.Entities.items(): if hasattr(ob,"type"): if pat in ob.type: if not ob.type in l: diff --git a/src/Mod/Draft/importSVG.py b/src/Mod/Draft/importSVG.py index e7506870db..96101c912b 100644 --- a/src/Mod/Draft/importSVG.py +++ b/src/Mod/Draft/importSVG.py @@ -242,7 +242,7 @@ def getcolor(color): if v: r,g,b = [float(vf)/255.0 for vf in v] return (r,g,b,0.0) - #for k,v in svgcolors.iteritems(): + #for k,v in svgcolors.items(): # if (k.lower() == color.lower()): pass def transformCopyShape(shape,m): diff --git a/src/Mod/Fem/femsolver/elmer/sifio.py b/src/Mod/Fem/femsolver/elmer/sifio.py index f9bc7e9feb..b2cff1ab28 100644 --- a/src/Mod/Fem/femsolver/elmer/sifio.py +++ b/src/Mod/Fem/femsolver/elmer/sifio.py @@ -310,7 +310,7 @@ class _Writer(object): self._stream.write(_SECTION_DELIM) def _writeSectionBody(self, s): - for key in sorted(s.iterkeys()): # def iterkeys() from class sifio.Section is called + for key in sorted(s.keys()): # def keys() from class sifio.Section is called self._writeAttribute(key, s[key]) def _writeAttribute(self, key, data): diff --git a/src/Mod/Material/importFCMat.py b/src/Mod/Material/importFCMat.py index 73a7a7744f..f139ec56c7 100644 --- a/src/Mod/Material/importFCMat.py +++ b/src/Mod/Material/importFCMat.py @@ -113,7 +113,7 @@ def write(filename, dictionary): user = contents[-1] for p in key[1]: contents[-1][p] = "" - for k, i in dictionary.iteritems(): + for k, i in dictionary.items(): found = False for group in contents: if not found: @@ -145,7 +145,7 @@ def write(filename, dictionary): if len(s) > 1: # if the section has no contents, we don't write it f.write("[" + s["keyname"] + "]\n") - for k, i in s.iteritems(): + for k, i in s.items(): if (k != "keyname" and i != '') or k == "Name": # use only keys which are not empty and the name even if empty f.write(k + "=" + i.encode('utf-8') + "\n") diff --git a/src/Mod/Path/PathScripts/PathUtil.py b/src/Mod/Path/PathScripts/PathUtil.py index c4a64dbd0e..04614d0cc7 100644 --- a/src/Mod/Path/PathScripts/PathUtil.py +++ b/src/Mod/Path/PathScripts/PathUtil.py @@ -122,5 +122,5 @@ def isString(string): def keyValueIter(dictionary): '''keyValueIter(dict) ... return iterable object over dictionary's (key,value) tuples.''' if sys.version_info.major < 3: - return dictionary.iteritems() + return dictionary.items() return dictionary.items() diff --git a/src/Mod/Plot/plotAxes/TaskPanel.py b/src/Mod/Plot/plotAxes/TaskPanel.py index 657e8637ae..45bf6286ce 100644 --- a/src/Mod/Plot/plotAxes/TaskPanel.py +++ b/src/Mod/Plot/plotAxes/TaskPanel.py @@ -448,7 +448,7 @@ class TaskPanel: # need store it in order to regenerate later x = axes.get_xlabel() y = axes.get_ylabel() - for loc, spine in axes.spines.iteritems(): + for loc, spine in axes.spines.items(): if loc in ['bottom', 'top']: spine.set_position(('outward', form.xOffset.value())) if loc in ['left', 'right']: diff --git a/src/Mod/Ship/shipHydrostatics/PlotAux.py b/src/Mod/Ship/shipHydrostatics/PlotAux.py index dafc0a9523..3926ab44f5 100644 --- a/src/Mod/Ship/shipHydrostatics/PlotAux.py +++ b/src/Mod/Ship/shipHydrostatics/PlotAux.py @@ -72,7 +72,7 @@ class Plot(object): ax.yaxis.set_ticks_position('right') ax.yaxis.set_label_position('right') # And X axis can be placed at bottom - for loc, spine in ax.spines.iteritems(): + for loc, spine in ax.spines.items(): if loc in ['bottom', 'top']: spine.set_position(('outward', (i + 1) * 35)) Plot.grid(True) @@ -154,7 +154,7 @@ class Plot(object): ax.yaxis.set_ticks_position('right') ax.yaxis.set_label_position('right') # And X axis can be placed at bottom - for loc, spine in ax.spines.iteritems(): + for loc, spine in ax.spines.items(): if loc in ['bottom', 'top']: spine.set_position(('outward', (i + 1) * 35)) Plot.grid(True) @@ -236,7 +236,7 @@ class Plot(object): ax.yaxis.set_ticks_position('right') ax.yaxis.set_label_position('right') # And X axis can be placed at bottom - for loc, spine in ax.spines.iteritems(): + for loc, spine in ax.spines.items(): if loc in ['bottom', 'top']: spine.set_position(('outward', (i + 1) * 35)) Plot.grid(True) diff --git a/src/Tools/generateBase/generateDS.py b/src/Tools/generateBase/generateDS.py index 744e461c06..1890209547 100644 --- a/src/Tools/generateBase/generateDS.py +++ b/src/Tools/generateBase/generateDS.py @@ -3192,7 +3192,7 @@ def parseAndGenerate(outfileName, subclassFilename, prefix, \ root = dh.getRoot() root.annotate() ## print 'ElementDict:', ElementDict -## for name, obj in ElementDict.iteritems(): +## for name, obj in ElementDict.items(): ## print ' ', name, obj.getName(), obj.type ## print '=' * 50 ## root.show(sys.stdout, 0)