py3: iteritems -> items, iterkeys -> keys
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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']:
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user