@@ -242,7 +242,7 @@ def _has_valid_tuple(self, key: Tuple):
242242 "[{types}] types" .format (types = self ._valid_types )
243243 )
244244
245- def _is_nested_tuple_indexer (self , tup : Tuple ):
245+ def _is_nested_tuple_indexer (self , tup : Tuple ) -> bool :
246246 if any (isinstance (ax , ABCMultiIndex ) for ax in self .obj .axes ):
247247 return any (is_nested_tuple (tup , ax ) for ax in self .obj .axes )
248248 return False
@@ -275,10 +275,10 @@ def _convert_slice_indexer(self, key: slice, axis: int):
275275 ax = self .obj ._get_axis (min (axis , self .ndim - 1 ))
276276 return ax ._convert_slice_indexer (key , kind = self .name )
277277
278- def _has_valid_setitem_indexer (self , indexer ):
278+ def _has_valid_setitem_indexer (self , indexer ) -> bool :
279279 return True
280280
281- def _has_valid_positional_setitem_indexer (self , indexer ):
281+ def _has_valid_positional_setitem_indexer (self , indexer ) -> bool :
282282 """ validate that an positional indexer cannot enlarge its target
283283 will raise if needed, does not modify the indexer externally
284284 """
@@ -1314,7 +1314,7 @@ def __init__(self, name, obj):
13141314 super ().__init__ (name , obj )
13151315
13161316 @Appender (_NDFrameIndexer ._validate_key .__doc__ )
1317- def _validate_key (self , key , axis : int ):
1317+ def _validate_key (self , key , axis : int ) -> bool :
13181318 if isinstance (key , slice ):
13191319 return True
13201320
@@ -1685,7 +1685,7 @@ def _validate_key(self, key, axis: int):
16851685 if not is_list_like_indexer (key ):
16861686 self ._convert_scalar_indexer (key , axis )
16871687
1688- def _is_scalar_access (self , key : Tuple ):
1688+ def _is_scalar_access (self , key : Tuple ) -> bool :
16891689 # this is a shortcut accessor to both .loc and .iloc
16901690 # that provide the equivalent access of .at and .iat
16911691 # a) avoid getting things via sections and (to minimize dtype changes)
@@ -1998,7 +1998,7 @@ def _validate_key(self, key, axis: int):
19981998 def _has_valid_setitem_indexer (self , indexer ):
19991999 self ._has_valid_positional_setitem_indexer (indexer )
20002000
2001- def _is_scalar_access (self , key : Tuple ):
2001+ def _is_scalar_access (self , key : Tuple ) -> bool :
20022002 # this is a shortcut accessor to both .loc and .iloc
20032003 # that provide the equivalent access of .at and .iat
20042004 # a) avoid getting things via sections and (to minimize dtype changes)
@@ -2022,7 +2022,7 @@ def _getitem_scalar(self, key):
20222022 values = self .obj ._get_value (* key , takeable = True )
20232023 return values
20242024
2025- def _validate_integer (self , key : int , axis : int ):
2025+ def _validate_integer (self , key : int , axis : int ) -> None :
20262026 """
20272027 Check that 'key' is a valid position in the desired axis.
20282028
@@ -2448,7 +2448,7 @@ def maybe_convert_ix(*args):
24482448 return args
24492449
24502450
2451- def is_nested_tuple (tup , labels ):
2451+ def is_nested_tuple (tup , labels ) -> bool :
24522452 # check for a compatible nested tuple and multiindexes among the axes
24532453 if not isinstance (tup , tuple ):
24542454 return False
@@ -2461,12 +2461,12 @@ def is_nested_tuple(tup, labels):
24612461 return False
24622462
24632463
2464- def is_label_like (key ):
2464+ def is_label_like (key ) -> bool :
24652465 # select a label or row
24662466 return not isinstance (key , slice ) and not is_list_like_indexer (key )
24672467
24682468
2469- def need_slice (obj ):
2469+ def need_slice (obj ) -> bool :
24702470 return (
24712471 obj .start is not None
24722472 or obj .stop is not None
@@ -2487,7 +2487,7 @@ def _non_reducing_slice(slice_):
24872487 if isinstance (slice_ , kinds ):
24882488 slice_ = IndexSlice [:, slice_ ]
24892489
2490- def pred (part ):
2490+ def pred (part ) -> bool :
24912491 # true when slice does *not* reduce, False when part is a tuple,
24922492 # i.e. MultiIndex slice
24932493 return (isinstance (part , slice ) or is_list_like (part )) and not isinstance (
@@ -2519,7 +2519,7 @@ def _maybe_numeric_slice(df, slice_, include_bool=False):
25192519 return slice_
25202520
25212521
2522- def _can_do_equal_len (labels , value , plane_indexer , lplane_indexer , obj ):
2522+ def _can_do_equal_len (labels , value , plane_indexer , lplane_indexer , obj ) -> bool :
25232523 """ return True if we have an equal len settable """
25242524 if not len (labels ) == 1 or not np .iterable (value ) or is_scalar (plane_indexer [0 ]):
25252525 return False
0 commit comments