From 3a3a20da4693d33b3cb6795923fff1b3aa05df4d Mon Sep 17 00:00:00 2001 From: Marshal Horn Date: Wed, 13 Jul 2022 08:03:53 -0700 Subject: [PATCH] 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 --- src/Mod/Arch/importIFCmulticore.py | 18 +++++++----------- src/Mod/Fem/femsolver/elmer/sifio.py | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Mod/Arch/importIFCmulticore.py b/src/Mod/Arch/importIFCmulticore.py index fc8427f74f..40ab998c2c 100644 --- a/src/Mod/Arch/importIFCmulticore.py +++ b/src/Mod/Arch/importIFCmulticore.py @@ -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") diff --git a/src/Mod/Fem/femsolver/elmer/sifio.py b/src/Mod/Fem/femsolver/elmer/sifio.py index 0980390010..8ded82eb04 100644 --- a/src/Mod/Fem/femsolver/elmer/sifio.py +++ b/src/Mod/Fem/femsolver/elmer/sifio.py @@ -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 (