https://t.me/RX1948
Server : Apache
System : Linux iad1-shared-b8-43 6.6.49-grsec-jammy+ #10 SMP Thu Sep 12 23:23:08 UTC 2024 x86_64
User : dh_edsupp ( 6597262)
PHP Version : 8.2.26
Disable Function : NONE
Directory :  /lib/python3/dist-packages/django/db/models/sql/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/django/db/models/sql/__pycache__/where.cpython-310.pyc
o

3�a*"�@spdZddlmZddlmZddlmZdZdZGdd�dej	�Z
Gd	d
�d
�ZGdd�d�ZGd
d�d�Z
dS)zG
Code to manage the creation and SQL rendering of 'where' constraints.
���EmptyResultSet)�tree)�cached_property�AND�ORc@s�eZdZdZeZdZdZd'dd�Zdd�Z	d(d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zedd��Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zd%d&�ZdS))�	WhereNodea�
    An SQL WHERE clause.

    The class is tied to the Query class that created it (in order to create
    the correct SQL).

    A child is usually an expression producing boolean values. Most likely the
    expression is a Lookup instance.

    However, a child could also be any class with as_sql() and either
    relabeled_clone() method or relabel_aliases() and clone() methods and
    contains_aggregate attribute.
    FTcCs�|js|dfS||jA}|r|jtkp|o|jtk}|r$|jr$d|fSg}g}|jD]/}t|d�rL|�|�\}}|durB|�|�|durK|�|�q+|jrU|�|�q+|�|�q+|rf|�	||j|j�nd}	|rs|�	||j|j�nd}
|
|	fS)z�
        Return two possibly None nodes: one for those parts of self that
        should be included in the WHERE clause and one for those parts of
        self that must be included in the HAVING clause.
        N�split_having)
�contains_aggregate�negated�	connectorrr�children�hasattrr	�append�	__class__)�selfr�
in_negated�may_need_split�where_parts�having_parts�c�
where_part�having_part�having_node�
where_node�r�</usr/lib/python3/dist-packages/django/db/models/sql/where.pyr	 s0
�




�zWhereNode.split_havingc	Csg}g}|jtkrt|j�d}}ndt|j�}}|jD]H}z	|�|�\}}	Wn
ty5|d8}Ynw|rC|�|�|�|	�n|d8}|dkrV|jrTdgfSt�|dkre|jr_t�dgfSqd|j}
|
�	|�}|r�|jr}d|}||fSt|�dks�|j
r�d|}||fS)a
        Return the SQL version of the where clause and the value to be
        substituted in. Return '', [] if this node matches everything,
        None, [] if this node is empty, and raise EmptyResultSet if this
        node can't match anything.
        �r�z %s zNOT (%s)�(%s))rr�lenr
�compilerr�extendr�join�resolved)r�compiler�
connection�result�
result_params�full_needed�empty_needed�child�sql�params�conn�
sql_stringrrr�as_sqlAsB

�
�

�zWhereNode.as_sqlNcCs"g}|jD]	}|�|���q|S�N)r
r"�get_group_by_cols)r�alias�colsr+rrrr2us
zWhereNode.get_group_by_colscCs|jdd�Sr1)r
�rrrr�get_source_expressions{sz WhereNode.get_source_expressionscCs t|�t|j�ksJ�||_dSr1)r r
)rr
rrr�set_source_expressions~s
z WhereNode.set_source_expressionscCsHt|j�D]\}}t|d�r|�|�qt|d�r!|�|�|j|<qdS)z�
        Relabel the alias values of any children. 'change_map' is a dictionary
        mapping old (current) alias values to the new values.
        �relabel_aliases�relabeled_cloneN)�	enumerater
rr8r9)r�
change_map�posr+rrrr8�s

��zWhereNode.relabel_aliasescCsN|jjg|j|jd�}|jD]}t|d�r|j�|���q|j�|�q|S)z�
        Create a clone of the tree. Must only be called on root nodes (nodes
        with empty subtree_parents). Childs must be either (Constraint, lookup,
        value) tuples, or objects supporting .clone().
        )r
rr�clone)r�
_new_instancerrr
rrr=)rr=r+rrrr=�s
�

zWhereNode.clonecCs|��}|�|�|Sr1)r=r8)rr;r=rrrr9�s
zWhereNode.relabeled_clonecCs|��Sr1)r=r5rrr�copy�szWhereNode.copyc�*t|tj�rt�fdd�|jD��S|jS)Nc3��|]}��|�VqdSr1��_contains_aggregate��.0r��clsrr�	<genexpr>���z0WhereNode._contains_aggregate.<locals>.<genexpr>)�
isinstancer�Node�anyr
r
�rG�objrrFrrC��zWhereNode._contains_aggregatecC�
|�|�Sr1rBr5rrrr
��
zWhereNode.contains_aggregatecr@)Nc3rAr1��_contains_over_clauserDrFrrrH�rIz2WhereNode._contains_over_clause.<locals>.<genexpr>)rJrrKrLr
�contains_over_clauserMrrFrrS�rOzWhereNode._contains_over_clausecCrPr1rRr5rrrrT�rQzWhereNode.contains_over_clausecCstdd�|jD��S)Ncss�|]}|jVqdSr1)�
is_summary)rEr+rrrrH�s�z'WhereNode.is_summary.<locals>.<genexpr>)rLr
r5rrrrU�szWhereNode.is_summarycOs&t|d�r|j|g|�Ri|��}|S)N�resolve_expression)rrV)�expr�query�args�kwargsrrr�
_resolve_leaf�s
zWhereNode._resolve_leafcOs�t|d�r|jD]}|j||g|�Ri|��qt|d�r,|j|j|g|�Ri|��|_t|d�rB|j|j|g|�Ri|��|_dSdS)Nr
�lhs�rhs)rr
�
_resolve_noder[r\r])rG�noderXrYrZr+rrrr^�s



"�zWhereNode._resolve_nodecOs*|��}|j|g|�Ri|��d|_|S)NT)r=r^r$)rrYrZr=rrrrV�szWhereNode.resolve_expression)Fr1)�__name__�
__module__�__qualname__�__doc__r�defaultr$�conditionalr	r0r2r6r7r8r=r9r?�classmethodrCrr
rSrT�propertyrU�staticmethodr[r^rVrrrrrs:

!
4






	rc@seZdZdZdZddd�ZdS)�NothingNodezA node that matches nothing.FNcCst�r1r)rr%r&rrrr0�szNothingNode.as_sql�NN)r`rarbrcr
r0rrrrri�sric@s"eZdZdZdd�Zddd�ZdS)�
ExtraWhereFcCs||_||_dSr1)�sqlsr-)rrlr-rrr�__init__�s
zExtraWhere.__init__NcCs(dd�|jD�}d�|�t|jpd�fS)NcSsg|]}d|�qS)rr)rEr,rrr�
<listcomp>�sz%ExtraWhere.as_sql.<locals>.<listcomp>z AND r)rlr#�listr-)rr%r&rlrrrr0�szExtraWhere.as_sqlrj�r`rarbr
rmr0rrrrrk�srkc@s eZdZdZdd�Zdd�ZdS)�SubqueryConstraintFcCs||_||_||_||_dSr1)r3�columns�targets�query_object)rr3rrrsrtrrrrm�s
zSubqueryConstraint.__init__cCs0|j}|�|j�|j|d�}|�|j|j|�S)N)r&)rt�
set_valuesrs�get_compiler�as_subquery_conditionr3rr)rr%r&rX�query_compilerrrrr0�szSubqueryConstraint.as_sqlNrprrrrrq�srqN)rc�django.core.exceptionsr�django.utilsr�django.utils.functionalrrrrKrrirkrqrrrr�<module>sG

https://t.me/RX1948 - 2025