Skip to content

CLN: Remove some unused code #57839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions pandas/_config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 0 additions & 6 deletions pandas/core/computation/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
53 changes: 0 additions & 53 deletions pandas/core/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions pandas/plotting/_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 1 addition & 2 deletions pandas/tests/computation/test_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"
Expand Down
7 changes: 4 additions & 3 deletions pandas/tests/config/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down
Loading