@@ -325,7 +325,7 @@ def from_column_indices(
325325
326326 def _reuse_series (
327327 self : Self ,
328- attr : str ,
328+ method_name : str ,
329329 * ,
330330 returns_scalar : bool = False ,
331331 call_kwargs : dict [str , Any ] | None = None ,
@@ -337,7 +337,7 @@ def _reuse_series(
337337 leverage this method to do that for us.
338338
339339 Arguments:
340- attr : name of method.
340+ method_name : name of method.
341341 returns_scalar: whether the Series version returns a scalar. In this case,
342342 the expression version should return a 1-row Series.
343343 call_kwargs: non-expressifiable args which we may need to reuse in `agg` or `over`,
@@ -347,15 +347,15 @@ def _reuse_series(
347347 """
348348 func = partial (
349349 self ._reuse_series_inner ,
350- method_name = attr ,
350+ method_name = method_name ,
351351 returns_scalar = returns_scalar ,
352352 call_kwargs = call_kwargs or {},
353353 expressifiable_args = expressifiable_args ,
354354 )
355355 return self ._from_callable (
356356 func ,
357357 depth = self ._depth + 1 ,
358- function_name = f"{ self ._function_name } ->{ attr } " ,
358+ function_name = f"{ self ._function_name } ->{ method_name } " ,
359359 evaluate_output_names = self ._evaluate_output_names ,
360360 alias_output_names = self ._alias_output_names ,
361361 call_kwargs = call_kwargs ,
@@ -405,25 +405,28 @@ def _reuse_series_inner(
405405 return out
406406
407407 def _reuse_series_namespace (
408- self : Self , series_namespace : str , attr : str , ** kwargs : Any
408+ self : Self ,
409+ series_namespace : Literal ["cat" , "dt" , "list" , "str" , "name" ],
410+ method_name : str ,
411+ ** kwargs : Any ,
409412 ) -> Self :
410413 """Reuse Series implementation for expression.
411414
412- Just like `_reuse_series_implementation `, but for e.g. `Expr.dt.foo` instead
415+ Just like `_reuse_series `, but for e.g. `Expr.dt.foo` instead
413416 of `Expr.foo`.
414417
415418 Arguments:
416419 series_namespace: The Series namespace (e.g. `dt`, `cat`, `str`, `list`, `name`)
417- attr : name of method.
420+ method_name : name of method.
418421 kwargs: keyword arguments to pass to function.
419422 """
420423 return self ._from_callable (
421424 lambda df : [
422- getattr (getattr (series , series_namespace ), attr )(** kwargs )
425+ getattr (getattr (series , series_namespace ), method_name )(** kwargs )
423426 for series in self (df )
424427 ],
425428 depth = self ._depth + 1 ,
426- function_name = f"{ self ._function_name } ->{ series_namespace } .{ attr } " ,
429+ function_name = f"{ self ._function_name } ->{ series_namespace } .{ method_name } " ,
427430 evaluate_output_names = self ._evaluate_output_names ,
428431 alias_output_names = self ._alias_output_names ,
429432 call_kwargs = {** self ._call_kwargs , ** kwargs },
0 commit comments