
    O3jW              
          d dl mZ d dlZd dlmZ d dlmZmZmZ d dl	m
Z
 d dlmZmZ d dlmZmZ erd dlmZmZ d d	lmZ  G d
 de
eeef   eeeeef         Zy)    )annotationsNreduce)TYPE_CHECKINGAnyProtocol)LazyNamespace)NativeExprTNativeFrameT)SQLExprTSQLLazyFrameT)IterableSequence)PythonLiteralc                      e Z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
dd
ZddZ	 d	 	 	 	 	 	 	 ddZy)SQLNamespacec                     y N )selfnameargss      D/DATA/.local/lib/python3.12/site-packages/narwhals/_sql/namespace.py	_functionzSQLNamespace._function   s    WZ    c                     y r   r   )r   values     r   _litzSQLNamespace._lit   s    sr   Nc                     y r   r   )r   	conditionr   	otherwises       r   _whenzSQLNamespace._when   s    
 r   c                     y r   r   )r   exprss     r   	_coalescezSQLNamespace._coalesce   s    Sr   c               N     d fd}  j                   j                  |g| S )Nc                R    rfd| D        } t        t        j                  |       S )Nc              3  `   K   | ]%  }j                  |j                  d              ' yw)FNr%   r   .0colr   s     r   	<genexpr>z<SQLNamespace.any_horizontal.<locals>.func.<locals>.<genexpr>#   s&     N#sDIIe,<=   +.)r   operatoror_colsignore_nullsr   s    r   funcz)SQLNamespace.any_horizontal.<locals>.func!   s!    NN(,,--r   r2   zIterable[NativeExprT]returnr
   _expr_from_elementwise_horizontal_opr   r3   r$   r4   s   ``  r   any_horizontalzSQLNamespace.any_horizontal    s&    	.
 :tzz99$GGGr   c               N     d fd}  j                   j                  |g| S )Nc                R    rfd| D        } t        t        j                  |       S )Nc              3  `   K   | ]%  }j                  |j                  d              ' yw)TNr)   r*   s     r   r-   z<SQLNamespace.all_horizontal.<locals>.func.<locals>.<genexpr>+   s%     MsDIIdO<r.   )r   r/   and_r1   s    r   r4   z)SQLNamespace.all_horizontal.<locals>.func)   s!    MM(--..r   r5   r7   r:   s   ``  r   all_horizontalzSQLNamespace.all_horizontal(   s&    	/
 :tzz99$GGGr   c                J     d fd}  j                   j                  |g| S )Nc                *     j                   dg|  S )Ngreatestr   r2   r   s    r   r4   z)SQLNamespace.max_horizontal.<locals>.func1   s    !4>>*4t44r   r5   r7   r   r$   r4   s   `  r   max_horizontalzSQLNamespace.max_horizontal0   s&    	5 :tzz99$GGGr   c                J     d fd}  j                   j                  |g| S )Nc                *     j                   dg|  S )NleastrD   rE   s    r   r4   z)SQLNamespace.min_horizontal.<locals>.func7   s    !4>>'1D11r   r5   r7   rF   s   `  r   min_horizontalzSQLNamespace.min_horizontal6   s&    	2 :tzz99$GGGr   c                J     d fd}  j                   j                  |g| S )Nc                4    t        fdfd| D              S )Nc                *    j                  d| |      S )NaddrD   )xyr   s     r   <lambda>z;SQLNamespace.sum_horizontal.<locals>.func.<locals>.<lambda>?   s    T^^E1a8r   c              3  `   K   | ]%  }j                  |j                  d              ' yw)r   Nr)   r*   s     r   r-   z<SQLNamespace.sum_horizontal.<locals>.func.<locals>.<genexpr>@   s%     CdsTYYq\2dr.   r   rE   s    r   r4   z)SQLNamespace.sum_horizontal.<locals>.func=   s    8CdC r   r5   r7   rF   s   `  r   sum_horizontalzSQLNamespace.sum_horizontal<   s&    	 :tzz99$GGGr   c                J     d fd}  j                   j                  |g| S )Nc                "     j                   |  S r   )r%   rE   s    r   r4   z#SQLNamespace.coalesce.<locals>.funcG   s    !4>>4((r   r5   r7   rF   s   `  r   coalescezSQLNamespace.coalesceF   s&    	) :tzz99$GGGr   c                     d fd}d fd}| j                   j                  |||      S  j                   j                  ||||      S )Nc                4    j                  | d   | d         S )N   r   r"   rE   s    r   r4   z$SQLNamespace.when_then.<locals>.funcO   s    ::d1gtAw//r   c                <    j                  | d   | d   | d         S )NrZ   r      r[   rE   s    r   func_with_otherwisez3SQLNamespace.when_then.<locals>.func_with_otherwiseR   s"    ::d1gtAwQ88r   )r2   zSequence[NativeExprT]r6   r
   r7   )r   	predicatethenr!   r4   r^   s   `     r   	when_thenzSQLNamespace.when_thenL   sN    	0	9 ::==dD)TTzz99y)
 	
r   )r   strr   zNativeExprT | PythonLiteralr6   r
   )r   r   r6   r
   r   )r    r
   r   r
   r!   zNativeExprT | Noner6   r
   )r$   r
   r6   r
   )r$   r   r3   boolr6   r   )r$   r   r6   r   )r_   r   r`   r   r!   zSQLExprT | Noner6   r   )__name__
__module____qualname__r   r   r"   r%   r;   r@   rG   rK   rT   rW   ra   r   r   r   r   r      s     [2
 )-	  &	
 
 AHHHHHH QU
!
)1
>M
	
r   r   )
__future__r   r/   	functoolsr   typingr   r   r   narwhals._compliantr	   narwhals._compliant.typingr
   r   narwhals._sql.typingr   r   collections.abcr   r   narwhals.typingr   r   r   r   r   <module>ro      sR    "   / / - @ 82-H
-<78]HlK?@H
r   