2
2
"""
3
3
Collects common base functionality
4
4
"""
5
- import collections
6
5
import posixpath
7
6
8
7
from . import terminology
9
8
from .tools .doc_inherit import allow_inherit_docstring
10
9
10
+ try :
11
+ from collections .abc import Iterable
12
+ except ImportError :
13
+ from collections import Iterable
11
14
12
15
class BaseObject (object ):
13
16
_format = None
@@ -249,7 +252,7 @@ def append(self, section):
249
252
if isinstance (section , BaseSection ):
250
253
self ._sections .append (section )
251
254
section ._parent = self
252
- elif isinstance (section , collections . Iterable ) and not isinstance (section , str ):
255
+ elif isinstance (section , Iterable ) and not isinstance (section , str ):
253
256
raise ValueError ("Use extend to add a list of Sections." )
254
257
else :
255
258
raise ValueError ("Can only append objects of type Section." )
@@ -261,7 +264,7 @@ def extend(self, sec_list):
261
264
:param sec_list: Iterable containing odML Section entries.
262
265
"""
263
266
from odml .section import BaseSection
264
- if not isinstance (sec_list , collections . Iterable ):
267
+ if not isinstance (sec_list , Iterable ):
265
268
raise TypeError ("'%s' object is not iterable" % type (sec_list ).__name__ )
266
269
267
270
# Make sure only Sections with unique names will be added.
0 commit comments