Skip to content

Commit ac411d4

Browse files
phoflyehoshuadimarsky
authored andcommitted
DEPR: Remove deprecation from private class IntervalTree (pandas-dev#47637)
* DEPR: Remove deprecation from private class IntervalTree * remove test * Add set inclusive * Revert "Add set inclusive" This reverts commit feafc6a.
1 parent 83b5c98 commit ac411d4

File tree

2 files changed

+3
-30
lines changed

2 files changed

+3
-30
lines changed

pandas/_libs/intervaltree.pxi.in

+3-12
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import warnings
88
from pandas._libs import lib
99
from pandas._libs.algos import is_monotonic
1010

11-
from pandas._libs.interval import _warning_interval
12-
1311
ctypedef fused int_scalar_t:
1412
int64_t
1513
float64_t
@@ -42,18 +40,13 @@ cdef class IntervalTree(IntervalMixin):
4240
object _is_overlapping, _left_sorter, _right_sorter
4341
Py_ssize_t _na_count
4442

45-
def __init__(self, left, right, inclusive: str | None = None, closed: None | lib.NoDefault = lib.no_default, leaf_size=100):
43+
def __init__(self, left, right, inclusive: str | None = None, leaf_size=100):
4644
"""
4745
Parameters
4846
----------
4947
left, right : np.ndarray[ndim=1]
5048
Left and right bounds for each interval. Assumed to contain no
5149
NaNs.
52-
closed : {'left', 'right', 'both', 'neither'}, optional
53-
Whether the intervals are closed on the left-side, right-side, both
54-
or neither. Defaults to 'right'.
55-
56-
.. deprecated:: 1.5.0
5750

5851
inclusive : {"both", "neither", "left", "right"}, optional
5952
Whether the intervals are closed on the left-side, right-side, both
@@ -66,8 +59,6 @@ cdef class IntervalTree(IntervalMixin):
6659
to brute-force search. Tune this parameter to optimize query
6760
performance.
6861
"""
69-
inclusive, closed = _warning_interval(inclusive, closed)
70-
7162
if inclusive is None:
7263
inclusive = "right"
7364

@@ -119,7 +110,7 @@ cdef class IntervalTree(IntervalMixin):
119110
if self._is_overlapping is not None:
120111
return self._is_overlapping
121112

122-
# <= when both sides closed since endpoints can overlap
113+
# <= when inclusive on both sides since endpoints can overlap
123114
op = le if self.inclusive == 'both' else lt
124115

125116
# overlap if start of current interval < end of previous interval
@@ -263,7 +254,7 @@ cdef class IntervalNode:
263254

264255

265256
# we need specialized nodes and leaves to optimize for different dtype and
266-
# closed values
257+
# inclusive values
267258

268259
{{py:
269260

pandas/tests/indexes/interval/test_interval_tree.py

-18
Original file line numberDiff line numberDiff line change
@@ -190,24 +190,6 @@ def test_construction_overflow(self):
190190
expected = (50 + np.iinfo(np.int64).max) / 2
191191
assert result == expected
192192

193-
def test_interval_tree_error_and_warning(self):
194-
# GH 40245
195-
196-
msg = (
197-
"Deprecated argument `closed` cannot "
198-
"be passed if argument `inclusive` is not None"
199-
)
200-
with pytest.raises(ValueError, match=msg):
201-
left, right = np.arange(10), [np.iinfo(np.int64).max] * 10
202-
IntervalTree(left, right, closed="both", inclusive="both")
203-
204-
msg = "Argument `closed` is deprecated in favor of `inclusive`"
205-
with tm.assert_produces_warning(
206-
FutureWarning, match=msg, check_stacklevel=False
207-
):
208-
left, right = np.arange(10), [np.iinfo(np.int64).max] * 10
209-
IntervalTree(left, right, closed="both")
210-
211193
@pytest.mark.xfail(not IS64, reason="GH 23440")
212194
@pytest.mark.parametrize(
213195
"left, right, expected",

0 commit comments

Comments
 (0)