@@ -3680,7 +3680,7 @@ def is_int(v):
36803680 )
36813681 indexer = key
36823682 else :
3683- indexer = self .slice_indexer (start , stop , step , kind = kind )
3683+ indexer = self .slice_indexer (start , stop , step )
36843684
36853685 return indexer
36863686
@@ -5643,7 +5643,7 @@ def slice_indexer(
56435643 >>> idx.slice_indexer(start='b', end=('c', 'g'))
56445644 slice(1, 3, None)
56455645 """
5646- start_slice , end_slice = self .slice_locs (start , end , step = step , kind = kind )
5646+ start_slice , end_slice = self .slice_locs (start , end , step = step )
56475647
56485648 # return a slice
56495649 if not is_scalar (start_slice ):
@@ -5673,7 +5673,7 @@ def _validate_indexer(self, form: str_t, key, kind: str_t):
56735673 if key is not None and not is_integer (key ):
56745674 raise self ._invalid_indexer (form , key )
56755675
5676- def _maybe_cast_slice_bound (self , label , side : str_t , kind ):
5676+ def _maybe_cast_slice_bound (self , label , side : str_t , kind = no_default ):
56775677 """
56785678 This function should be overloaded in subclasses that allow non-trivial
56795679 casting on label-slice bounds, e.g. datetime-like indices allowing
@@ -5693,7 +5693,8 @@ def _maybe_cast_slice_bound(self, label, side: str_t, kind):
56935693 -----
56945694 Value of `side` parameter should be validated in caller.
56955695 """
5696- assert kind in ["loc" , "getitem" , None ]
5696+ assert kind in ["loc" , "getitem" , None , no_default ]
5697+ self ._deprecated_arg (kind , "kind" , "_maybe_cast_slice_bound" )
56975698
56985699 # We are a plain index here (sub-class override this method if they
56995700 # wish to have special treatment for floats/ints, e.g. Float64Index and
@@ -5718,7 +5719,7 @@ def _searchsorted_monotonic(self, label, side: str_t = "left"):
57185719
57195720 raise ValueError ("index must be monotonic increasing or decreasing" )
57205721
5721- def get_slice_bound (self , label , side : str_t , kind ) -> int :
5722+ def get_slice_bound (self , label , side : str_t , kind = None ) -> int :
57225723 """
57235724 Calculate slice bound that corresponds to given label.
57245725
@@ -5748,7 +5749,7 @@ def get_slice_bound(self, label, side: str_t, kind) -> int:
57485749
57495750 # For datetime indices label may be a string that has to be converted
57505751 # to datetime boundary according to its resolution.
5751- label = self ._maybe_cast_slice_bound (label , side , kind )
5752+ label = self ._maybe_cast_slice_bound (label , side )
57525753
57535754 # we need to look up the label
57545755 try :
@@ -5838,13 +5839,13 @@ def slice_locs(self, start=None, end=None, step=None, kind=None):
58385839
58395840 start_slice = None
58405841 if start is not None :
5841- start_slice = self .get_slice_bound (start , "left" , kind )
5842+ start_slice = self .get_slice_bound (start , "left" )
58425843 if start_slice is None :
58435844 start_slice = 0
58445845
58455846 end_slice = None
58465847 if end is not None :
5847- end_slice = self .get_slice_bound (end , "right" , kind )
5848+ end_slice = self .get_slice_bound (end , "right" )
58485849 if end_slice is None :
58495850 end_slice = len (self )
58505851
@@ -6176,6 +6177,18 @@ def shape(self) -> Shape:
61766177 # See GH#27775, GH#27384 for history/reasoning in how this is defined.
61776178 return (len (self ),)
61786179
6180+ def _deprecated_arg (self , value , name : str_t , methodname : str_t ) -> None :
6181+ """
6182+ Issue a FutureWarning if the arg/kwarg is not no_default.
6183+ """
6184+ if value is not no_default :
6185+ warnings .warn (
6186+ f"'{ name } ' argument in { methodname } is deprecated "
6187+ "and will be removed in a future version. Do not pass it." ,
6188+ FutureWarning ,
6189+ stacklevel = 3 ,
6190+ )
6191+
61796192
61806193def ensure_index_from_sequences (sequences , names = None ):
61816194 """
0 commit comments