5959 from narwhals ._compliant .typing import AliasNames
6060 from narwhals ._compliant .typing import EvalNames
6161 from narwhals ._compliant .typing import EvalSeries
62+ from narwhals ._compliant .typing import ScalarKwargs
6263 from narwhals ._expression_parsing import ExprKind
6364 from narwhals ._expression_parsing import ExprMetadata
6465 from narwhals .dtypes import DType
@@ -342,7 +343,7 @@ class EagerExpr(
342343 Protocol38 [EagerDataFrameT , EagerSeriesT ],
343344):
344345 _call : EvalSeries [EagerDataFrameT , EagerSeriesT ]
345- _call_kwargs : dict [ str , Any ]
346+ _scalar_kwargs : ScalarKwargs
346347
347348 def __init__ (
348349 self ,
@@ -355,7 +356,7 @@ def __init__(
355356 implementation : Implementation ,
356357 backend_version : tuple [int , ...],
357358 version : Version ,
358- call_kwargs : dict [ str , Any ] | None = None ,
359+ scalar_kwargs : ScalarKwargs | None = None ,
359360 ) -> None : ...
360361
361362 def __call__ (self , df : EagerDataFrameT ) -> Sequence [EagerSeriesT ]:
@@ -376,7 +377,7 @@ def _from_callable(
376377 evaluate_output_names : EvalNames [EagerDataFrameT ],
377378 alias_output_names : AliasNames | None ,
378379 context : _FullContext ,
379- call_kwargs : dict [ str , Any ] | None = None ,
380+ scalar_kwargs : ScalarKwargs | None = None ,
380381 ) -> Self :
381382 return cls (
382383 func ,
@@ -387,7 +388,7 @@ def _from_callable(
387388 implementation = context ._implementation ,
388389 backend_version = context ._backend_version ,
389390 version = context ._version ,
390- call_kwargs = call_kwargs ,
391+ scalar_kwargs = scalar_kwargs ,
391392 )
392393
393394 @classmethod
@@ -408,7 +409,7 @@ def _reuse_series(
408409 method_name : str ,
409410 * ,
410411 returns_scalar : bool = False ,
411- call_kwargs : dict [ str , Any ] | None = None ,
412+ scalar_kwargs : ScalarKwargs | None = None ,
412413 ** expressifiable_args : Any ,
413414 ) -> Self :
414415 """Reuse Series implementation for expression.
@@ -420,7 +421,7 @@ def _reuse_series(
420421 method_name: name of method.
421422 returns_scalar: whether the Series version returns a scalar. In this case,
422423 the expression version should return a 1-row Series.
423- call_kwargs : non-expressifiable args which we may need to reuse in `agg` or `over`,
424+ scalar_kwargs : non-expressifiable args which we may need to reuse in `agg` or `over`,
424425 such as `ddof` for `std` and `var`.
425426 expressifiable_args: keyword arguments to pass to function, which may
426427 be expressifiable (e.g. `nw.col('a').is_between(3, nw.col('b')))`).
@@ -429,7 +430,7 @@ def _reuse_series(
429430 self ._reuse_series_inner ,
430431 method_name = method_name ,
431432 returns_scalar = returns_scalar ,
432- call_kwargs = call_kwargs or {},
433+ scalar_kwargs = scalar_kwargs or {},
433434 expressifiable_args = expressifiable_args ,
434435 )
435436 return self ._from_callable (
@@ -438,7 +439,7 @@ def _reuse_series(
438439 function_name = f"{ self ._function_name } ->{ method_name } " ,
439440 evaluate_output_names = self ._evaluate_output_names ,
440441 alias_output_names = self ._alias_output_names ,
441- call_kwargs = call_kwargs ,
442+ scalar_kwargs = scalar_kwargs ,
442443 context = self ,
443444 )
444445
@@ -459,11 +460,11 @@ def _reuse_series_inner(
459460 * ,
460461 method_name : str ,
461462 returns_scalar : bool ,
462- call_kwargs : dict [ str , Any ] ,
463+ scalar_kwargs : ScalarKwargs ,
463464 expressifiable_args : dict [str , Any ],
464465 ) -> Sequence [EagerSeriesT ]:
465466 kwargs = {
466- ** call_kwargs ,
467+ ** scalar_kwargs ,
467468 ** {
468469 name : df ._evaluate_expr (value ) if self ._is_expr (value ) else value
469470 for name , value in expressifiable_args .items ()
@@ -513,7 +514,7 @@ def _reuse_series_namespace(
513514 function_name = f"{ self ._function_name } ->{ series_namespace } .{ method_name } " ,
514515 evaluate_output_names = self ._evaluate_output_names ,
515516 alias_output_names = self ._alias_output_names ,
516- call_kwargs = self ._call_kwargs ,
517+ scalar_kwargs = self ._scalar_kwargs ,
517518 context = self ,
518519 )
519520
@@ -537,7 +538,7 @@ def func(df: EagerDataFrameT) -> list[EagerSeriesT]:
537538 backend_version = self ._backend_version ,
538539 implementation = self ._implementation ,
539540 version = self ._version ,
540- call_kwargs = self ._call_kwargs ,
541+ scalar_kwargs = self ._scalar_kwargs ,
541542 )
542543
543544 def cast (self , dtype : DType | type [DType ]) -> Self :
@@ -627,10 +628,14 @@ def median(self) -> Self:
627628 return self ._reuse_series ("median" , returns_scalar = True )
628629
629630 def std (self , * , ddof : int ) -> Self :
630- return self ._reuse_series ("std" , returns_scalar = True , call_kwargs = {"ddof" : ddof })
631+ return self ._reuse_series (
632+ "std" , returns_scalar = True , scalar_kwargs = {"ddof" : ddof }
633+ )
631634
632635 def var (self , * , ddof : int ) -> Self :
633- return self ._reuse_series ("var" , returns_scalar = True , call_kwargs = {"ddof" : ddof })
636+ return self ._reuse_series (
637+ "var" , returns_scalar = True , scalar_kwargs = {"ddof" : ddof }
638+ )
634639
635640 def skew (self ) -> Self :
636641 return self ._reuse_series ("skew" , returns_scalar = True )
@@ -747,7 +752,7 @@ def alias_output_names(names: Sequence[str]) -> Sequence[str]:
747752 backend_version = self ._backend_version ,
748753 implementation = self ._implementation ,
749754 version = self ._version ,
750- call_kwargs = self ._call_kwargs ,
755+ scalar_kwargs = self ._scalar_kwargs ,
751756 )
752757
753758 def is_unique (self ) -> Self :
@@ -1087,7 +1092,7 @@ def _from_callable(self, func: AliasName, /, *, alias: bool = True) -> EagerExpr
10871092 backend_version = expr ._backend_version ,
10881093 implementation = expr ._implementation ,
10891094 version = expr ._version ,
1090- call_kwargs = expr ._call_kwargs ,
1095+ scalar_kwargs = expr ._scalar_kwargs ,
10911096 )
10921097
10931098
0 commit comments