
    gׯ                       d dl mZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 d d	l	mZ d d
l	mZ d dl	mZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ er"d dlZd dlmZ d dl m!Z! d dl"m#Z# d dl$m%Z% d dlm&Z&  G d ded         Z' G d d       Z( G d! d"      Z) G d# d$      Z*y)%    )annotations)TYPE_CHECKING)Any)Callable)Literal)NoReturn)Sequence)add_row_index)binary_operation_returns_scalar)maybe_evaluate)narwhals_to_native_dtype)infer_new_root_output_names)calculate_timestamp_date)calculate_timestamp_datetime)native_to_narwhals_dtype)ColumnNotFoundErrorInvalidOperationError)CompliantExpr)Implementation)generate_temporary_column_name)import_dtypes_moduleN)Self)DaskLazyFrameDaskNamespace)DType)Versionc                     e Zd ZU ej                  Zded<   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dQdZdRdZdSdZ	dTdZ
e	 	 	 	 	 	 	 	 	 	 dUd       Ze	 	 	 	 	 	 	 	 	 	 dVd       Z	 	 	 	 	 	 	 	 	 	 dWd	ZdXd
ZdYdZdYdZdYdZdYdZdYdZdYdZdYdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZd[dZd\dZ d\dZ!d\dZ"d\dZ#d]dZ$d]d Z%d[d!Z&d^d"Z'd_d#Z(d_d$Z)d_d%Z*d_d&Z+d_d'Z,	 d`	 	 	 	 	 	 	 dad(Z-d\d)Z.d\d*Z/dbd+Z0d,d,d,d,d-d.d/d0	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dcd1Z1ddd2Z2ddd3Z3ddd4Z4	 	 	 	 	 	 	 	 ded5Z5d/d/d6dfd7Z6d\d8Z7d\d9Z8d\d:Z9	 	 	 dg	 	 	 	 	 	 	 	 	 dhd;Z:	 	 	 	 	 	 	 	 did<Z;d[d=Z<d[d>Z=d[d?Z>d[d@Z?d[dAZ@	 	 	 	 	 	 	 	 djdBZAd[dCZBd[dDZCd[dEZDd[dFZEdkdGZFd[dHZGdldIZHdmdndJZIdodKZJeKdpdL       ZLeKdqdM       ZMeKdrdN       ZN	 	 	 	 	 	 dsdOZOd[dPZPy,)tDaskExprr   _implementationc                   || _         || _        || _        || _        || _        || _        || _        || _        |	| _        y N)	_call_depth_function_name_root_names_output_names_returns_scalar_backend_version_version_kwargs)
selfcalldepthfunction_name
root_namesoutput_namesreturns_scalarbackend_versionversionkwargss
             H/var/www/openai/venv/lib/python3.12/site-packages/narwhals/_dask/expr.py__init__zDaskExpr.__init__&   sH     
+%)- /    c                $    | j                  |      S r#   )r$   )r-   dfs     r7   __call__zDaskExpr.__call__?   s    zz"~r9   c                     y r#    r-   s    r7   __narwhals_expr__zDaskExpr.__narwhals_expr__B   s    r9   c                J    ddl m}  || j                  | j                        S )Nr   r   )r4   r5   )narwhals._dask.namespacer   r*   r+   )r-   r   s     r7   __narwhals_namespace__zDaskExpr.__narwhals_namespace__D   s    :T-B-BDMMZZr9   c               V    dfd} | |ddt              t              d||i 	      S )Nc                    	 D cg c]  }| j                   |    c}S c c}w # t        $ rK}D cg c]  }|| j                  vs| nc c}w }}t        j                  || j                        |d }~ww xY w)N)missing_columnsavailable_columns)_native_frameKeyErrorcolumnsr   'from_missing_and_available_column_names)r;   column_nameexrF   column_namess        r7   funcz(DaskExpr.from_column_names.<locals>.funcQ   s    IUV+((5VVV .:"Rlarzz>Q1l"R"R)QQ$3&(jj s1   %  % % 	A9A4AA
*A44A9r   colFr/   r0   r1   r2   r3   r4   r5   r6   r;   r   returnzlist[dask_expr.Series])list)clsr4   r5   rO   rP   s      ` r7   from_column_nameszDaskExpr.from_column_namesJ   s<    	 L)l+ +

 
	
r9   c               2    dfd} | |ddd d d||i 	      S )Nc                d    D cg c]  }| j                   j                  d d |f   ! c}S c c}w r#   )rH   iloc)r;   column_indexcolumn_indicess     r7   rP   z*DaskExpr.from_column_indices.<locals>.funcn   s9    KYKY<  %%ao6>  s   $-r   nthFrR   rS   r>   )rV   r4   r5   r\   rP   s      ` r7   from_column_indiceszDaskExpr.from_column_indicesg   s2    	
  +

 
	
r9   c                    d fd}t         fi \  }} j                  | j                  dz    j                   d| || j                   j
                  i  j                  	      S )Nc           	     V   g }j                  |       }
j                         D ci c]  \  }}|t        | |       }}}|D ]\  }|j                  }j                  r|d   } 	|fi |}r|j                         }|j                  |      }|j                  |       ^ |S c c}}w )Nr   )r$   itemsr   namer)   	to_seriesrenameappend)r;   resultsinputskeyvaluer,   _inputrb   resultr.   r6   r3   r-   s            r7   rP   z!DaskExpr._from_call.<locals>.func   s    GZZ^FHNW*#usN2u55GW {{''#AYFf00!#--/Ft,v& ! N Xs   B%   z->rR   rS   )r   	__class__r%   r&   r*   r+   r,   )r-   r.   	expr_namer3   r6   rP   r1   r2   s   `` ``   r7   
_from_callzDaskExpr._from_call   s    	 	 $?t#Nv#N 
L~~++/!001I;?!%) 11MM-dll-f-  

 
	
r9   c                     d fd} j                  | j                   j                   j                  g j                   j
                   j                  i  j                  di	      S )Nc                n    j                  |       }|D cg c]  }|j                         c}S c c}w r#   )r$   rd   )r;   rg   rj   rb   r-   s      r7   rP   zDaskExpr.alias.<locals>.func   s1    ZZ^F6<=fFFMM$'f===s   2rb   rR   rS   )rm   r%   r&   r'   r)   r*   r+   r,   )r-   rb   rP   s   `` r7   aliaszDaskExpr.alias   sm    	> ~~++--''// 11MM1dll1FD1  

 
	
r9   c           	     B    | j                  d d|t        | |            S )Nc                $    | j                  |      S r#   )__add__rj   others     r7   <lambda>z"DaskExpr.__add__.<locals>.<lambda>       &.."7r9   ru   rw   r3   ro   r   r-   rw   s     r7   ru   zDaskExpr.__add__   +    7:4G	  
 	
r9   c           	     B    | j                  d d|t        | |            S )Nc                $    | j                  |      S r#   )__sub__rv   s     r7   rx   z"DaskExpr.__sub__.<locals>.<lambda>   ry   r9   r   rz   r{   r|   s     r7   r   zDaskExpr.__sub__   r}   r9   c           	     B    | j                  d d|t        | |            S )Nc                $    | j                  |      S r#   )__mul__rv   s     r7   rx   z"DaskExpr.__mul__.<locals>.<lambda>   ry   r9   r   rz   r{   r|   s     r7   r   zDaskExpr.__mul__   r}   r9   c           	     B    | j                  d d|t        | |            S )Nc                $    | j                  |      S r#   )__truediv__rv   s     r7   rx   z&DaskExpr.__truediv__.<locals>.<lambda>   s    &"4"4U";r9   r   rz   r{   r|   s     r7   r   zDaskExpr.__truediv__   s+    ;:4G	  
 	
r9   c           	     B    | j                  d d|t        | |            S )Nc                $    | j                  |      S r#   )__floordiv__rv   s     r7   rx   z'DaskExpr.__floordiv__.<locals>.<lambda>   s    &"5"5e"<r9   r   rz   r{   r|   s     r7   r   zDaskExpr.__floordiv__   s+    <:4G	  
 	
r9   c           	     B    | j                  d d|t        | |            S )Nc                $    | j                  |      S r#   )__pow__rv   s     r7   rx   z"DaskExpr.__pow__.<locals>.<lambda>   ry   r9   r   rz   r{   r|   s     r7   r   zDaskExpr.__pow__   r}   r9   c           	     B    | j                  d d|t        | |            S )Nc                $    | j                  |      S r#   )__mod__rv   s     r7   rx   z"DaskExpr.__mod__.<locals>.<lambda>   ry   r9   r   rz   r{   r|   s     r7   r   zDaskExpr.__mod__   r}   r9   c           	     B    | j                  d d|t        | |            S )Nc                $    | j                  |      S r#   )__eq__rv   s     r7   rx   z!DaskExpr.__eq__.<locals>.<lambda>       &--"6r9   r   rz   r{   r|   s     r7   r   zDaskExpr.__eq__   +    6:4G	  
 	
r9   c           	     B    | j                  d d|t        | |            S )Nc                $    | j                  |      S r#   )__ne__rv   s     r7   rx   z!DaskExpr.__ne__.<locals>.<lambda>   r   r9   r   rz   r{   r|   s     r7   r   zDaskExpr.__ne__   r   r9   c           	     B    | j                  d d|t        | |            S )Nc                $    | j                  |      S r#   )__ge__rv   s     r7   rx   z!DaskExpr.__ge__.<locals>.<lambda>   r   r9   r   rz   r{   r|   s     r7   r   zDaskExpr.__ge__   r   r9   c           	     B    | j                  d d|t        | |            S )Nc                $    | j                  |      S r#   )__gt__rv   s     r7   rx   z!DaskExpr.__gt__.<locals>.<lambda>  r   r9   r   rz   r{   r|   s     r7   r   zDaskExpr.__gt__  r   r9   c           	     B    | j                  d d|t        | |            S )Nc                $    | j                  |      S r#   )__le__rv   s     r7   rx   z!DaskExpr.__le__.<locals>.<lambda>  r   r9   r   rz   r{   r|   s     r7   r   zDaskExpr.__le__  r   r9   c           	     B    | j                  d d|t        | |            S )Nc                $    | j                  |      S r#   )__lt__rv   s     r7   rx   z!DaskExpr.__lt__.<locals>.<lambda>  r   r9   r   rz   r{   r|   s     r7   r   zDaskExpr.__lt__  r   r9   c           	     B    | j                  d d|t        | |            S )Nc                $    | j                  |      S r#   )__and__rv   s     r7   rx   z"DaskExpr.__and__.<locals>.<lambda>   ry   r9   r   rz   r{   r|   s     r7   r   zDaskExpr.__and__  r}   r9   c           	     B    | j                  d d|t        | |            S )Nc                $    | j                  |      S r#   )__or__rv   s     r7   rx   z!DaskExpr.__or__.<locals>.<lambda>(  r   r9   r   rz   r{   r|   s     r7   r   zDaskExpr.__or__&  r   r9   c                @    | j                  d d| j                        S )Nc                "    | j                         S r#   )
__invert__rj   s    r7   rx   z%DaskExpr.__invert__.<locals>.<lambda>0  s    6,,.r9   r   r3   ro   r)   r?   s    r7   r   zDaskExpr.__invert__.  s'    .//  
 	
r9   c                ,    | j                  d dd      S )Nc                "    | j                         S r#   )meanr   s    r7   rx   zDaskExpr.mean.<locals>.<lambda>7  
    6;;=r9   r   Tr   ro   r?   s    r7   r   zDaskExpr.mean5  !    (  
 	
r9   c                H     ddl m d fd} j                  |dd      S )Nr   r   c                    t        | j                  t        j                        }|j	                         s
d} |      | j                         S )Nz<`median` operation not supported for non-numeric input type.)r   r+   r   DASK
is_numericmedian_approximate)sdtypemsgr   r-   s      r7   rP   zDaskExpr.median.<locals>.func?  sF    ,Q~?R?RSE##%T+C00''))r9   medianTr   )r   dask_expr.SeriesrT   r   )narwhals.exceptionsr   ro   )r-   rP   r   s   ` @r7   r   zDaskExpr.median<  s"    =	* tXdCCr9   c                ,    | j                  d dd      S )Nc                "    | j                         S r#   )minr   s    r7   rx   zDaskExpr.min.<locals>.<lambda>J  
    6::<r9   r   Tr   r   r?   s    r7   r   zDaskExpr.minH  !    '  
 	
r9   c                ,    | j                  d dd      S )Nc                "    | j                         S r#   )maxr   s    r7   rx   zDaskExpr.max.<locals>.<lambda>Q  r   r9   r   Tr   r   r?   s    r7   r   zDaskExpr.maxO  r   r9   c                .    | j                  d d|d      S )Nc                &    | j                  |      S N)ddof)stdrj   r   s     r7   rx   zDaskExpr.std.<locals>.<lambda>X      !6r9   r   Tr   r3   r   r-   r   s     r7   r   zDaskExpr.stdV  $    6	  
 	
r9   c                .    | j                  d d|d      S )Nc                &    | j                  |      S r   )varr   s     r7   rx   zDaskExpr.var.<locals>.<lambda>`  r   r9   r   Tr   r   r   s     r7   r   zDaskExpr.var^  r   r9   c                ,    | j                  d dd      S )Nc                "    | j                         S r#   )skewr   s    r7   rx   zDaskExpr.skew.<locals>.<lambda>h  r   r9   r   Tr   r   r?   s    r7   r   zDaskExpr.skewf  r   r9   c                B    | j                  d d|| j                        S )Nc                $    | j                  |      S r#   )shift)rj   ns     r7   rx   z DaskExpr.shift.<locals>.<lambda>o  s    fll1or9   r   )r   r3   r   )r-   r   s     r7   r   zDaskExpr.shiftm  s*    -//	  
 	
r9   c               ^    |rd}t        |      | j                  d d| j                        S )Nz:`cum_sum(reverse=True)` is not supported with Dask backendc                "    | j                         S r#   )cumsumr   s    r7   rx   z"DaskExpr.cum_sum.<locals>.<lambda>{  
    6==?r9   cum_sumr   NotImplementedErrorro   r)   r-   reverser   s      r7   r   zDaskExpr.cum_sumu  :    NC%c***//  
 	
r9   c               ^    |rd}t        |      | j                  d d| j                        S )Nz<`cum_count(reverse=True)` is not supported with Dask backendc                f    | j                          j                  t              j                         S r#   )isnaastypeintr   r   s    r7   rx   z$DaskExpr.cum_count.<locals>.<lambda>  s     V[[]N2237>>@r9   	cum_countr   r   r   s      r7   r   zDaskExpr.cum_count  s:    PC%c**@//  
 	
r9   c               ^    |rd}t        |      | j                  d d| j                        S )Nz:`cum_min(reverse=True)` is not supported with Dask backendc                "    | j                         S r#   )cumminr   s    r7   rx   z"DaskExpr.cum_min.<locals>.<lambda>  r   r9   cum_minr   r   r   s      r7   r   zDaskExpr.cum_min  r   r9   c               ^    |rd}t        |      | j                  d d| j                        S )Nz:`cum_max(reverse=True)` is not supported with Dask backendc                "    | j                         S r#   )cummaxr   s    r7   rx   z"DaskExpr.cum_max.<locals>.<lambda>  r   r9   cum_maxr   r   r   s      r7   r   zDaskExpr.cum_max  r   r9   c               ^    |rd}t        |      | j                  d d| j                        S )Nz;`cum_prod(reverse=True)` is not supported with Dask backendc                "    | j                         S r#   )cumprodr   s    r7   rx   z#DaskExpr.cum_prod.<locals>.<lambda>  s    6>>+r9   cum_prodr   r   r   s      r7   r   zDaskExpr.cum_prod  s:    OC%c**+//  
 	
r9   c                T    |dk(  rd}| j                  d d|||| j                        S )Nnoneneitherc                (    | j                  |||      S r#   )between)rj   lower_boundupper_boundcloseds       r7   rx   z%DaskExpr.is_between.<locals>.<lambda>  s    V^^>r9   
is_between)r   r   r   r3   r   )r-   r   r   r   s       r7   r  zDaskExpr.is_between  sC     VF
 ##//  
 	
r9   c                ,    | j                  d dd      S )Nc                "    | j                         S r#   )sumr   s    r7   rx   zDaskExpr.sum.<locals>.<lambda>  r   r9   r  Tr   r   r?   s    r7   r  zDaskExpr.sum  r   r9   c                ,    | j                  d dd      S )Nc                "    | j                         S r#   )countr   s    r7   rx   z DaskExpr.count.<locals>.<lambda>  s
    6<<>r9   r  Tr   r   r?   s    r7   r  zDaskExpr.count  s!    )  
 	
r9   c                B    | j                  d d|| j                        S )Nc                $    | j                  |      S r#   )round)rj   decimalss     r7   rx   z DaskExpr.round.<locals>.<lambda>  s    V\\(%;r9   r
  )r  r3   r   )r-   r  s     r7   r
  zDaskExpr.round  s*    ;//	  
 	
r9   NTrl   F)comspan	half_lifealphaadjustmin_periodsignore_nullsc                   d}t        |      )Nz5`Expr.ewm_mean` is not supported for the Dask backendr   )	r-   r  r  r  r  r  r  r  r   s	            r7   ewm_meanzDaskExpr.ewm_mean  s     F!#&&r9   c                    d}t        |      )Nz[`Expr.unique` is not supported for the Dask backend. Please use `LazyFrame.unique` instead.r  r-   r   s     r7   uniquezDaskExpr.unique  s    k!#&&r9   c                    d}t        |      )Nzc`Expr.drop_nulls` is not supported for the Dask backend. Please use `LazyFrame.drop_nulls` instead.r  r  s     r7   
drop_nullszDaskExpr.drop_nulls  s    s!#&&r9   c                    d}t        |      )NzW`Expr.head` is not supported for the Dask backend. Please use `LazyFrame.head` instead.r  r  s     r7   headzDaskExpr.head      g!#&&r9   c                   d}t        |      )Nz:`replace_strict` is not yet supported for Dask expressionsr  )r-   oldnewreturn_dtyper   s        r7   replace_strictzDaskExpr.replace_strict  s     K!#&&r9   )
descending
nulls_lastc                   d}t        |      )NzW`Expr.sort` is not supported for the Dask backend. Please use `LazyFrame.sort` instead.r  )r-   r#  r$  r   s       r7   sortzDaskExpr.sort  r  r9   c                @    | j                  d d| j                        S )Nc                "    | j                         S r#   )absr   s    r7   rx   zDaskExpr.abs.<locals>.<lambda>  r   r9   r)  r   r   r?   s    r7   r)  zDaskExpr.abs  s'    '//  
 	
r9   c                ,    | j                  d dd      S )Nc                ,    | j                  d ddd       S )NTF)axisskipnasplit_everyout)allr   s    r7   rx   zDaskExpr.all.<locals>.<lambda>  s    6::$Et & r9   r0  Tr   r   r?   s    r7   r0  zDaskExpr.all  s%       
 	
r9   c                ,    | j                  d dd      S )Nc                *    | j                  ddd      S )Nr   TF)r,  r-  r.  )anyr   s    r7   rx   zDaskExpr.any.<locals>.<lambda>  s    6::1Tu:Mr9   r3  Tr   r   r?   s    r7   r3  zDaskExpr.any  s!    M  
 	
r9   c                `    	 	 	 	 	 	 	 	 	 	 dd}| j                  |d|||| j                        S )Nc                    || j                  |      }|S |dk(  r| j                  |      n| j                  |      }|S )Nforward)limit)fillnaffillbfill)rj   ri   strategyr7  res_sers        r7   rP   z DaskExpr.fill_null.<locals>.func  sS       --. N  9, LLuL-E2 
 Nr9   r8  )ri   r;  r7  r3   )
rj   r   ri   
Any | Noner;  
str | Noner7  
int | NonerT   r   r   )r-   ri   r;  r7  rP   s        r7   	fill_nullzDaskExpr.fill_null  se    	$		 !	 		
 	  //  
 	
r9   c                D    | j                  d d||| j                        S )Nc                (    | j                  ||      S )N)lowerupper)clip)rj   r   r   s      r7   rx   zDaskExpr.clip.<locals>.<lambda>;  s    V[[! 6A 6r9   rE  )r   r   r3   r   )r-   r   r   s      r7   rE  zDaskExpr.clip5  s3    
  ##//  
 	
r9   c                @    | j                  d d| j                        S )Nc                "    | j                         S r#   )diffr   s    r7   rx   zDaskExpr.diff.<locals>.<lambda>F  r   r9   rH  r   r   r?   s    r7   rH  zDaskExpr.diffD  s'    (//  
 	
r9   c                ,    | j                  d dd      S )Nc                &    | j                  d      S )NFdropna)nuniquer   s    r7   rx   z#DaskExpr.n_unique.<locals>.<lambda>M  s    6>>>7r9   n_uniqueTr   r   r?   s    r7   rN  zDaskExpr.n_uniqueK  s!    7  
 	
r9   c                @    | j                  d d| j                        S )Nc                "    | j                         S r#   )r   r   s    r7   rx   z"DaskExpr.is_null.<locals>.<lambda>T  r   r9   is_nullr   r   r?   s    r7   rQ  zDaskExpr.is_nullR  s'    (//  
 	
r9   c                L     d fd} j                  |d j                        S )Nc                    t        | j                  j                        }|j                         r| | k7  S d| d}t	        |      )Nz4`.is_nan` only supported for numeric dtypes and not z, did you mean `.is_null`?)r   r+   r!   r   r   )rj   r   r   r-   s      r7   rP   zDaskExpr.is_nan.<locals>.funcZ  sL    ,VT]]DDXDXYE!''HOijC',,r9   rQ  r   rj   r   rT   r   r   r-   rP   s   ` r7   is_nanzDaskExpr.is_nanY  s/    	- //  
 	
r9   c                ,    | j                  d dd      S )Nc                    | j                   S r#   )sizer   s    r7   rx   zDaskExpr.len.<locals>.<lambda>i  s    6;;r9   lenTr   r   r?   s    r7   rZ  zDaskExpr.leng  s!    &  
 	
r9   c                X    |dk(  rdd}| j                  |d|d      S d}t        |      )Nlinearquantilec                `    | j                   dkD  rd}t        |      | j                  |d      S )Nrl   zK`Expr.quantile` is not supported for Dask backend with multiple partitions.dask)qmethod)npartitionsr   r]  )rj   r]  r   s      r7   rP   zDaskExpr.quantile.<locals>.funcu  s3    %%)gC-c22&AAr9   T)r]  r3   zx`higher`, `lower`, `midpoint`, `nearest` - interpolation methods are not supported by Dask. Please use `linear` instead.)rj   r   r]  floatrT   r   )ro   r   )r-   r]  interpolationrP   r   s        r7   r]  zDaskExpr.quantilen  sI    
 H$B ??!#	 #   MC%c**r9   c                L     d fd} j                  |d j                        S )Nc                   | j                   }t        d|g      }t        | j                         |j                  j
                        } | j                  |      j                  |di      |   }| |   j                  |      S )N   n_bytesrJ   r4   implementationr   	rb   r   r
   to_framer*   r!   groupbyaggisin)rj   _name	col_tokenfirst_distinct_indexr-   s       r7   rP   z(DaskExpr.is_first_distinct.<locals>.func  s    KKE6q5'RI"! $ 5 5#33	F $*>>%#8#<#<i=O#P$  )$))*>??r9   is_first_distinctr   rT  r   rU  s   ` r7   rt  zDaskExpr.is_first_distinct  s0    	@ //  
 	
r9   c                L     d fd} j                  |d j                        S )Nc                   | j                   }t        d|g      }t        | j                         |j                  j
                        } | j                  |      j                  |di      |   }| |   j                  |      S )Nrg  rh  rj  r   rl  )rj   rq  rr  last_distinct_indexr-   s       r7   rP   z'DaskExpr.is_last_distinct.<locals>.func  s    KKE6q5'RI"! $ 5 5#33	F #).."7";";Y<N"OPY"Z)$))*=>>r9   is_last_distinctr   rT  r   rU  s   ` r7   rx  zDaskExpr.is_last_distinct  s/    	? //  
 	
r9   c                F    dd}| j                  |d| j                        S )Nc                    | j                   }| j                         j                  |d      j                  d|t        f      dkD  S NFrK  rY  )metarl   rb   rm  rn  	transformr   rj   rq  s     r7   rP   z$DaskExpr.is_duplicated.<locals>.func  sB    KKE!u-65r9   is_duplicatedr   rT  r   rU  s     r7   r  zDaskExpr.is_duplicated  s.    	 //  
 	
r9   c                F    dd}| j                  |d| j                        S )Nc                    | j                   }| j                         j                  |d      j                  d|t        f      dk(  S r{  r}  r  s     r7   rP   z DaskExpr.is_unique.<locals>.func  sB    KKE!u-65r9   	is_uniquer   rT  r   rU  s     r7   r  zDaskExpr.is_unique  s.    	 //  
 	
r9   c                B    | j                  d d|| j                        S )Nc                $    | j                  |      S r#   )rp  rv   s     r7   rx   z DaskExpr.is_in.<locals>.<lambda>  s    &++e"4r9   is_inrz   r   r|   s     r7   r  zDaskExpr.is_in  s*    4//	  
 	
r9   c                ,    | j                  d dd      S )Nc                >    | j                         j                         S r#   )r   r  r   s    r7   rx   z%DaskExpr.null_count.<locals>.<lambda>  s    6;;=,,.r9   
null_countTr   r   r?   s    r7   r  zDaskExpr.null_count  s!    .  
 	
r9   c                    d}t        |      )NzW`Expr.tail` is not supported for the Dask backend. Please use `LazyFrame.tail` instead.r  r  s     r7   tailzDaskExpr.tail  r  r9   c                    d}t        |      )Nzg`Expr.gather_every` is not supported for the Dask backend. Please use `LazyFrame.gather_every` instead.r  )r-   r   offsetr   s       r7   gather_everyzDaskExpr.gather_every  s    w!#&&r9   c                     d fd} j                  | j                  dz    j                  dz    j                   j                  d j
                   j                  i  j                  di	      S )Nc                b   j                   d}t        |      | j                  j                  dk(  rk | j                  ddij                        } | j                   j                  |dd      j                  }j                   D cg c]  }||   	 c}S d}t        |      c c}w )	NzAnonymous expressions are not supported in over.
Instead of `nw.all()`, try using a named expression, such as `nw.col('a', 'b')`
rl   drop_null_keysFleft_right)howleft_onright_onsuffixzG`Expr.over` is not supported for Dask backend with multiple partitions.)	r(   
ValueErrorrH   rb  group_byro  selectjoinr   )r;   r   tmp
tmp_nativerb   keysr-   s        r7   rP   zDaskExpr.over.<locals>.func  s    !!)+ 
 !o%++q0!bkk4>>BB4HBIIt$T#64$xTX"] 
 6:5G5GH5GT
4(5GHHY  &c**	 Is   B,rl   z->overFr  rR   )r;   r   rT   z	list[Any])rm   r%   r&   r'   r(   r*   r+   r,   )r-   r  rP   s   `` r7   overzDaskExpr.over  st    	+, ~~++/--8''++  11MM1dll1FD1  

 
	
r9   c                    t        |       S r#   )DaskExprStringNamespacer?   s    r7   strzDaskExpr.str  s    &t,,r9   c                    t        |       S r#   )DaskExprDateTimeNamespacer?   s    r7   dtzDaskExpr.dt  s    (..r9   c                    t        |       S r#   )DaskExprNameNamespacer?   s    r7   rb   zDaskExpr.name  s    $T**r9   c                N     d fd} j                  |d| j                        S )Nc                R    t        |j                        }| j                  |      S r#   )r   r+   r   )rj   r   r-   s     r7   rP   zDaskExpr.cast.<locals>.func  s"    ,UDMMBE==''r9   cast)r   r3   )rj   r   r   DType | type[DType]rT   r   r   )r-   r   rP   s   `  r7   r  zDaskExpr.cast  s2    	( //	  
 	
r9   c                R    dd l m | j                  fdd| j                        S )Nr   c                &    j                  |       S r#   )isfinite)rj   das    r7   rx   z$DaskExpr.is_finite.<locals>.<lambda>*  s    2;;v.r9   	is_finiter   )
dask.arrayarrayro   r)   )r-   r  s    @r7   r  zDaskExpr.is_finite&  s+    .//  
 	
r9   )r.   z5Callable[[DaskLazyFrame], Sequence[dask_expr.Series]]r/   r   r0   r  r1   list[str] | Noner2   r  r3   boolr4   tuple[int, ...]r5   r   r6   zdict[str, Any]rT   None)r;   r   rT   zSequence[dask_expr.Series])rT   r  )rT   r   )
rV   
type[Self]rO   r  r4   r  r5   r   rT   r   )
rV   r  r\   r   r4   r  r5   r   rT   r   )
r.   zCallable[..., dask_expr.Series]rn   r  r3   r  r6   r   rT   r   )rb   r  rT   r   )rw   r   rT   r   )rw   r    rT   r   )r-   r   rT   r   )rT   r   )r   r   rT   r   )r   r   rT   r   )r-   r   r   r  rT   r   )both)r   
Self | Anyr   r  r   r  rT   r   )r  r   rT   r   )r-   r   r  float | Noner  r  r  r  r  r  r  r  r  r   r  r  rT   r   )rT   r   )r  Sequence[Any]r   r  r!  zDType | NonerT   r   )r#  r  r$  r  rT   r   )NNN)
r-   r   ri   r=  r;  z%Literal['forward', 'backward'] | Noner7  r?  rT   r    )r-   r   r   Self | Any | Noner   r  rT   r   )r-   r   r]  rc  rd  z;Literal['nearest', 'higher', 'lower', 'midpoint', 'linear']rT   r   )r-   r   rw   r   rT   r   )r-   r   rT   r   )r   )r-   r   r   r   r  r   rT   r   )r-   r   r  z	list[str]rT   r   )r-   r   rT   r  )r-   r   rT   r  )r-   r   rT   r  )r-   r   r   r  rT   r   )Q__name__
__module____qualname__r   r   r!   __annotations__r8   r<   r@   rC   classmethodrW   r^   ro   rr   ru   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r
  r  r  r  r  r"  r&  r)  r0  r3  r@  rE  rH  rN  rQ  rV  rZ  r]  rt  rx  r  r  r  r  r  r  r  propertyr  r  rb   r  r  r>   r9   r7   r    r    #   s   &4&9&9O^9C 	
  % '  )   
2 -[ 


 )
 	

 

 
8 


 )
 	

 

 
.$
 .$
 	$
 $
 $
 
$
L
"

















D





	
	
	
	
	
 	

  
 	

 

*


 !!"&""'' ' 	'
  ' ' ' ' ' 
''
'
'
' ''4'GS'	' */5 '



 !:> 	


 8
 	

 

>

&
 '
 
	





+++ S+ 
	+.
,
(
 
 

'
'
!
F - - / / + +

"
 


r9   r    r   c                      e Zd ZddZddZddd	 	 	 	 	 	 	 	 	 ddZdd	 	 	 	 	 	 	 ddZddd
ZddZddZ	ddddZ
dddZddZddZddZy	)r  c                    || _         y r#   _compliant_exprr-   exprs     r7   r8   z DaskExprStringNamespace.__init__1  
    #r9   c                h    | j                   j                  d d| j                   j                        S )Nc                6    | j                   j                         S r#   )r  rZ  r   s    r7   rx   z3DaskExprStringNamespace.len_chars.<locals>.<lambda>6  s    6::>>+r9   rZ  r   r  ro   r)   r?   s    r7   	len_charsz!DaskExprStringNamespace.len_chars4  s5    ##..+//?? / 
 	
r9   Frl   )literalr   c          	     p    | j                   j                  d d||||| j                   j                        S )Nc                B    | j                   j                  ||| |      S )N)regexr   r  replace)rj   patternri   r  r   s        r7   rx   z1DaskExprStringNamespace.replace.<locals>.<lambda>D  s$    vzz7I7I'kQ 8J 8r9   r  )r  ri   r  r   r3   r  )r-   r  ri   r  r   s        r7   r  zDaskExprStringNamespace.replace;  sG     ##.. //?? / 

 
	
r9   )r  c               n    | j                   j                  d d|||| j                   j                        S )Nc                B    | j                   j                  ||d|       S )N)r   r  r  )rj   r  ri   r  s       r7   rx   z5DaskExprStringNamespace.replace_all.<locals>.<lambda>W  s$    FJJ4F4F"K 5G 5r9   r  )r  ri   r  r3   r  )r-   r  ri   r  s       r7   replace_allz#DaskExprStringNamespace.replace_allO  sD     ##.. //?? / 	
 		
r9   Nc                j    | j                   j                  d d|| j                   j                        S )Nc                8    | j                   j                  |      S r#   )r  strip)rj   
characterss     r7   rx   z5DaskExprStringNamespace.strip_chars.<locals>.<lambda>c  s    vzz'7'7
'Cr9   r  )r  r3   r  )r-   r  s     r7   strip_charsz#DaskExprStringNamespace.strip_charsa  s8    ##..C!//??	 / 
 	
r9   c                j    | j                   j                  d d|| j                   j                        S )Nc                8    | j                   j                  |      S r#   )r  
startswith)rj   prefixs     r7   rx   z5DaskExprStringNamespace.starts_with.<locals>.<lambda>k  s    6::#8#8#@r9   starts_with)r  r3   r  )r-   r  s     r7   r  z#DaskExprStringNamespace.starts_withi  s8    ##..@//??	 / 
 	
r9   c                j    | j                   j                  d d|| j                   j                        S )Nc                8    | j                   j                  |      S r#   )r  endswith)rj   r  s     r7   rx   z3DaskExprStringNamespace.ends_with.<locals>.<lambda>s  s    6::#6#6v#>r9   	ends_with)r  r3   r  )r-   r  s     r7   r  z!DaskExprStringNamespace.ends_withq  s8    ##..>//??	 / 
 	
r9   c               l    | j                   j                  d d||| j                   j                        S )Nc                >    | j                   j                  ||       S )N)patr  )r  contains)rj   r  r  s      r7   rx   z2DaskExprStringNamespace.contains.<locals>.<lambda>{  s     VZZ-@-@w; .A .r9   r  )r  r  r3   r  )r-   r  r  s      r7   r  z DaskExprStringNamespace.containsy  s?    ##.. //?? / 
 	
r9   c                l    | j                   j                  d d||| j                   j                        S )Nc                T    | j                   j                  ||r
||z         S d       S )N)startstop)r  slice)rj   r  lengths      r7   rx   z/DaskExprStringNamespace.slice.<locals>.<lambda>  s0    6::+;+;f6F? ,< ,BF ,< ,r9   r  )r  r  r3   r  )r-   r  r  s      r7   r  zDaskExprStringNamespace.slice  s?    ##.. //?? / 
 	
r9   c                |    dd l m | j                  j                  fdd|| j                  j                        S )Nr   c                *    j                  | |      S )N)format)to_datetime)rj   r  dds     r7   rx   z5DaskExprStringNamespace.to_datetime.<locals>.<lambda>  s    2>>&>#Hr9   r  r  r3   )dask.dataframe	dataframer  ro   r)   )r-   r  r  s     @r7   r  z#DaskExprStringNamespace.to_datetime  s<    ###..H//??	 / 
 	
r9   c                h    | j                   j                  d d| j                   j                        S )Nc                6    | j                   j                         S r#   )r  rD  r   s    r7   rx   z6DaskExprStringNamespace.to_uppercase.<locals>.<lambda>      6::++-r9   to_uppercaser   r  r?   s    r7   r  z$DaskExprStringNamespace.to_uppercase  5    ##..-//?? / 
 	
r9   c                h    | j                   j                  d d| j                   j                        S )Nc                6    | j                   j                         S r#   )r  rC  r   s    r7   rx   z6DaskExprStringNamespace.to_lowercase.<locals>.<lambda>  r  r9   to_lowercaser   r  r?   s    r7   r   z$DaskExprStringNamespace.to_lowercase  r  r9   r  r    rT   r  rT   r    )
r  r  ri   r  r  r  r   r   rT   r    )r  r  ri   r  r  r  rT   r    r#   )r  r>  rT   r    )r  r  rT   r    )r  r  rT   r    )r  r  r  r  rT   r    )r  r   r  r?  rT   r    )r-   r   r  r>  rT   r    )r  r  r  r8   r  r  r  r  r  r  r  r  r  r  r   r>   r9   r7   r  r  0  s    $
 

 

 
 
 

2 

 

 
 

$


 9> 	
	



r9   r  c                      e Zd ZddZddZddZddZddZddZddZ	ddZ
dd	Zdd
ZddZddZddZddZddZddZdddZddZddZddZddZddZy)r  c                    || _         y r#   r  r  s     r7   r8   z"DaskExprDateTimeNamespace.__init__  r  r9   c                h    | j                   j                  d d| j                   j                        S )Nc                .    | j                   j                  S r#   )r  dater   s    r7   rx   z0DaskExprDateTimeNamespace.date.<locals>.<lambda>      699>>r9   r  r   r  r?   s    r7   r  zDaskExprDateTimeNamespace.date  5    ##..)//?? / 
 	
r9   c                h    | j                   j                  d d| j                   j                        S )Nc                .    | j                   j                  S r#   )r  yearr   s    r7   rx   z0DaskExprDateTimeNamespace.year.<locals>.<lambda>  r  r9   r  r   r  r?   s    r7   r  zDaskExprDateTimeNamespace.year  r	  r9   c                h    | j                   j                  d d| j                   j                        S )Nc                .    | j                   j                  S r#   )r  monthr   s    r7   rx   z1DaskExprDateTimeNamespace.month.<locals>.<lambda>  s    699??r9   r  r   r  r?   s    r7   r  zDaskExprDateTimeNamespace.month  s5    ##..*//?? / 
 	
r9   c                h    | j                   j                  d d| j                   j                        S )Nc                .    | j                   j                  S r#   )r  dayr   s    r7   rx   z/DaskExprDateTimeNamespace.day.<locals>.<lambda>  s    699==r9   r  r   r  r?   s    r7   r  zDaskExprDateTimeNamespace.day  s5    ##..(//?? / 
 	
r9   c                h    | j                   j                  d d| j                   j                        S )Nc                .    | j                   j                  S r#   )r  hourr   s    r7   rx   z0DaskExprDateTimeNamespace.hour.<locals>.<lambda>  r  r9   r  r   r  r?   s    r7   r  zDaskExprDateTimeNamespace.hour  r	  r9   c                h    | j                   j                  d d| j                   j                        S )Nc                .    | j                   j                  S r#   )r  minuter   s    r7   rx   z2DaskExprDateTimeNamespace.minute.<locals>.<lambda>      699++r9   r  r   r  r?   s    r7   r  z DaskExprDateTimeNamespace.minute  5    ##..+//?? / 
 	
r9   c                h    | j                   j                  d d| j                   j                        S )Nc                .    | j                   j                  S r#   )r  secondr   s    r7   rx   z2DaskExprDateTimeNamespace.second.<locals>.<lambda>  r  r9   r  r   r  r?   s    r7   r  z DaskExprDateTimeNamespace.second  r  r9   c                h    | j                   j                  d d| j                   j                        S )Nc                4    | j                   j                  dz  S N  r  microsecondr   s    r7   rx   z7DaskExprDateTimeNamespace.millisecond.<locals>.<lambda>  s    69900D8r9   millisecondr   r  r?   s    r7   r$  z%DaskExprDateTimeNamespace.millisecond  s5    ##..8//?? / 
 	
r9   c                h    | j                   j                  d d| j                   j                        S )Nc                .    | j                   j                  S r#   r"  r   s    r7   rx   z7DaskExprDateTimeNamespace.microsecond.<locals>.<lambda>  s    69900r9   r#  r   r  r?   s    r7   r#  z%DaskExprDateTimeNamespace.microsecond  s5    ##..0//?? / 
 	
r9   c                h    | j                   j                  d d| j                   j                        S )Nc                b    | j                   j                  dz  | j                   j                  z   S r   )r  r#  
nanosecondr   s    r7   rx   z6DaskExprDateTimeNamespace.nanosecond.<locals>.<lambda>  s"    6990047&)):N:NNr9   r)  r   r  r?   s    r7   r)  z$DaskExprDateTimeNamespace.nanosecond  s5    ##..N//?? / 
 	
r9   c                h    | j                   j                  d d| j                   j                        S )Nc                .    | j                   j                  S r#   )r  	dayofyearr   s    r7   rx   z7DaskExprDateTimeNamespace.ordinal_day.<locals>.<lambda>  s    699..r9   ordinal_dayr   r  r?   s    r7   r-  z%DaskExprDateTimeNamespace.ordinal_day  s5    ##...//?? / 
 	
r9   c                h    | j                   j                  d d| j                   j                        S )Nc                4    | j                   j                  dz   S Nrl   )r  weekdayr   s    r7   rx   z3DaskExprDateTimeNamespace.weekday.<locals>.<lambda>  s    699,,q0r9   r1  r   r  r?   s    r7   r1  z!DaskExprDateTimeNamespace.weekday  s5    ##..0//?? / 
 	
r9   c                j    | j                   j                  d d|| j                   j                        S )Nc                X    | j                   j                  |j                  dd            S )Nz%.fz.%f)r  strftimer  )rj   r  s     r7   rx   z5DaskExprDateTimeNamespace.to_string.<locals>.<lambda>  s    699#5#5fnnUE6R#Sr9   r4  r  r  )r-   r  s     r7   	to_stringz#DaskExprDateTimeNamespace.to_string   s8    ##..S//??	 / 
 	
r9   c                j    | j                   j                  d d|| j                   j                        S )Nc                    |4| j                   j                  d       j                   j                  |      S | j                   j                  d       S r#   )r  tz_localize)rj   	time_zones     r7   rx   z=DaskExprDateTimeNamespace.replace_time_zone.<locals>.<lambda>
  sP     $ '-ii&;&;D&A&D&D&P&P' '- &&t,	'-r9   r8  r9  r3   r  )r-   r9  s     r7   replace_time_zonez+DaskExprDateTimeNamespace.replace_time_zone  s<    ##..-
 //?? / 	
 		
r9   c                v     d fd} j                   j                  |d| j                   j                        S )Nc                   t        | j                  j                  t        j                        }|j
                  4| j                  j                  d      j                  j                  |      S | j                  j                  |      S )NUTC)	r   r  r+   r   r   r9  r  r8  
tz_convert)r   r9  r   r-   s      r7   rP   z9DaskExprDateTimeNamespace.convert_time_zone.<locals>.func  sk    ,4''00.2E2EE &tt''.11<<YGGtty11r9   r?  r:  )r   r   r9  r  rT   r   r  )r-   r9  rP   s   `  r7   convert_time_zonez+DaskExprDateTimeNamespace.convert_time_zone  s@    	2 ##..//??	 / 
 	
r9   c                     	 d	 	 	 	 	 d fd} j                   j                  |d| j                   j                        S )Nc                   t        | 
j                  j                  t        j                        }dt        |      v }| j                         }t        
j                  j                        }||j                  k(  r| j                  d      }t        ||      }nZ||j                  k(  r>|j                  }|r| j                  d      n| j                  d      }t        |||      }nd}	t        |	      |j                  |       S )NpyarrowzInt32[pyarrow]zInt64[pyarrow]int64z/Input should be either of Date or Datetime type)r   r  r+   r   r   r  r   r   Dater   r   Datetime	time_unitr   	TypeErrorwhere)r   rG  r   is_pyarrow_dtypemask_nadtypess_castrk   original_time_unitr   r-   s             r7   rP   z1DaskExprDateTimeNamespace.timestamp.<locals>.func&  s     -4''00.2E2EE  )CJ6ffhG)$*>*>*G*GHF#"231&)D&//)%*__"2BAHH-.QXHY  6.	 Hn$<<))r9   datetime)rG  r3   us)r   r   rG  Literal['ns', 'us', 'ms']rT   r   r  )r-   rG  rP   s   `  r7   	timestampz#DaskExprDateTimeNamespace.timestamp%  s[    HL	*	*,E	*	*4 ##..//??	 / 
 	
r9   c                h    | j                   j                  d d| j                   j                        S )Nc                <    | j                   j                         dz  S )N<   r  total_secondsr   s    r7   rx   z9DaskExprDateTimeNamespace.total_minutes.<locals>.<lambda>I  s    699224:r9   total_minutesr   r  r?   s    r7   rY  z'DaskExprDateTimeNamespace.total_minutesG  s5    ##..://?? / 
 	
r9   c                h    | j                   j                  d d| j                   j                        S )Nc                <    | j                   j                         dz  S r0  rW  r   s    r7   rx   z9DaskExprDateTimeNamespace.total_seconds.<locals>.<lambda>P  s    6992249r9   rX  r   r  r?   s    r7   rX  z'DaskExprDateTimeNamespace.total_secondsN  s5    ##..9//?? / 
 	
r9   c                h    | j                   j                  d d| j                   j                        S )Nc                B    | j                   j                         dz  dz  S )Nr!  rl   rW  r   s    r7   rx   z>DaskExprDateTimeNamespace.total_milliseconds.<locals>.<lambda>W  s    699224t;q@r9   total_millisecondsr   r  r?   s    r7   r^  z,DaskExprDateTimeNamespace.total_millisecondsU  s5    ##..@ //?? / 
 	
r9   c                h    | j                   j                  d d| j                   j                        S )Nc                B    | j                   j                         dz  dz  S )Ni@B rl   rW  r   s    r7   rx   z>DaskExprDateTimeNamespace.total_microseconds.<locals>.<lambda>^  s    699224y@AEr9   total_microsecondsr   r  r?   s    r7   ra  z,DaskExprDateTimeNamespace.total_microseconds\  s5    ##..E //?? / 
 	
r9   c                h    | j                   j                  d d| j                   j                        S )Nc                B    | j                   j                         dz  dz  S )Ni ʚ;rl   rW  r   s    r7   rx   z=DaskExprDateTimeNamespace.total_nanoseconds.<locals>.<lambda>e  s    699224}DIr9   total_nanosecondsr   r  r?   s    r7   rd  z+DaskExprDateTimeNamespace.total_nanosecondsc  s5    ##..I//?? / 
 	
r9   Nr  r  )r  r  rT   r    )r9  r>  rT   r    )r9  r  rT   r    rP  )rG  rR  rT   r    )r  r  r  r8   r  r  r  r  r  r  r  r$  r#  r)  r-  r1  r5  r;  r@  rS  rY  rX  r^  ra  rd  r>   r9   r7   r  r    sq    $















" 
D




r9   r  c                  D    e Zd Zd	dZd
dZddZddZddZd
dZd
dZ	y)r  c                    || _         y r#   r  r  s     r7   r8   zDaskExprNameNamespace.__init__l  r  r9   c                     j                   j                  d}t        |       j                   j                   fd j                   j                   j                   j
                   j                   j                   j                   j                   j                   j                   j                   j                  	      S )NzAnonymous expressions are not supported in `.name.keep`.
Instead of `nw.all()`, try using a named expression, such as `nw.col('a', 'b')`
c                    t        j                  j                  |             D cg c]  \  }}|j                  |       c}}S c c}}w r#   zipr  r$   rd   )r;   seriesrb   r1   r-   s      r7   rx   z,DaskExprNameNamespace.keep.<locals>.<lambda>{  sH    $'(<(<(B(B2(F
$S$SLFD d#$S    A	rR   )
r  r'   r  rm   r%   r&   r)   r*   r+   r,   )r-   r   r1   s   ` @r7   keepzDaskExprNameNamespace.keepo  s    ))55
' 
 S/!##-- &&--..==!#//?? 00AA((11''// . 
 	
r9   c                     j                   j                  }|d}t        |      |D cg c]  } |t        |             c} j                   j	                   fd j                   j
                   j                   j                  | j                   j                   j                   j                   j                   j                  i  j                   j                  d|i	      S c c}w )NzAnonymous expressions are not supported in `.name.map`.
Instead of `nw.all()`, try using a named expression, such as `nw.col('a', 'b')`
c                    t        j                  j                  |             D cg c]  \  }}|j                  |       c}}S c c}}w r#   ri  r;   rk  rb   r2   r-   s      r7   rx   z+DaskExprNameNamespace.map.<locals>.<lambda>  H    $'(<(<(B(B2(F$U$ULFD d#$U rl  functionrR   r  r'   r  r  rm   r%   r&   r)   r*   r+   r,   )r-   rr  r1   r   rb   r2   s   `    @r7   mapzDaskExprNameNamespace.map  s    ))55
' 
 S/!8BC
T+
C##-- &&--..==!%//?? 00AA((11Id**22IJI . 
 	
 Ds   C-c                     j                   j                  }|d}t        |      |D cg c]  }|t        |      z    c} j                   j	                   fd j                   j
                   j                   j                  | j                   j                   j                   j                   j                   j                  i  j                   j                  d|i	      S c c}w )NzAnonymous expressions are not supported in `.name.prefix`.
Instead of `nw.all()`, try using a named expression, such as `nw.col('a', 'b')`
c                    t        j                  j                  |             D cg c]  \  }}|j                  |       c}}S c c}}w r#   ri  rp  s      r7   rx   z.DaskExprNameNamespace.prefix.<locals>.<lambda>  rq  rl  r  rR   rs  )r-   r  r1   r   rb   r2   s   `    @r7   r  zDaskExprNameNamespace.prefix  s    ))55
' 
 S/!7ABztT*zB##-- &&--..==!%//?? 00AA((11Ed**22EHfE . 
 	
 C   C*c                     j                   j                  }|d}t        |      |D cg c]  }t        |      |z    c} j                   j	                   fd j                   j
                   j                   j                  | j                   j                   j                   j                   j                   j                  i  j                   j                  d|i	      S c c}w )NzAnonymous expressions are not supported in `.name.suffix`.
Instead of `nw.all()`, try using a named expression, such as `nw.col('a', 'b')`
c                    t        j                  j                  |             D cg c]  \  }}|j                  |       c}}S c c}}w r#   ri  rp  s      r7   rx   z.DaskExprNameNamespace.suffix.<locals>.<lambda>  rq  rl  r  rR   rs  )r-   r  r1   r   rb   r2   s   `    @r7   r  zDaskExprNameNamespace.suffix  s    ))55
' 
 S/!7ABztD	F*zB##-- &&--..==!%//?? 00AA((11Ed**22EHfE . 
 	
 Crw  c                     j                   j                  }|d}t        |      |D cg c]  }t        |      j	                          c} j                   j                   fd j                   j                   j                   j                  | j                   j                   j                   j                   j                   j                   j                   j                  	      S c c}w )NzAnonymous expressions are not supported in `.name.to_lowercase`.
Instead of `nw.all()`, try using a named expression, such as `nw.col('a', 'b')`
c                    t        j                  j                  |             D cg c]  \  }}|j                  |       c}}S c c}}w r#   ri  rp  s      r7   rx   z4DaskExprNameNamespace.to_lowercase.<locals>.<lambda>  rq  rl  rR   )r  r'   r  r  rC  rm   r%   r&   r)   r*   r+   r,   r-   r1   r   rb   r2   s   `   @r7   r   z"DaskExprNameNamespace.to_lowercase      ))55
' 
 S/!6@AjdD	)jA##-- &&--..==!%//?? 00AA((11''// . 
 	
 B    C/c                     j                   j                  }|d}t        |      |D cg c]  }t        |      j	                          c} j                   j                   fd j                   j                   j                   j                  | j                   j                   j                   j                   j                   j                   j                   j                  	      S c c}w )NzAnonymous expressions are not supported in `.name.to_uppercase`.
Instead of `nw.all()`, try using a named expression, such as `nw.col('a', 'b')`
c                    t        j                  j                  |             D cg c]  \  }}|j                  |       c}}S c c}}w r#   ri  rp  s      r7   rx   z4DaskExprNameNamespace.to_uppercase.<locals>.<lambda>  rq  rl  rR   )r  r'   r  r  rD  rm   r%   r&   r)   r*   r+   r,   r|  s   `   @r7   r  z"DaskExprNameNamespace.to_uppercase  r}  r~  N)r-   r   r  r    rT   r  )r-   r   rT   r    )r-   r   rr  zCallable[[str], str]rT   r    )r-   r   r  r  rT   r    )r-   r   r  r  rT   r    )
r  r  r  r8   rm  rt  r  r  r   r  r>   r9   r7   r  r  k  s%    $
4
8
4
6
6
r9   r  )+
__future__r   typingr   r   r   r   r   r	   narwhals._dask.utilsr
   r   r   r   narwhals._expression_parsingr   narwhals._pandas_like.utilsr   r   r   r   r   r   narwhals.typingr   narwhals.utilsr   r   r   	dask_exprtyping_extensionsr   narwhals._dask.dataframer   rB   r   narwhals.dtypesr   r   r    r  r  r  r>   r9   r7   <module>r     s    "        . @ / 9 D @ D @ 3 5 ) ) 9 /&66%&J
}/0 J
Zu
 u
p@
 @
Fc
 c
r9   