Skip to content

Commit 22e2203

Browse files
committed
fix typing
1 parent 6bb54e9 commit 22e2203

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

narwhals/_compliant/typing.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,6 @@ class ScalarKwargs(TypedDict, total=False):
114114
bound=CompliantSeriesOrNativeExprAny,
115115
covariant=True,
116116
)
117-
CompliantSeriesOrExprT = TypeVar(
118-
"CompliantSeriesOrExprT", bound="CompliantSeriesOrExprAny"
119-
)
120117
CompliantFrameT = TypeVar("CompliantFrameT", bound=CompliantFrameAny)
121118
CompliantFrameT_co = TypeVar(
122119
"CompliantFrameT_co", bound=CompliantFrameAny, covariant=True

narwhals/_utils.py

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
NativeFrameT_co,
7373
NativeSeriesT_co,
7474
)
75-
from narwhals._compliant.typing import CompliantSeriesOrExprT, EvalNames
75+
from narwhals._compliant.typing import EvalNames
7676
from narwhals._namespace import EagerAllowedImplementation, Namespace
7777
from narwhals._translate import ArrowStreamExportable, IntoArrowTable, ToNarwhalsT_co
7878
from narwhals.dataframe import DataFrame, LazyFrame
@@ -2038,20 +2038,42 @@ def deep_getattr(obj: Any, name_1: str, *nested: str) -> Any:
20382038
return deep_attrgetter(name_1, *nested)(obj)
20392039

20402040

2041+
@overload
2042+
def _is_close_impl(
2043+
self: CompliantExprT,
2044+
other: CompliantExprT | NumericLiteral,
2045+
*,
2046+
abs_tol: float,
2047+
rel_tol: float,
2048+
nans_equal: bool,
2049+
) -> CompliantExprT: ...
2050+
2051+
2052+
@overload
2053+
def _is_close_impl(
2054+
self: CompliantSeriesT,
2055+
other: CompliantSeriesT | NumericLiteral,
2056+
*,
2057+
abs_tol: float,
2058+
rel_tol: float,
2059+
nans_equal: bool,
2060+
) -> CompliantSeriesT: ...
2061+
2062+
20412063
def _is_close_impl(
2042-
self: CompliantSeriesOrExprT,
2043-
other: CompliantSeriesOrExprT | NumericLiteral,
2064+
self: CompliantExprT | CompliantSeriesT,
2065+
other: CompliantExprT | CompliantSeriesT | NumericLiteral,
20442066
*,
20452067
abs_tol: float,
20462068
rel_tol: float,
20472069
nans_equal: bool,
2048-
) -> CompliantSeriesOrExprT:
2070+
) -> CompliantExprT | CompliantSeriesT:
20492071
from decimal import Decimal
20502072

2051-
other_abs: CompliantSeriesOrExprT | NumericLiteral
2052-
other_is_nan: CompliantSeriesOrExprT | bool
2053-
other_is_inf: CompliantSeriesOrExprT | bool
2054-
other_is_not_inf: CompliantSeriesOrExprT | bool
2073+
other_abs: CompliantExprT | CompliantSeriesT | NumericLiteral
2074+
other_is_nan: CompliantExprT | CompliantSeriesT | bool
2075+
other_is_inf: CompliantExprT | CompliantSeriesT | bool
2076+
other_is_not_inf: CompliantExprT | CompliantSeriesT | bool
20552077

20562078
if isinstance(other, (float, int, Decimal)):
20572079
from math import isinf, isnan

0 commit comments

Comments
 (0)