
    hh
              
          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 d d	lmZ  G d
 de
eeef         eeeeef                   ZdS )    )annotationsN)reduce)TYPE_CHECKINGAnyProtocol)LazyNamespace)NativeExprTNativeFrameT)SQLExprTSQLLazyFrameT)Iterable)PythonLiteralc                  b    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S )"SQLNamespacenamestrargsNativeExprT | PythonLiteralreturnr	   c                    d S N )selfr   r   s      N/var/www/histauto/venv/lib/python3.11/site-packages/narwhals/_sql/namespace.py	_functionzSQLNamespace._function             valuer   c                    d S r   r   )r   r   s     r   _litzSQLNamespace._lit   r   r   N	condition	otherwiseNativeExprT | Nonec                    d S r   r   )r   r!   r   r"   s       r   _whenzSQLNamespace._when   s	    
 cr   exprsc                    d S r   r   )r   r&   s     r   	_coalescezSQLNamespace._coalesce   r   r   r   ignore_nullsboolc               :     d fd}  j         j        |g|R  S )NcolsIterable[NativeExprT]r   r	   c                X    rfd| D             } t          t          j        |           S )Nc              3  j   K   | ]-}                     |                    d                     V  .dS )FNr(   r    .0colr   s     r   	<genexpr>z<SQLNamespace.any_horizontal.<locals>.func.<locals>.<genexpr>#   s=      NN#sDIIe,<,<==NNNNNNr   )r   operatoror_r,   r)   r   s    r   funcz)SQLNamespace.any_horizontal.<locals>.func!   s7     ONNNNNNN(,---r   r,   r-   r   r	   _expr_from_elementwise_horizontal_opr   r)   r&   r8   s   ``  r   any_horizontalzSQLNamespace.any_horizontal    sF    	. 	. 	. 	. 	. 	. 	.
 :tz9$GGGGGr   c               :     d fd}  j         j        |g|R  S )Nr,   r-   r   r	   c                X    rfd| D             } t          t          j        |           S )Nc              3  j   K   | ]-}                     |                    d                     V  .dS )TNr0   r1   s     r   r4   z<SQLNamespace.all_horizontal.<locals>.func.<locals>.<genexpr>+   s;      MMsDIIdOO<<MMMMMMr   )r   r5   and_r7   s    r   r8   z)SQLNamespace.all_horizontal.<locals>.func)   s7     NMMMMMMM(-...r   r9   r:   r=   s   ``  r   all_horizontalzSQLNamespace.all_horizontal(   sF    	/ 	/ 	/ 	/ 	/ 	/ 	/
 :tz9$GGGGGr   c                6     d fd}  j         j        |g|R  S )Nr,   r-   r   r	   c                      j         dg| R  S )Ngreatestr   r,   r   s    r   r8   z)SQLNamespace.max_horizontal.<locals>.func1   s    !4>*4t4444r   r9   r:   r   r&   r8   s   `  r   max_horizontalzSQLNamespace.max_horizontal0   s@    	5 	5 	5 	5 	5 	5 :tz9$GGGGGr   c                6     d fd}  j         j        |g|R  S )Nr,   r-   r   r	   c                      j         dg| R  S )NleastrG   rH   s    r   r8   z)SQLNamespace.min_horizontal.<locals>.func7   s    !4>'1D1111r   r9   r:   rI   s   `  r   min_horizontalzSQLNamespace.min_horizontal6   s@    	2 	2 	2 	2 	2 	2 :tz9$GGGGGr   c                6     d fd}  j         j        |g|R  S )Nr,   r-   r   r	   c                P    t          t          j        fd| D                       S )Nc              3  j   K   | ]-}                     |                    d                     V  .dS )r   Nr0   r1   s     r   r4   z<SQLNamespace.sum_horizontal.<locals>.func.<locals>.<genexpr>?   s;      QQSt~~c499Q<<@@QQQQQQr   )r   r5   addrH   s    r   r8   z)SQLNamespace.sum_horizontal.<locals>.func=   s1    QQQQDQQQ  r   r9   r:   rI   s   `  r   sum_horizontalzSQLNamespace.sum_horizontal<   s@    	 	 	 	 	 	
 :tz9$GGGGGr   c                6     d fd}  j         j        |g|R  S )Nr,   r-   r   r	   c                     j         |  S r   )r(   rH   s    r   r8   z#SQLNamespace.coalesce.<locals>.funcF   s    !4>4((r   r9   r:   rI   s   `  r   coalescezSQLNamespace.coalesceE   s@    	) 	) 	) 	) 	) 	) :tz9$GGGGGr   )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   )__name__
__module____qualname__r   r    r%   r(   r>   rC   rJ   rN   rS   rV   r   r   r   r   r      s         [ZZZ2222
 )-	     A@@@H H H HH H H HH H H HH H H HH H H HH H H H H Hr   r   )
__future__r   r5   	functoolsr   typingr   r   r   narwhals._compliantr   narwhals._compliant.typingr	   r
   narwhals._sql.typingr   r   collections.abcr   narwhals.typingr   r   r   r   r   <module>rb      s   " " " " " "        / / / / / / / / / / - - - - - - @ @ @ @ @ @ @ @ 8 8 8 8 8 8 8 8 .((((((------8H 8H 8H 8H 8H-<78]HlK?@8H 8H 8H 8H 8Hr   