@@ -822,6 +822,7 @@ def take(self, indices, axis=0, allow_fill=True, fill_value=None, **kwargs):
822822 )
823823 return self ._shallow_copy (taken )
824824
825+ @final
825826 def _maybe_disallow_fill (self , allow_fill : bool , fill_value , indices ) -> bool :
826827 """
827828 We only use pandas-style take when allow_fill is True _and_
@@ -960,6 +961,7 @@ def __deepcopy__(self, memo=None):
960961 # --------------------------------------------------------------------
961962 # Rendering Methods
962963
964+ @final
963965 def __repr__ (self ) -> str_t :
964966 """
965967 Return a string representation for this object.
@@ -1710,6 +1712,7 @@ def droplevel(self, level=0):
17101712
17111713 return self ._drop_level_numbers (levnums )
17121714
1715+ @final
17131716 def _drop_level_numbers (self , levnums : List [int ]):
17141717 """
17151718 Drop MultiIndex levels by level _number_, not name.
@@ -1827,6 +1830,7 @@ def is_monotonic_decreasing(self) -> bool:
18271830 """
18281831 return self ._engine .is_monotonic_decreasing
18291832
1833+ @final
18301834 @property
18311835 def _is_strictly_monotonic_increasing (self ) -> bool :
18321836 """
@@ -1844,6 +1848,7 @@ def _is_strictly_monotonic_increasing(self) -> bool:
18441848 """
18451849 return self .is_unique and self .is_monotonic_increasing
18461850
1851+ @final
18471852 @property
18481853 def _is_strictly_monotonic_decreasing (self ) -> bool :
18491854 """
@@ -1868,6 +1873,7 @@ def is_unique(self) -> bool:
18681873 """
18691874 return self ._engine .is_unique
18701875
1876+ @final
18711877 @property
18721878 def has_duplicates (self ) -> bool :
18731879 """
@@ -2239,6 +2245,7 @@ def _is_all_dates(self) -> bool:
22392245 return is_datetime_array (ensure_object (self ._values ))
22402246
22412247 @cache_readonly
2248+ @final
22422249 def is_all_dates (self ):
22432250 """
22442251 Whether or not the index values only consist of dates.
@@ -3269,6 +3276,7 @@ def get_loc(self, key, method=None, tolerance=None):
32693276 """
32703277
32713278 @Appender (_index_shared_docs ["get_indexer" ] % _index_doc_kwargs )
3279+ @final
32723280 def get_indexer (
32733281 self , target , method = None , limit = None , tolerance = None
32743282 ) -> np .ndarray :
@@ -3328,6 +3336,7 @@ def _get_indexer(
33283336
33293337 return ensure_platform_int (indexer )
33303338
3339+ @final
33313340 def _check_indexing_method (self , method ):
33323341 """
33333342 Raise if we have a get_indexer `method` that is not supported or valid.
@@ -4542,7 +4551,7 @@ def putmask(self, mask, value):
45424551 np .putmask (values , mask , converted )
45434552 return self ._shallow_copy (values )
45444553
4545- def equals (self , other : object ) -> bool :
4554+ def equals (self , other : Any ) -> bool :
45464555 """
45474556 Determine if two Index object are equal.
45484557
@@ -5104,6 +5113,7 @@ def get_indexer_for(self, target, **kwargs):
51045113 indexer , _ = self .get_indexer_non_unique (target )
51055114 return indexer
51065115
5116+ @final
51075117 def _get_indexer_non_comparable (self , target : Index , method , unique : bool = True ):
51085118 """
51095119 Called from get_indexer or get_indexer_non_unique when the target
@@ -5142,7 +5152,7 @@ def _get_indexer_non_comparable(self, target: Index, method, unique: bool = True
51425152 return no_matches , missing
51435153
51445154 @property
5145- def _index_as_unique (self ):
5155+ def _index_as_unique (self ) -> bool :
51465156 """
51475157 Whether we should treat this as unique for the sake of
51485158 get_indexer vs get_indexer_non_unique.
@@ -5178,6 +5188,7 @@ def _maybe_promote(self, other: Index):
51785188
51795189 return self , other
51805190
5191+ @final
51815192 def _should_compare (self , other : Index ) -> bool :
51825193 """
51835194 Check if `self == other` can ever have non-False entries.
@@ -5786,10 +5797,6 @@ def _cmp_method(self, other, op):
57865797 with np .errstate (all = "ignore" ):
57875798 result = ops .comp_method_OBJECT_ARRAY (op , self ._values , other )
57885799
5789- elif is_interval_dtype (self .dtype ):
5790- with np .errstate (all = "ignore" ):
5791- result = op (self ._values , np .asarray (other ))
5792-
57935800 else :
57945801 with np .errstate (all = "ignore" ):
57955802 result = ops .comparison_op (self ._values , other , op )
@@ -5808,6 +5815,7 @@ def _arith_method(self, other, op):
58085815 return (Index (result [0 ]), Index (result [1 ]))
58095816 return Index (result )
58105817
5818+ @final
58115819 def _unary_method (self , op ):
58125820 result = op (self ._values )
58135821 return Index (result , name = self .name )
0 commit comments