
    +h+                     $   d 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ej&                  efddfdZdYdZdYdZd Zd Zd Zd Zd Zd Zd Zd Zd  Z d! Z!d" Z"d# Z#d$ Z$i d%efd&efd'efd(efd)efd*efd+efd,efd-efd.efd/efd0efd1efd2eejJ                  fd3eejL                  fd4eejN                  fd5eejP                  fi d6eejR                  fd7eejT                  fd8eejV                  fd9eejX                  fd:eejZ                  fd;eej\                  fd<eej^                  fd=eej`                  fd>eejb                  fd?eejd                  fd@eejf                  fdAeejh                  fdBeejj                  fdCeejl                  fdDeejn                  fdEeejp                  fdFeejr                  fi dGeejt                  fdHeejv                  fdIeejx                  fdJeejz                  fdKe"fdLefdMefdNe fdOe!fdPe!fdQefdRefdSefdTefdUefdVe#fdWe#fdXe$fiZ>y)Zz5Default implementation of SQL comparison operations.
   )	coercions)	operators)roles)type_api)and_)BinaryExpression)
ClauseListcollate)CollectionAggregate)False_)Null)or_)True_)UnaryExpression   )exc)utilNFc                    |t         j                  }t        ||t        t        t
        fz         r|t        j                  t        j                  fv rNt        |t        t        t
        f      r3t        | t        j                  t        j                  |      ||||      S |t        j                  t        j                   fv r3t        | t        j                  t        j                  |      ||||      S |r)t        j                  t        j                  |||       }n|t        j                  t        j"                  fv rNt        | t        j                  t        j                  |      t        j"                  t        j$                  |      S |t        j                  t        j$                  fv rNt        | t        j                  t        j                  |      t        j$                  t        j"                  |      S t'        j(                  d      t        j                  t        j*                  |||       }|rt        || ||||      S t        | |||||      S )N)type_negate	modifiers)elementoperatorexpr)r   r   z~Only '=', '!=', 'is_()', 'is_not()', 'is_distinct_from()', 'is_not_distinct_from()' operators can be used with None/True/False)r   BOOLEANTYPE
isinstancer   r   r   r   eqneboolr   r   expectr   ConstExprRoleis_distinct_fromis_not_distinct_fromis_is_notr   ArgumentErrorBinaryElementRole)	r   opobjr   reverse_python_is_types_any_all_exprresult_typekwargss	            T/var/www/html/venv/lib/python3.12/site-packages/sqlalchemy/sql/default_comparator.py_boolean_comparer1      s    **#'4*??@ ),,	--*$v&3
 $  !4!4c:!   &&**
 
 $  !4!4c:!   ""##S2DC
 illIMM22'$$U%8%8#>MM$++%  	i&6&677'$$U%8%8#>$$$==%  ''A  ##S2D
 rVv
 	
  #rVv
 	
    c                     |5|j                   r|j                   }n|j                  rt        j                  }t	        | ||f||d|S )N)r+   r.   )return_typeis_comparisonr   r   _binary_operate)r   r)   r*   r+   r.   kws         r0   _custom_op_operater8   s   sR    >>..K"..Kb#&KCE r2   c                     t        j                  t        j                  || |      }|r|| }}n| |}}|)|j                  j                  ||j                        \  }}t        |||||      S )Nr   r   )r   r   )r   r!   r   r(   
comparator_adapt_expressionr   )r   r)   r*   r+   r.   r7   leftrights           r0   r6   r6      sv    


4"C 4eCe//;;  
K D%;"MMr2   c                     |t         j                  u rt        | |      S |t         j                  u rt        | |      S t               N)r   r   r   NotImplementedErrorr   r)   otherr7   s       r0   _conjunction_operaterD      s=    	Y^^D%  	y}}	4!##r2   c                      ||       S r@    )r   r)   fnr7   s       r0   _scalarrH      s    d8Or2   c                     t        j                  t        j                  || |      }d|j                  v r|j                  d   \  }}t        | ||fd|i|S )Nr:   in_opsr   )r   r!   r   InElementRole_annotationsr1   )r   r)   seq_or_selectable	negate_opr7   s        r0   _in_implrO      sm    !((.TB $111)66x@Ib#,59; r2   c                 v   t        | j                  t        j                        sRt        | j                  t        j                        rct        | j                  j
                  t        j                        r5t        j                  t        j                  || |      }t        | ||fi |S t        | ||fi | y )Nr:   )r   typer   	INDEXABLETypeDecoratorimplr   r!   r   r(   r6   _unsupported_implrB   s       r0   _getitem_implrV      s    499h001dii!7!78tyy~~x'9'9:  ##U
 tR5"55$E0R0r2   c                 2    t        d|j                  z        )Nz1Operator '%s' is not supported on this expression)rA   __name__)r   r)   argr7   s       r0   rU   rU      s    
>L r2   c                 R    t        | d      r| j                  S | j                         S )z%See :meth:`.ColumnOperators.__inv__`.negation_clause)hasattrr[   _negater   r)   r7   s      r0   	_inv_implr_      s'    
 t&'###||~r2   c                 N    t        | t        j                  | j                        S )z%See :meth:`.ColumnOperators.__neg__`.r   r   )r   r   negrQ   r^   s      r0   	_neg_implrc      s    4)--tyyIIr2   c           
      "   t        | t        j                  t        j                  t
        j                  || t        j                        ft        j                  |t        j                  u rt        j                  nt        j                  d|S )z#See :meth:`.ColumnOperators.match`.r:   )r.   r   )
r1   r   match_opr   r!   r   r(   r   	MATCHTYPEnot_match_oprB   s       r0   _match_implrh      s     ##''		
 &&### %%  r2   c                 N    t        | t        j                  | j                        S )z&See :meth:`.ColumnOperators.distinct`.ra   )r   r   distinct_oprQ   r^   s      r0   _distinct_implrk      s     y,,DII r2   c                    t        | t        t        j                  t        j
                  || t        j                        t        j                  t        j
                  || t        j                        t        j                  dd      ||t        j                  u rt        j                  |      S t        j                  |      S )z%See :meth:`.ColumnOperators.between`.r:   F)r   groupgroup_contentsr   r   )
r   r	   r   r!   r   r(   r   r   
between_opnot_between_op)r   r)   cleftcrightr7   s        r0   _between_implrt      s    ''"	 ''"	 ^^ 	
" 	%%% '' / , !!/ r2   c                     t        | |      S r@   r
   rB   s       r0   _collate_implrv     s    4r2   c           	          t        | t        j                  t        j                  || t
        j                        |t
        j                  d|i      S )Nr:   flagsro   )r   r   r!   r   r(   r   comma_opnot_regexp_match_op)r   r)   patternrx   r7   s        r0   _regexp_match_implr|   
  sN    ##''		
 	,,E" r2   c                 &   t        | t        t        j                  t        j
                  || t        j                        t        j                  t        j
                  || t        j                        t        j                  d      |d|i      S )Nr:   F)r   rm   rx   )r   )r   r	   r   r!   r   r(   r   ry   )r   r)   r{   replacementrx   r7   s         r0   _regexp_replace_implr     s    ''"++	 ''"++	 ''	
  	E"' r2   r   r   invaddmulsubdivmodtruediv	custom_opjson_path_getitem_opjson_getitem_op	concat_opany_opall_opltler   gtger   r#   r$   like_opilike_opnot_like_opnot_ilike_opcontains_opstartswith_opendswith_opdesc_opasc_opnulls_first_opnulls_last_opin_op	not_in_opr%   r&   r   re   rg   rj   rp   rq   rb   getitemlshiftrshiftcontainsregexp_match_oprz   regexp_replace_op)FN)?__doc__ r   r   r   r   elementsr   r   r	   r   r   r   r   r   r   r   r   r   NoneTyper    r1   r8   r6   rD   rH   rO   rV   rU   r_   rc   rh   rk   rt   rv   r|   r   _create_any_create_allr   r   r   r   r   r   r$   r#   r   r   r   r   not_contains_opnot_startswith_opnot_endswith_op_create_desc_create_asc_create_nulls_first_create_nulls_lastr   r   r%   r&   operator_lookuprF   r2   r0   <module>r      s        &    )     %   mmT*R
j	N$$	1J
(: 45
!#5	 "5 
I<5 
O	5
 
O5 
O5 
O5 
O5 !5 $&5 _.5 )5 /#5 w+7785 w+7785  	Y\\
*!5" 	Y\\
*#5$ 	Y\\
*%5& 	Y\\
*'5( 	Y\\
*)5* 	Y\\
*+5, )9+I+IJ-5. -y/I/IJ/50  )"7"78152 !9#9#9:354 $i&7&78556 %y'9'9:758 $i&?&?@95: &	(C(CD;5< $i&?&?@=5> 556?5@ w334A5B w C CDC5D gAABE5F h	++,G5H (IOO,I5J 
imm,K5L !1!12M5N O5P Q5R [NS5T N$U5V ="W5X }&Y5Z 
I<[5\ ]5^  "_5`  "a5b "$c5d *,e5f .0g5h .0i5r2   