o
    gCA                     @  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   ConstExprRoleis_distinct_fromis_not_distinct_from_is_collection_aggregateis_is_notr   ArgumentErrorBinaryElementRole)r)   r+   r,   r%   r&   r'   r(   r1    rG   [/var/www/html/api-tag/env/lib/python3.10/site-packages/sqlalchemy/sql/default_comparator.py_boolean_compare3   s   


	rI   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_typeis_comparisonr   r9   _binary_operate)r)   r+   r,   r&   r(   rL   rG   rG   rH   _custom_op_operate   s   rQ   rM   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   rF   
comparator_adapt_expressionr   r=   )	r)   r+   r,   r&   r(   rL   coerced_objleftrightrG   rG   rH   rP      s   	


rP   otherc                 K  s.   |t ju r
t| |S |t ju rt| |S t N)r   r   r   NotImplementedErrorr)   r+   r[   rL   rG   rG   rH   _conjunction_operate   s
   



r_   fn2Callable[[ColumnElement[Any]], ColumnElement[Any]]c                 K  s   || S r\   rG   )r)   r+   r`   rL   rG   rG   rH   _scalar   s   rb   seq_or_selectabler   c                 K  sD   t jtj|| |d}d|jv r|jd \}}t| ||fd|i|S )NrU   in_opsr%   )r   r>   r   InElementRole_annotationsrI   )r)   r+   rc   r%   rL   rG   rG   rH   _in_impl   s   

rg   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 )NrU   )r:   typer   	INDEXABLETypeDecoratorimpl_instancer   r>   r   rF   rP   _unsupported_implr^   rG   rG   rH   _getitem_impl   s   
rm   argr   c                 O  s   t d|j )Nz1Operator '%s' is not supported on this expression)r]   __name__)r)   r+   rn   rL   rG   rG   rH   rl      s   rl   c                 K  s   t | dr| jS |  S )z%See :meth:`.ColumnOperators.__inv__`.negation_clause)hasattrrp   _negater)   r+   rL   rG   rG   rH   	_inv_impl   s   
rt   c                 K     t | tj| jdS )z%See :meth:`.ColumnOperators.__neg__`.r8   r4   )r   r   negrh   rs   rG   rG   rH   	_neg_impl  s   rx   c                 K  ru   )z)See :meth:`.ColumnOperators.bitwise_not`.rv   )r   r   bitwise_not_oprh   rs   rG   rG   rH   _bitwise_not_impl  s   
rz   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`.rU   )r(   r%   )
rI   r   match_opr   r>   r   rF   r   	MATCHTYPEnot_match_opr^   rG   rG   rH   _match_impl  s"   	
r~   c                 K  ru   )z&See :meth:`.ColumnOperators.distinct`.rv   )r   r   distinct_oprh   rs   rG   rG   rH   _distinct_impl4  s   
r   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`.rU   Fgroupr5   r6   )r   r   _construct_for_listr   r   r   NULLTYPEr   r>   r   rF   
between_opnot_between_op)r)   r+   r   r   rL   rG   rG   rH   _between_impl=  s6   
r   ColumnElement[str]	collationstrc                 K  s   t | |S r\   )r   _create_collation_expression)r)   r+   r   rL   rG   rG   rH   _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 )NrU   r   r   )r   r   r>   r   rF   r   comma_opnot_regexp_match_op)r)   r+   r   r   rL   rG   rG   rH   _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 )NrU   Fr   r   )r6   )r   r   r   r   r   r   r   r   r>   r   rF   )r)   r+   r   r   r   rL   rG   rG   rH   _regexp_replace_impl}  s,   r   r   r   invaddmulsubdivmodbitwise_xor_opbitwise_or_opbitwise_and_opry   bitwise_lshift_opbitwise_rshift_optruedivfloordivr#   json_path_getitem_opjson_getitem_op	concat_opany_opall_opltler<   gtger;   r@   rA   like_opilike_opnot_like_opnot_ilike_opcontains_opicontains_opstartswith_opistartswith_opendswith_opiendswith_opdesc_opasc_opnulls_first_opnulls_last_opin_op	not_in_oprC   rD   collater{   r}   )r   r   r   rw   getitemlshiftrshiftcontainsregexp_match_opr   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+   rJ   r,   r   r&   r.   r(   rK   rL   r   r2   r*   )r)   r*   r+   r   r,   rR   r&   r.   r(   rS   rL   r   r2   rT   )
r)   r*   r+   r   r[   r   rL   r   r2   r*   )
r)   r*   r+   r   r`   ra   rL   r   r2   r*   )r)   r*   r+   r   rc   r   r%   r   rL   r   r2   r*   )
r)   r*   r+   r   rn   r   rL   r   r2   r   )r)   r*   r+   r   rL   r   r2   r*   )r)   r*   r+   r   r   r   r   r   rL   r   r2   r*   )
r)   r   r+   r   r   r   rL   r   r2   r   )r)   r   r+   r   r   r   r   r   rL   r   r2   r*   )r)   r*   r+   r   r   r   r   r   r   r   rL   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$   rh   r.   rI   rQ   rP   r_   rb   rg   rm   rl   rt   rx   rz   r~   r   r   r   r   r   
EMPTY_DICTimmutabledict_create_any_create_allr   r   r;   r   r   r<   rA   r@   r   r   r   r   not_contains_opnot_icontains_opnot_startswith_opnot_istartswith_opnot_endswith_opnot_iendswith_op_create_desc_create_asc_create_nulls_first_create_nulls_lastr   r   rC   rD   r   __annotations__rG   rG   rG   rH   <module>   s  
b


	







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

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