o
     ZhCA                     @  sT  U d Z ddlmZ 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 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 dd lm Z  ej!d!ed"Z"ej#rdd#lm$Z$ dd$lm%Z% dd%lm&Z& dd&e'de(fdd'dd9d:Z)	&	ddd>d?Z*d&dd@ddDdEZ+ddGdHZ,ddKdLZ-ddOdPZ.ddQdRZ/ddUdVZ0ddWdXZ1ddYdZZ2dd[d\Z3dd]d^Z4dd_d`Z5ddcddZ6ddhdiZ7ddmdnZ8ddpdqZ9i dre,e j:fdse,e j:fdte1e j:fdue+e j:fdve+e j:fdwe+e j:fdxe+e j:fdye+e j:fdze+e j:fd{e+e j:fd|e+e j:fd}e3e j:fd~e+e j:fde+e j:fde+e j:fde+e j:fde*e j:fi de+e j:fde+e j:fde+e j:fde-e ;dIej<ifde-e ;dIej=ifde)e ;d.ej>ifde)e ;d.ej?ifde)e ;d.ej@ifde)e ;d.ejAifde)e ;d.ejBifde)e ;d.ejCifde)e ;d.ejDifde)e ;d.ejEifde)e ;d.ejFifde)e ;d.ejGifde)e ;d.ejHifde)e ;d.ejIifi de)e ;d.ejJifde)e ;d.ejKifde)e ;d.ejLifde)e ;d.ejMifde)e ;d.ejNifde)e ;d.ejOifde-e ;dIejPifde-e ;dIejQifde-e ;dIejRifde-e ;dIejSifde.e ;d.ejTifde.e ;d.ejUifde)e ;d.ejVifde)e ;d.ejWifde7e j:fde4e j:fde4e j:fe5e j:fe6e j:fe6e j:fe2e j:fe/e j:fe0e j:fe0e j:fe0e j:fe8e j:fe8e j:fe9e j:fdZXdeYd< dS )z5Default implementation of SQL comparison operations.
    )annotationsN)Any)Callable)Dict)NoReturn)Optional)Tuple)Type)Union   )	coercions)	operators)roles)type_api)and_)BinaryExpression)ClauseElement)CollationClause)CollectionAggregate)ExpressionClauseList)False_)Null)OperatorExpression)or_)True_)UnaryExpression)OperatorType   )exc)util_T)bound)ColumnElement)	custom_op)
TypeEngineF)	negate_opreverse_python_is_typesresult_typeexprColumnElement[Any]opr   objr   r%   Optional[OperatorType]r&   boolr'   Tuple[Type[Any], ...]r(   Optional[TypeEngine[bool]]kwargsreturnOperatorExpression[bool]c                K  s`  |d u rt j}t||tttf r|tjtjfv r1t|t	ttfr1t
j| ttj|||||dS |tjtjfv rIt
j| ttj|||||dS | jrWtjtj||| d}nA|tjtjfv rpt
j| ttj|tjtj|dS |tjtjfv rt
j| ttj|tjtj|dS tdtjtj||| d}|rt
j|| ||||dS t
j| |||||dS )N)type_negate	modifiers)elementoperatorr)   )r5   r4   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ner.   r   _construct_for_opr   expectr   ZConstExprRoleis_distinct_fromis_not_distinct_fromZ_is_collection_aggregateis_is_notr   ArgumentErrorBinaryElementRole)r)   r+   r,   r%   r&   r'   r(   r1    rE   X/var/www/html/lang_env/lib/python3.10/site-packages/sqlalchemy/sql/default_comparator.py_boolean_compare3   s   


	rG   custom_op[Any]Optional[TypeEngine[Any]]kwc                 K  s<   |d u r|j r|j }n|jrtj}t| ||f||d|S )Nr&   r(   )return_typeZis_comparisonr   r9   _binary_operate)r)   r+   r,   r&   r(   rJ   rE   rE   rF   _custom_op_operate   s   rN   rK   roles.BinaryElementRole[Any]Optional[TypeEngine[_T]]OperatorExpression[_T]c          	      K  s^   t jtj|| |d}|r|| }}n| |}}|d u r%|j||j\}}tj|||||dS )Nr)   r8   )r4   r6   )r   r>   r   rD   Z
comparatorZ_adapt_expressionr   r=   )	r)   r+   r,   r&   r(   rJ   Zcoerced_objleftrightrE   rE   rF   rM      s   	


rM   otherc                 K  s.   |t ju r
t| |S |t ju rt| |S t N)r   r   r   NotImplementedErrorr)   r+   rU   rJ   rE   rE   rF   _conjunction_operate   s
   



rY   fn2Callable[[ColumnElement[Any]], ColumnElement[Any]]c                 K  s   || S rV   rE   )r)   r+   rZ   rJ   rE   rE   rF   _scalar   s   r\   seq_or_selectabler   c                 K  sD   t jtj|| |d}d|jv r|jd \}}t| ||fd|i|S )NrR   Zin_opsr%   )r   r>   r   ZInElementRoleZ_annotationsrG   )r)   r+   r]   r%   rJ   rE   rE   rF   _in_impl   s   

r^   c                 K  sl   t | jtjst | jtjr*t | jjtjr*tjtj	|| |d}t
| ||fi |S t| ||fi | d S )NrR   )r:   typer   Z	INDEXABLEZTypeDecoratorZimpl_instancer   r>   r   rD   rM   _unsupported_implrX   rE   rE   rF   _getitem_impl   s   
ra   argr   c                 O  s   t d|j )Nz1Operator '%s' is not supported on this expression)rW   __name__)r)   r+   rb   rJ   rE   rE   rF   r`      s   r`   c                 K  s   t | dr| jS |  S )z%See :meth:`.ColumnOperators.__inv__`.negation_clause)hasattrrd   Z_negater)   r+   rJ   rE   rE   rF   	_inv_impl   s   
rg   c                 K     t | tj| jdS )z%See :meth:`.ColumnOperators.__neg__`.r8   r4   )r   r   negr_   rf   rE   rE   rF   	_neg_impl  s   rk   c                 K  rh   )z)See :meth:`.ColumnOperators.bitwise_not`.ri   )r   r   bitwise_not_opr_   rf   rE   rE   rF   _bitwise_not_impl  s   
rm   c              	   K  sB   t | tjtjtj|| tjdftj|tju rtj	ntjd|S )z#See :meth:`.ColumnOperators.match`.rR   )r(   r%   )
rG   r   match_opr   r>   r   rD   r   Z	MATCHTYPEnot_match_oprX   rE   rE   rF   _match_impl  s"   	
rp   c                 K  rh   )z&See :meth:`.ColumnOperators.distinct`.ri   )r   r   distinct_opr_   rf   rE   rE   rF   _distinct_impl4  s   
rr   cleftcrightc                 K  sb   t | tjtjtjtjt	j
|| tjdtjt	j
|| tjddd||tju r+tj|dS tj|dS )z%See :meth:`.ColumnOperators.between`.rR   Fgroupr5   r6   )r   r   _construct_for_listr   r   r   NULLTYPEr   r>   r   rD   
between_opnot_between_op)r)   r+   rs   rt   rJ   rE   rE   rF   _between_impl=  s6   
r|   ColumnElement[str]	collationstrc                 K  s   t | |S rV   )r   Z_create_collation_expression)r)   r+   r~   rJ   rE   rE   rF   _collate_implb  s   r   patternflagsOptional[str]c                 K  s*   t | tjtj|| tjd|tjd|idS )NrR   r   rw   )r   r   r>   r   rD   r   comma_opnot_regexp_match_op)r)   r+   r   r   rJ   rE   rE   rF   _regexp_match_implh  s   r   replacementc                 K  sL   t | tjtjtjtjt	j
|| tjdtjt	j
|| tjddd|d|idS )NrR   Fru   r   )r6   )r   r   rx   r   r   r   ry   r   r>   r   rD   )r)   r+   r   r   r   rJ   rE   rE   rF   _regexp_replace_impl}  s,   r   r   r   invaddmulsubdivmodZbitwise_xor_opZbitwise_or_opZbitwise_and_oprl   Zbitwise_lshift_opZbitwise_rshift_optruedivfloordivr#   Zjson_path_getitem_opZjson_getitem_opZ	concat_opZany_opZall_opltler<   gtger;   r?   r@   like_opilike_opnot_like_opnot_ilike_opZcontains_opZicontains_opZstartswith_opZistartswith_opZendswith_opZiendswith_opZdesc_opZasc_opZnulls_first_opZnulls_last_opin_op	not_in_oprA   rB   Zcollatern   ro   )rq   rz   r{   rj   getitemlshiftrshiftcontainsZregexp_match_opr   Zregexp_replace_opzDict[str, Tuple[Callable[..., ColumnElement[Any]], util.immutabledict[str, Union[OperatorType, Callable[..., ColumnElement[Any]]]]]]operator_lookup)r)   r*   r+   r   r,   r   r%   r-   r&   r.   r'   r/   r(   r0   r1   r   r2   r3   )FN)r)   r*   r+   rH   r,   r   r&   r.   r(   rI   rJ   r   r2   r*   )r)   r*   r+   r   r,   rO   r&   r.   r(   rP   rJ   r   r2   rQ   )
r)   r*   r+   r   rU   r   rJ   r   r2   r*   )
r)   r*   r+   r   rZ   r[   rJ   r   r2   r*   )r)   r*   r+   r   r]   r   r%   r   rJ   r   r2   r*   )
r)   r*   r+   r   rb   r   rJ   r   r2   r   )r)   r*   r+   r   rJ   r   r2   r*   )r)   r*   r+   r   rs   r   rt   r   rJ   r   r2   r*   )
r)   r}   r+   r   r~   r   rJ   r   r2   r}   )r)   r}   r+   r   r   r   r   r   rJ   r   r2   r*   )r)   r*   r+   r   r   r   r   r   r   r   rJ   r   r2   r*   )Z__doc__
__future__r   typingr   r   r   r   r   r   r	   r
    r   r   r   r   elementsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   TypeVarr    TYPE_CHECKINGr"   r#   r$   r_   r.   rG   rN   rM   rY   r\   r^   ra   r`   rg   rk   rm   rp   rr   r|   r   r   r   
EMPTY_DICTZimmutabledictZ_create_anyZ_create_allr   r   r;   r   r   r<   r@   r?   r   r   r   r   Znot_contains_opZnot_icontains_opZnot_startswith_opZnot_istartswith_opZnot_endswith_opZnot_iendswith_opZ_create_descZ_create_ascZ_create_nulls_firstZ_create_nulls_lastr   r   rA   rB   r   __annotations__rE   rE   rE   rF   <module>   s  
b


	








	
%

*








	











 !"#'+/37;?CGKOSW[_cgko
s
t
uv 