@@ -642,7 +642,7 @@ def _get_setitem_indexer(self, key):
642
642
self ._ensure_listlike_indexer (key )
643
643
644
644
if self .axis is not None :
645
- return self ._convert_tuple (key , is_setter = True )
645
+ return self ._convert_tuple (key )
646
646
647
647
ax = self .obj ._get_axis (0 )
648
648
@@ -653,12 +653,12 @@ def _get_setitem_indexer(self, key):
653
653
654
654
if isinstance (key , tuple ):
655
655
with suppress (IndexingError ):
656
- return self ._convert_tuple (key , is_setter = True )
656
+ return self ._convert_tuple (key )
657
657
658
658
if isinstance (key , range ):
659
659
return list (key )
660
660
661
- return self ._convert_to_indexer (key , axis = 0 , is_setter = True )
661
+ return self ._convert_to_indexer (key , axis = 0 )
662
662
663
663
def _ensure_listlike_indexer (self , key , axis = None , value = None ):
664
664
"""
@@ -755,21 +755,19 @@ def _is_nested_tuple_indexer(self, tup: tuple) -> bool:
755
755
return any (is_nested_tuple (tup , ax ) for ax in self .obj .axes )
756
756
return False
757
757
758
- def _convert_tuple (self , key , is_setter : bool = False ):
758
+ def _convert_tuple (self , key ):
759
759
keyidx = []
760
760
if self .axis is not None :
761
761
axis = self .obj ._get_axis_number (self .axis )
762
762
for i in range (self .ndim ):
763
763
if i == axis :
764
- keyidx .append (
765
- self ._convert_to_indexer (key , axis = axis , is_setter = is_setter )
766
- )
764
+ keyidx .append (self ._convert_to_indexer (key , axis = axis ))
767
765
else :
768
766
keyidx .append (slice (None ))
769
767
else :
770
768
self ._validate_key_length (key )
771
769
for i , k in enumerate (key ):
772
- idx = self ._convert_to_indexer (k , axis = i , is_setter = is_setter )
770
+ idx = self ._convert_to_indexer (k , axis = i )
773
771
keyidx .append (idx )
774
772
775
773
return tuple (keyidx )
@@ -867,8 +865,8 @@ def _getitem_nested_tuple(self, tup: tuple):
867
865
# a tuple passed to a series with a multi-index
868
866
if len (tup ) > self .ndim :
869
867
if self .name != "loc" :
870
- # This should never be reached, but lets be explicit about it
871
- raise ValueError ("Too many indices" )
868
+ # This should never be reached, but let's be explicit about it
869
+ raise ValueError ("Too many indices" ) # pragma: no cover
872
870
if all (is_hashable (x ) or com .is_null_slice (x ) for x in tup ):
873
871
# GH#10521 Series should reduce MultiIndex dimensions instead of
874
872
# DataFrame, IndexingError is not raised when slice(None,None,None)
@@ -911,7 +909,7 @@ def _getitem_nested_tuple(self, tup: tuple):
911
909
912
910
return obj
913
911
914
- def _convert_to_indexer (self , key , axis : int , is_setter : bool = False ):
912
+ def _convert_to_indexer (self , key , axis : int ):
915
913
raise AbstractMethodError (self )
916
914
917
915
def __getitem__ (self , key ):
@@ -1176,7 +1174,7 @@ def _get_slice_axis(self, slice_obj: slice, axis: int):
1176
1174
# return a DatetimeIndex instead of a slice object.
1177
1175
return self .obj .take (indexer , axis = axis )
1178
1176
1179
- def _convert_to_indexer (self , key , axis : int , is_setter : bool = False ):
1177
+ def _convert_to_indexer (self , key , axis : int ):
1180
1178
"""
1181
1179
Convert indexing key into something we can use to do actual fancy
1182
1180
indexing on a ndarray.
@@ -1486,7 +1484,7 @@ def _get_slice_axis(self, slice_obj: slice, axis: int):
1486
1484
labels ._validate_positional_slice (slice_obj )
1487
1485
return self .obj ._slice (slice_obj , axis = axis )
1488
1486
1489
- def _convert_to_indexer (self , key , axis : int , is_setter : bool = False ):
1487
+ def _convert_to_indexer (self , key , axis : int ):
1490
1488
"""
1491
1489
Much simpler as we only have to deal with our valid types.
1492
1490
"""
0 commit comments