7
7
"""
8
8
9
9
import collections
10
+ import collections .abc
10
11
import contextlib
11
12
import datetime
12
13
import errno
@@ -1561,7 +1562,8 @@ def pts_to_midstep(x, *args):
1561
1562
The x location of the steps. May be empty.
1562
1563
1563
1564
y1, ..., yp : array
1564
- y arrays to be turned into steps; all must be the same length as ``x``.
1565
+ y arrays to be turned into steps; all must be the same length as
1566
+ ``x``.
1565
1567
1566
1568
Returns
1567
1569
-------
@@ -1620,7 +1622,7 @@ def index_of(y):
1620
1622
1621
1623
1622
1624
def safe_first_element (obj ):
1623
- if isinstance (obj , collections .Iterator ):
1625
+ if isinstance (obj , collections .abc . Iterator ):
1624
1626
# needed to accept `array.flat` as input.
1625
1627
# np.flatiter reports as an instance of collections.Iterator
1626
1628
# but can still be indexed via [].
@@ -1637,7 +1639,8 @@ def safe_first_element(obj):
1637
1639
1638
1640
def sanitize_sequence (data ):
1639
1641
"""Converts dictview object to list"""
1640
- return list (data ) if isinstance (data , collections .MappingView ) else data
1642
+ return (list (data ) if isinstance (data , collections .abc .MappingView )
1643
+ else data )
1641
1644
1642
1645
1643
1646
def normalize_kwargs (kw , alias_mapping = None , required = (), forbidden = (),
@@ -2011,7 +2014,7 @@ def _warn_external(message, category=None):
2011
2014
warnings .warn (message , category , stacklevel )
2012
2015
2013
2016
2014
- class _OrderedSet (collections .MutableSet ):
2017
+ class _OrderedSet (collections .abc . MutableSet ):
2015
2018
def __init__ (self ):
2016
2019
self ._od = collections .OrderedDict ()
2017
2020
0 commit comments