diff --git a/py-polars/polars/series/series.py b/py-polars/polars/series/series.py index 267d3a446c5e..19b86014be5c 100644 --- a/py-polars/polars/series/series.py +++ b/py-polars/polars/series/series.py @@ -782,14 +782,38 @@ def __le__(self, other: Any) -> Series | Expr: return F.lit(self).__le__(other) return self._comp(other, "lt_eq") + @overload + def le(self, other: Expr) -> Expr: # type: ignore[overload-overlap] + ... + + @overload + def le(self, other: Any) -> Series: + ... + def le(self, other: Any) -> Self | Expr: """Method equivalent of operator expression `series <= other`.""" return self.__le__(other) + @overload + def lt(self, other: Expr) -> Expr: # type: ignore[overload-overlap] + ... + + @overload + def lt(self, other: Any) -> Series: + ... + def lt(self, other: Any) -> Self | Expr: """Method equivalent of operator expression `series < other`.""" return self.__lt__(other) + @overload + def eq(self, other: Expr) -> Expr: # type: ignore[overload-overlap] + ... + + @overload + def eq(self, other: Any) -> Series: + ... + def eq(self, other: Any) -> Self | Expr: """Method equivalent of operator expression `series == other`.""" return self.__eq__(other) @@ -840,6 +864,14 @@ def eq_missing(self, other: Any) -> Self | Expr: ] """ + @overload + def ne(self, other: Expr) -> Expr: # type: ignore[overload-overlap] + ... + + @overload + def ne(self, other: Any) -> Series: + ... + def ne(self, other: Any) -> Self | Expr: """Method equivalent of operator expression `series != other`.""" return self.__ne__(other) @@ -890,10 +922,26 @@ def ne_missing(self, other: Any) -> Self | Expr: ] """ + @overload + def ge(self, other: Expr) -> Expr: # type: ignore[overload-overlap] + ... + + @overload + def ge(self, other: Any) -> Series: + ... + def ge(self, other: Any) -> Self | Expr: """Method equivalent of operator expression `series >= other`.""" return self.__ge__(other) + @overload + def gt(self, other: Expr) -> Expr: # type: ignore[overload-overlap] + ... + + @overload + def gt(self, other: Any) -> Series: + ... + def gt(self, other: Any) -> Self | Expr: """Method equivalent of operator expression `series > other`.""" return self.__gt__(other)