Replaced python2 usage of next()

iterator.next() is deprecated in python3.
next(iterator) is the direct replacement.
In some cases a for() loop makes more sense
This commit is contained in:
Marshal Horn
2022-07-13 08:03:53 -07:00
committed by Uwe
parent 1ddb42dcb2
commit 3a3a20da46
2 changed files with 8 additions and 12 deletions

View File

@@ -106,17 +106,13 @@ def insert(filename,docname=None,preferences=None):
count = 0
# process objects
while True:
item = iterator.get()
if item:
brep = item.geometry.brep_data
ifcproduct = ifcfile.by_id(item.guid)
obj = createProduct(ifcproduct,brep)
progressbar.next(True)
writeProgress(count,productscount,starttime)
count += 1
if not iterator.next():
break
for item in iterator:
brep = item.geometry.brep_data
ifcproduct = ifcfile.by_id(item.guid)
obj = createProduct(ifcproduct,brep)
progressbar.next(True)
writeProgress(count,productscount,starttime)
count += 1
# process 2D annotations
annotations = ifcfile.by_type("IfcAnnotation")

View File

@@ -334,7 +334,7 @@ class _Writer(object):
def _getOnlyElement(self, collection):
it = iter(collection)
return it.next()
return next(it)
def _isCollection(self, data):
return (