Skip to content

Commit

Permalink
py3: iteritems -> items, iterkeys -> keys
Browse files Browse the repository at this point in the history
  • Loading branch information
looooo authored and yorikvanhavre committed Dec 8, 2018
1 parent 9d39523 commit 1476caf
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Arch/importIFC.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 6 additions & 6 deletions src/Mod/Arch/importIFClegacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -1681,14 +1681,14 @@ def __init__(self,filename,schema="IFC2X3_TC1.exp"):
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)
Expand Down Expand Up @@ -1754,7 +1754,7 @@ def getEnt(self,ref):
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)
Expand All @@ -1765,7 +1765,7 @@ def search(self,pat):
"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:
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Draft/importSVG.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femsolver/elmer/sifio.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def _writeSectionFooter(self, s):
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):
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Material/importFCMat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/PathScripts/PathUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 1 addition & 1 deletion src/Mod/Plot/plotAxes/TaskPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def onOffset(self, value):
# 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']:
Expand Down
6 changes: 3 additions & 3 deletions src/Mod/Ship/shipHydrostatics/PlotAux.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def plotVolume(self):
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)
Expand Down Expand Up @@ -154,7 +154,7 @@ def plotStability(self):
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)
Expand Down Expand Up @@ -236,7 +236,7 @@ def plotCoeffs(self):
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)
Expand Down
2 changes: 1 addition & 1 deletion src/Tools/generateBase/generateDS.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1476caf

Please sign in to comment.