diff --git a/pandas/_config/config.py b/pandas/_config/config.py index ebf2ba2510aa4..2f0846e0808ed 100644 --- a/pandas/_config/config.py +++ b/pandas/_config/config.py @@ -583,12 +583,6 @@ def _get_root(key: str) -> tuple[dict[str, Any], str]: return cursor, path[-1] -def _is_deprecated(key: str) -> bool: - """Returns True if the given option has been deprecated""" - key = key.lower() - return key in _deprecated_options - - def _get_deprecated_option(key: str): """ Retrieves the metadata for a deprecated option, if `key` is deprecated. diff --git a/pandas/core/computation/ops.py b/pandas/core/computation/ops.py index 062e9f43b2eb9..cd9aa1833d586 100644 --- a/pandas/core/computation/ops.py +++ b/pandas/core/computation/ops.py @@ -320,12 +320,6 @@ def _not_in(x, y): ) _arith_ops_dict = dict(zip(ARITH_OPS_SYMS, _arith_ops_funcs)) -SPECIAL_CASE_ARITH_OPS_SYMS = ("**", "//", "%") -_special_case_arith_ops_funcs = (operator.pow, operator.floordiv, operator.mod) -_special_case_arith_ops_dict = dict( - zip(SPECIAL_CASE_ARITH_OPS_SYMS, _special_case_arith_ops_funcs) -) - _binary_ops_dict = {} for d in (_cmp_ops_dict, _bool_ops_dict, _arith_ops_dict): diff --git a/pandas/core/missing.py b/pandas/core/missing.py index 3a5bf64520d75..de26ad14a7b7a 100644 --- a/pandas/core/missing.py +++ b/pandas/core/missing.py @@ -801,59 +801,6 @@ def _cubicspline_interpolate( return P(x) -def _interpolate_with_limit_area( - values: np.ndarray, - method: Literal["pad", "backfill"], - limit: int | None, - limit_area: Literal["inside", "outside"], -) -> None: - """ - Apply interpolation and limit_area logic to values along a to-be-specified axis. - - Parameters - ---------- - values: np.ndarray - Input array. - method: str - Interpolation method. Could be "bfill" or "pad" - limit: int, optional - Index limit on interpolation. - limit_area: {'inside', 'outside'} - Limit area for interpolation. - - Notes - ----- - Modifies values in-place. - """ - - invalid = isna(values) - is_valid = ~invalid - - if not invalid.all(): - first = find_valid_index(how="first", is_valid=is_valid) - if first is None: - first = 0 - last = find_valid_index(how="last", is_valid=is_valid) - if last is None: - last = len(values) - - pad_or_backfill_inplace( - values, - method=method, - limit=limit, - limit_area=limit_area, - ) - - if limit_area == "inside": - invalid[first : last + 1] = False - elif limit_area == "outside": - invalid[:first] = invalid[last + 1 :] = False - else: - raise ValueError("limit_area should be 'inside' or 'outside'") - - values[invalid] = np.nan - - def pad_or_backfill_inplace( values: np.ndarray, method: Literal["pad", "backfill"] = "pad", diff --git a/pandas/plotting/_misc.py b/pandas/plotting/_misc.py index 38fa0ff75cf66..af7ddf39283c0 100644 --- a/pandas/plotting/_misc.py +++ b/pandas/plotting/_misc.py @@ -637,8 +637,7 @@ class _Options(dict): _ALIASES = {"x_compat": "xaxis.compat"} _DEFAULT_KEYS = ["xaxis.compat"] - def __init__(self, deprecated: bool = False) -> None: - self._deprecated = deprecated + def __init__(self) -> None: super().__setitem__("xaxis.compat", False) def __getitem__(self, key): diff --git a/pandas/tests/computation/test_eval.py b/pandas/tests/computation/test_eval.py index c24f23f6a0f2e..8f14c562fa7c3 100644 --- a/pandas/tests/computation/test_eval.py +++ b/pandas/tests/computation/test_eval.py @@ -48,7 +48,6 @@ ) from pandas.core.computation.ops import ( ARITH_OPS_SYMS, - SPECIAL_CASE_ARITH_OPS_SYMS, _binary_math_ops, _binary_ops_dict, _unary_math_ops, @@ -266,7 +265,7 @@ def test_chained_cmp_op(self, cmp1, cmp2, lhs, midhs, rhs, engine, parser): tm.assert_almost_equal(result, expected) @pytest.mark.parametrize( - "arith1", sorted(set(ARITH_OPS_SYMS).difference(SPECIAL_CASE_ARITH_OPS_SYMS)) + "arith1", sorted(set(ARITH_OPS_SYMS).difference({"**", "//", "%"})) ) def test_binary_arith_ops(self, arith1, lhs, rhs, engine, parser): ex = f"lhs {arith1} rhs" diff --git a/pandas/tests/config/test_config.py b/pandas/tests/config/test_config.py index 205603b5768e5..5b1d4cde9fb59 100644 --- a/pandas/tests/config/test_config.py +++ b/pandas/tests/config/test_config.py @@ -123,9 +123,11 @@ def test_case_insensitive(self): msg = r"No such keys\(s\): 'no_such_option'" with pytest.raises(OptionError, match=msg): cf.get_option("no_such_option") - cf.deprecate_option("KanBan") - assert cf._is_deprecated("kAnBaN") + cf.deprecate_option("KanBan") + msg = "'kanban' is deprecated, please refrain from using it." + with pytest.raises(FutureWarning, match=msg): + cf.get_option("kAnBaN") def test_get_option(self): cf.register_option("a", 1, "doc") @@ -268,7 +270,6 @@ def test_deprecate_option(self): # we can deprecate non-existent options cf.deprecate_option("foo") - assert cf._is_deprecated("foo") with tm.assert_produces_warning(FutureWarning, match="deprecated"): with pytest.raises(KeyError, match="No such keys.s.: 'foo'"): cf.get_option("foo")