From 60147a8ec94c9720a6ce03cfe1794f27edcd6cf2 Mon Sep 17 00:00:00 2001 From: CyrilWaechter Date: Thu, 27 Aug 2020 00:08:08 +0200 Subject: [PATCH] Fix collections deprecation warning ```python ifcopenshell/geom/occ_utils.py:28ifcopenshell/geom/occ_utils.py:28 /home/cyril/git/BIMxBEM/ifcopenshell/geom/occ_utils.py:28: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working from collections import namedtuple, Iterable ``` --- src/ifcblenderexport/occ_utils.py | 6 +++++- src/ifcopenshell-python/ifcopenshell/geom/app.py | 6 +++++- src/ifcopenshell-python/ifcopenshell/geom/occ_utils.py | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/ifcblenderexport/occ_utils.py b/src/ifcblenderexport/occ_utils.py index 6087caa3bc..bdbe29ae82 100755 --- a/src/ifcblenderexport/occ_utils.py +++ b/src/ifcblenderexport/occ_utils.py @@ -25,7 +25,11 @@ import random import operator import warnings -from collections import namedtuple, Iterable +from collections import namedtuple +try: # python 3.3+ + from collections.abc import Iterable +except ModuleNotFoundError: # python 2 + from collections import Iterable try: from OCC.Core import TopoDS, gp, Quantity, BRepTools diff --git a/src/ifcopenshell-python/ifcopenshell/geom/app.py b/src/ifcopenshell-python/ifcopenshell/geom/app.py index 16bfdb8349..308025b4ce 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/app.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/app.py @@ -11,7 +11,11 @@ import multiprocessing import OCC.AIS -from collections import defaultdict, Iterable, OrderedDict +from collections import defaultdict, OrderedDict +try: # python 3.3+ + from collections.abc import Iterable +except ModuleNotFoundError: # python 2 + from collections import Iterable try: QString = unicode diff --git a/src/ifcopenshell-python/ifcopenshell/geom/occ_utils.py b/src/ifcopenshell-python/ifcopenshell/geom/occ_utils.py index 32d0f7bf98..ec77ea7340 100644 --- a/src/ifcopenshell-python/ifcopenshell/geom/occ_utils.py +++ b/src/ifcopenshell-python/ifcopenshell/geom/occ_utils.py @@ -25,7 +25,11 @@ import random import operator import warnings -from collections import namedtuple, Iterable +from collections import namedtuple +try: # python 3.3+ + from collections.abc import Iterable +except ModuleNotFoundError: # python 2 + from collections import Iterable try: from OCC.Core import V3d, TopoDS, gp, AIS, Quantity, BRepTools, Graphic3d