Skip to content

Commit cf38546

Browse files
authored
Merge pull request #11733 from andyfaff/collection
MAINT: use collections.abc for 3.7
2 parents 68690fc + 4fdb061 commit cf38546

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/matplotlib/cbook/__init__.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"""
88

99
import collections
10+
import collections.abc
1011
import contextlib
1112
import datetime
1213
import errno
@@ -1561,7 +1562,8 @@ def pts_to_midstep(x, *args):
15611562
The x location of the steps. May be empty.
15621563
15631564
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``.
15651567
15661568
Returns
15671569
-------
@@ -1620,7 +1622,7 @@ def index_of(y):
16201622

16211623

16221624
def safe_first_element(obj):
1623-
if isinstance(obj, collections.Iterator):
1625+
if isinstance(obj, collections.abc.Iterator):
16241626
# needed to accept `array.flat` as input.
16251627
# np.flatiter reports as an instance of collections.Iterator
16261628
# but can still be indexed via [].
@@ -1637,7 +1639,8 @@ def safe_first_element(obj):
16371639

16381640
def sanitize_sequence(data):
16391641
"""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)
16411644

16421645

16431646
def normalize_kwargs(kw, alias_mapping=None, required=(), forbidden=(),
@@ -2011,7 +2014,7 @@ def _warn_external(message, category=None):
20112014
warnings.warn(message, category, stacklevel)
20122015

20132016

2014-
class _OrderedSet(collections.MutableSet):
2017+
class _OrderedSet(collections.abc.MutableSet):
20152018
def __init__(self):
20162019
self._od = collections.OrderedDict()
20172020

0 commit comments

Comments
 (0)