@@ -21,73 +21,65 @@ def __init__(self, expr: DaskExpr) -> None:
2121 self ._compliant_expr = expr
2222
2323 def date (self ) -> DaskExpr :
24- return self ._compliant_expr ._with_callable (lambda _input : _input .dt .date , "date" )
24+ return self ._compliant_expr ._with_callable (lambda expr : expr .dt .date , "date" )
2525
2626 def year (self ) -> DaskExpr :
27- return self ._compliant_expr ._with_callable (lambda _input : _input .dt .year , "year" )
27+ return self ._compliant_expr ._with_callable (lambda expr : expr .dt .year , "year" )
2828
2929 def month (self ) -> DaskExpr :
30- return self ._compliant_expr ._with_callable (
31- lambda _input : _input .dt .month , "month"
32- )
30+ return self ._compliant_expr ._with_callable (lambda expr : expr .dt .month , "month" )
3331
3432 def day (self ) -> DaskExpr :
35- return self ._compliant_expr ._with_callable (lambda _input : _input .dt .day , "day" )
33+ return self ._compliant_expr ._with_callable (lambda expr : expr .dt .day , "day" )
3634
3735 def hour (self ) -> DaskExpr :
38- return self ._compliant_expr ._with_callable (lambda _input : _input .dt .hour , "hour" )
36+ return self ._compliant_expr ._with_callable (lambda expr : expr .dt .hour , "hour" )
3937
4038 def minute (self ) -> DaskExpr :
41- return self ._compliant_expr ._with_callable (
42- lambda _input : _input .dt .minute , "minute"
43- )
39+ return self ._compliant_expr ._with_callable (lambda expr : expr .dt .minute , "minute" )
4440
4541 def second (self ) -> DaskExpr :
46- return self ._compliant_expr ._with_callable (
47- lambda _input : _input .dt .second , "second"
48- )
42+ return self ._compliant_expr ._with_callable (lambda expr : expr .dt .second , "second" )
4943
5044 def millisecond (self ) -> DaskExpr :
5145 return self ._compliant_expr ._with_callable (
52- lambda _input : _input .dt .microsecond // 1000 , "millisecond"
46+ lambda expr : expr .dt .microsecond // 1000 , "millisecond"
5347 )
5448
5549 def microsecond (self ) -> DaskExpr :
5650 return self ._compliant_expr ._with_callable (
57- lambda _input : _input .dt .microsecond , "microsecond"
51+ lambda expr : expr .dt .microsecond , "microsecond"
5852 )
5953
6054 def nanosecond (self ) -> DaskExpr :
6155 return self ._compliant_expr ._with_callable (
62- lambda _input : _input .dt .microsecond * 1000 + _input .dt .nanosecond ,
56+ lambda expr : expr .dt .microsecond * 1000 + expr .dt .nanosecond ,
6357 "nanosecond" ,
6458 )
6559
6660 def ordinal_day (self ) -> DaskExpr :
6761 return self ._compliant_expr ._with_callable (
68- lambda _input : _input .dt .dayofyear , "ordinal_day"
62+ lambda expr : expr .dt .dayofyear , "ordinal_day"
6963 )
7064
7165 def weekday (self ) -> DaskExpr :
7266 return self ._compliant_expr ._with_callable (
73- lambda _input : _input .dt .weekday + 1 , # Dask is 0-6
67+ lambda expr : expr .dt .weekday + 1 , # Dask is 0-6
7468 "weekday" ,
7569 )
7670
7771 def to_string (self , format : str ) -> DaskExpr :
7872 return self ._compliant_expr ._with_callable (
79- lambda _input , format : _input .dt .strftime (format .replace ("%.f" , ".%f" )),
73+ lambda expr , format : expr .dt .strftime (format .replace ("%.f" , ".%f" )),
8074 "strftime" ,
8175 format = format ,
8276 )
8377
8478 def replace_time_zone (self , time_zone : str | None ) -> DaskExpr :
8579 return self ._compliant_expr ._with_callable (
86- lambda _input , time_zone : _input .dt .tz_localize (None ).dt .tz_localize (
87- time_zone
88- )
80+ lambda expr , time_zone : expr .dt .tz_localize (None ).dt .tz_localize (time_zone )
8981 if time_zone is not None
90- else _input .dt .tz_localize (None ),
82+ else expr .dt .tz_localize (None ),
9183 "tz_localize" ,
9284 time_zone = time_zone ,
9385 )
@@ -135,28 +127,28 @@ def func(s: dx.Series, time_unit: TimeUnit) -> dx.Series:
135127
136128 def total_minutes (self ) -> DaskExpr :
137129 return self ._compliant_expr ._with_callable (
138- lambda _input : _input .dt .total_seconds () // 60 , "total_minutes"
130+ lambda expr : expr .dt .total_seconds () // 60 , "total_minutes"
139131 )
140132
141133 def total_seconds (self ) -> DaskExpr :
142134 return self ._compliant_expr ._with_callable (
143- lambda _input : _input .dt .total_seconds () // 1 , "total_seconds"
135+ lambda expr : expr .dt .total_seconds () // 1 , "total_seconds"
144136 )
145137
146138 def total_milliseconds (self ) -> DaskExpr :
147139 return self ._compliant_expr ._with_callable (
148- lambda _input : _input .dt .total_seconds () * 1000 // 1 , "total_milliseconds"
140+ lambda expr : expr .dt .total_seconds () * 1000 // 1 , "total_milliseconds"
149141 )
150142
151143 def total_microseconds (self ) -> DaskExpr :
152144 return self ._compliant_expr ._with_callable (
153- lambda _input : _input .dt .total_seconds () * 1_000_000 // 1 ,
145+ lambda expr : expr .dt .total_seconds () * 1_000_000 // 1 ,
154146 "total_microseconds" ,
155147 )
156148
157149 def total_nanoseconds (self ) -> DaskExpr :
158150 return self ._compliant_expr ._with_callable (
159- lambda _input : _input .dt .total_seconds () * 1_000_000_000 // 1 ,
151+ lambda expr : expr .dt .total_seconds () * 1_000_000_000 // 1 ,
160152 "total_nanoseconds" ,
161153 )
162154
@@ -167,5 +159,5 @@ def truncate(self, every: str) -> DaskExpr:
167159 raise NotImplementedError (msg )
168160 freq = f"{ multiple } { UNIT_DICT .get (unit , unit )} "
169161 return self ._compliant_expr ._with_callable (
170- lambda _input : _input .dt .floor (freq ), "truncate"
162+ lambda expr : expr .dt .floor (freq ), "truncate"
171163 )
0 commit comments