11
11
import six
12
12
from six .moves import xrange , zip
13
13
import collections
14
+ try :
15
+ import collections .abc as cabc
16
+ except ImportError :
17
+ import collections as cabc
18
+
14
19
import contextlib
15
20
import datetime
16
21
import errno
@@ -2293,7 +2298,8 @@ def pts_to_midstep(x, *args):
2293
2298
The x location of the steps. May be empty.
2294
2299
2295
2300
y1, ..., yp : array
2296
- y arrays to be turned into steps; all must be the same length as ``x``.
2301
+ y arrays to be turned into steps; all must be the same length as
2302
+ ``x``.
2297
2303
2298
2304
Returns
2299
2305
-------
@@ -2352,7 +2358,7 @@ def index_of(y):
2352
2358
2353
2359
2354
2360
def safe_first_element (obj ):
2355
- if isinstance (obj , collections .Iterator ):
2361
+ if isinstance (obj , cabc .Iterator ):
2356
2362
# needed to accept `array.flat` as input.
2357
2363
# np.flatiter reports as an instance of collections.Iterator
2358
2364
# but can still be indexed via [].
@@ -2369,7 +2375,8 @@ def safe_first_element(obj):
2369
2375
2370
2376
def sanitize_sequence (data ):
2371
2377
"""Converts dictview object to list"""
2372
- return list (data ) if isinstance (data , collections .MappingView ) else data
2378
+ return (list (data ) if isinstance (data , cabc .MappingView )
2379
+ else data )
2373
2380
2374
2381
2375
2382
def normalize_kwargs (kw , alias_mapping = None , required = (), forbidden = (),
0 commit comments