|
2 | 2 | Misc tools for implementing data structures |
3 | 3 | """ |
4 | 4 |
|
5 | | -import sys |
6 | | -import warnings |
7 | 5 | from datetime import datetime, timedelta |
8 | 6 | from functools import partial |
9 | 7 | import inspect |
|
20 | 18 | from pandas.core.dtypes.inference import _iterable_not_string |
21 | 19 | from pandas.core.dtypes.missing import isna, isnull, notnull # noqa |
22 | 20 | from pandas.api import types |
23 | | -from pandas.core.dtypes import common |
24 | 21 | from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike |
25 | 22 |
|
26 | | -# compat |
27 | | -from pandas.errors import ( # noqa |
28 | | - PerformanceWarning, UnsupportedFunctionCall, UnsortedIndexError, |
29 | | - AbstractMethodError) |
30 | | - |
31 | | -# back-compat of public API |
32 | | -# deprecate these functions |
33 | | -m = sys.modules['pandas.core.common'] |
34 | | -for t in [t for t in dir(types) if not t.startswith('_')]: |
35 | | - |
36 | | - def outer(t=t): |
37 | | - |
38 | | - def wrapper(*args, **kwargs): |
39 | | - warnings.warn("pandas.core.common.{t} is deprecated. " |
40 | | - "import from the public API: " |
41 | | - "pandas.api.types.{t} instead".format(t=t), |
42 | | - DeprecationWarning, stacklevel=3) |
43 | | - return getattr(types, t)(*args, **kwargs) |
44 | | - return wrapper |
45 | | - |
46 | | - setattr(m, t, outer(t)) |
47 | | - |
48 | | -# back-compat for non-public functions |
49 | | -# deprecate these functions |
50 | | -for t in ['is_datetime_arraylike', |
51 | | - 'is_datetime_or_timedelta_dtype', |
52 | | - 'is_datetimelike', |
53 | | - 'is_datetimelike_v_numeric', |
54 | | - 'is_datetimelike_v_object', |
55 | | - 'is_datetimetz', |
56 | | - 'is_int_or_datetime_dtype', |
57 | | - 'is_period_arraylike', |
58 | | - 'is_string_like', |
59 | | - 'is_string_like_dtype']: |
60 | | - |
61 | | - def outer(t=t): |
62 | | - |
63 | | - def wrapper(*args, **kwargs): |
64 | | - warnings.warn("pandas.core.common.{t} is deprecated. " |
65 | | - "These are not longer public API functions, " |
66 | | - "but can be imported from " |
67 | | - "pandas.api.types.{t} instead".format(t=t), |
68 | | - DeprecationWarning, stacklevel=3) |
69 | | - return getattr(common, t)(*args, **kwargs) |
70 | | - return wrapper |
71 | | - |
72 | | - setattr(m, t, outer(t)) |
73 | | - |
74 | | - |
75 | | -# deprecate array_equivalent |
76 | | - |
77 | | -def array_equivalent(*args, **kwargs): |
78 | | - warnings.warn("'pandas.core.common.array_equivalent' is deprecated and " |
79 | | - "is no longer public API", DeprecationWarning, stacklevel=2) |
80 | | - from pandas.core.dtypes import missing |
81 | | - return missing.array_equivalent(*args, **kwargs) |
82 | | - |
83 | 23 |
|
84 | 24 | class SettingWithCopyError(ValueError): |
85 | 25 | pass |
|
0 commit comments