Skip to content

Commit d8d114c

Browse files
TomAugspurgerjreback
authored andcommitted
CI: Check import is warning free (#24102)
1 parent 4b5f4d1 commit d8d114c

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

ci/code_checks.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ fi
153153
### CODE ###
154154
if [[ -z "$CHECK" || "$CHECK" == "code" ]]; then
155155

156-
MSG='Check for modules that pandas should not import' ; echo $MSG
157-
python -c "
156+
MSG='Check import. No warnings, and blacklist some optional dependencies' ; echo $MSG
157+
python -W error -c "
158158
import sys
159159
import pandas
160160

pandas/compat/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def lfilter(*args, **kwargs):
139139
Hashable = collections.abc.Hashable
140140
Iterable = collections.abc.Iterable
141141
Mapping = collections.abc.Mapping
142+
MutableMapping = collections.abc.MutableMapping
142143
Sequence = collections.abc.Sequence
143144
Sized = collections.abc.Sized
144145
Set = collections.abc.Set
@@ -200,6 +201,7 @@ def get_range_parameters(data):
200201
Hashable = collections.Hashable
201202
Iterable = collections.Iterable
202203
Mapping = collections.Mapping
204+
MutableMapping = collections.MutableMapping
203205
Sequence = collections.Sequence
204206
Sized = collections.Sized
205207
Set = collections.Set

pandas/core/tools/datetimes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from collections import MutableMapping
21
from datetime import datetime, time
32
from functools import partial
43

@@ -18,6 +17,7 @@
1817
from pandas.core.dtypes.generic import ABCDataFrame, ABCIndexClass, ABCSeries
1918
from pandas.core.dtypes.missing import notna
2019

20+
from pandas import compat
2121
from pandas.core import algorithms
2222

2323

@@ -570,7 +570,7 @@ def to_datetime(arg, errors='raise', dayfirst=False, yearfirst=False,
570570
from pandas import Series
571571
values = convert_listlike(arg._values, True, format)
572572
result = Series(values, index=arg.index, name=arg.name)
573-
elif isinstance(arg, (ABCDataFrame, MutableMapping)):
573+
elif isinstance(arg, (ABCDataFrame, compat.MutableMapping)):
574574
result = _assemble_from_unit_mappings(arg, errors=errors)
575575
elif isinstance(arg, ABCIndexClass):
576576
cache_array = _maybe_cache(arg, format, cache, convert_listlike)

0 commit comments

Comments
 (0)