diff --git a/pandas/core/groupby/ops.py b/pandas/core/groupby/ops.py index d6b63956422c7..5feed98cbc75b 100644 --- a/pandas/core/groupby/ops.py +++ b/pandas/core/groupby/ops.py @@ -15,6 +15,7 @@ Generic, Hashable, Iterator, + NoReturn, Sequence, final, ) @@ -1243,7 +1244,7 @@ def groupings(self) -> list[grouper.Grouping]: ping = grouper.Grouping(lev, lev, in_axis=False, level=None) return [ping] - def _aggregate_series_fast(self, obj: Series, func: Callable) -> np.ndarray: + def _aggregate_series_fast(self, obj: Series, func: Callable) -> NoReturn: # -> np.ndarray[object] raise NotImplementedError( "This should not be reached; use _aggregate_series_pure_python" diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index ffb222c61f6ab..14f9b71c5e03c 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -12,6 +12,7 @@ Hashable, Iterable, Literal, + NoReturn, Sequence, TypeVar, cast, @@ -3166,7 +3167,7 @@ def __xor__(self, other): return self.symmetric_difference(other) @final - def __nonzero__(self): + def __nonzero__(self) -> NoReturn: raise ValueError( f"The truth value of a {type(self).__name__} is ambiguous. " "Use a.empty, a.bool(), a.item(), a.any() or a.all()." diff --git a/pandas/core/indexes/frozen.py b/pandas/core/indexes/frozen.py index 90713e846fbd1..043fd07b28025 100644 --- a/pandas/core/indexes/frozen.py +++ b/pandas/core/indexes/frozen.py @@ -8,7 +8,10 @@ """ from __future__ import annotations -from typing import Any +from typing import ( + Any, + NoReturn, +) from pandas.core.base import PandasObject @@ -93,7 +96,7 @@ def __reduce__(self): def __hash__(self) -> int: # type: ignore[override] return hash(tuple(self)) - def _disabled(self, *args, **kwargs): + def _disabled(self, *args, **kwargs) -> NoReturn: """ This method will not function because object is immutable. """