22"""
33Collects common base functionality
44"""
5- import collections
65import posixpath
76
87from . import terminology
98from .tools .doc_inherit import allow_inherit_docstring
109
10+ try :
11+ from collections .abc import Iterable
12+ except ImportError :
13+ from collections import Iterable
1114
1215class BaseObject (object ):
1316 _format = None
@@ -249,7 +252,7 @@ def append(self, section):
249252 if isinstance (section , BaseSection ):
250253 self ._sections .append (section )
251254 section ._parent = self
252- elif isinstance (section , collections . Iterable ) and not isinstance (section , str ):
255+ elif isinstance (section , Iterable ) and not isinstance (section , str ):
253256 raise ValueError ("Use extend to add a list of Sections." )
254257 else :
255258 raise ValueError ("Can only append objects of type Section." )
@@ -261,7 +264,7 @@ def extend(self, sec_list):
261264 :param sec_list: Iterable containing odML Section entries.
262265 """
263266 from odml .section import BaseSection
264- if not isinstance (sec_list , collections . Iterable ):
267+ if not isinstance (sec_list , Iterable ):
265268 raise TypeError ("'%s' object is not iterable" % type (sec_list ).__name__ )
266269
267270 # Make sure only Sections with unique names will be added.
0 commit comments