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 :  /usr/lib64/python2.7/site-packages/django/db/models/sql/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/lib64/python2.7/site-packages/django/db/models/sql/query.pyc
�
r�\c@s�dZddlZddlmZddlmZddlmZddlm	Z	ddl
mZmZddl
mZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZmZmZmZmZm Z ddl!m"Z"m#Z#m$Z$ddl%m&Z&ddl'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.ddl/m0Z0ddgZ1de2fd��YZ3de2fd��YZ4dd�Z5d�Z6d�Z7d�Z8dS(sW
Create SQL statements for QuerySets.

The code in here encapsulates all of the SQL construction so that QuerySets
themselves do not have to (and could be backed by things other than SQL
databases). The abstraction barrier only works one way: this module has to know
all about the internals of models in order to get the information it needs.
i����N(t
SortedDict(t
force_text(tNode(tsix(tconnectionstDEFAULT_DB_ALIAS(t
LOOKUP_SEP(trefs_aggregate(tExpressionNode(tFieldDoesNotExist(tPathInfo(t
aggregates(tQUERY_TERMSt	ORDER_DIRtSINGLEt
ORDER_PATTERNtJoinInfot
SelectInfo(tEmptyResultSettEmptyt	MultiJoin(tSQLEvaluator(t	WhereNodet
ConstrainttEverythingNodet
ExtraWheretANDtORt
EmptyWhere(t
FieldErrortQuerytRawQuerycBsPeZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	s 
    A single raw SQL query
    cCsR|p	d|_||_||_d|_d\|_|_i|_i|_dS(Ni((iN(	tparamstsqltusingtNonetcursortlow_markt	high_marktextra_selecttaggregate_select(tselfR!R"R ((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt__init__'s				cCst|j|d|j�S(NR (RR!R (R)R"((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytclone3scCs|jj||�S(s�Convert the database-returned value into a type that is consistent
        across database backends.

        By default, this defers to the underlying backend operations, but
        it can be overridden by Query classes for specific backends.
        (topstconvert_values(R)tvaluetfieldt
connection((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR-6scCsV|jdkr|j�nt|jjj}g|jjD]}||d�^q<S(Ni(R$R#t_execute_queryRR"t
introspectionttable_name_convertertdescription(R)t	convertertcolumn_meta((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytget_columns?s

cCsB|j�t|jjjs/t|j�}n	|j}t|�S(N(R1RR"tfeaturestcan_use_chunked_readstlistR$titer(R)tresult((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt__iter__Fs

	cCsd|jt|j�S(Ns<RawQuery: %r>(R!ttupleR (R)((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt__repr__RscCs3t|jj�|_|jj|j|j�dS(N(RR"R$texecuteR!R (R)((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR1UsN(t__name__t
__module__t__doc__R#R*R+R-R7R=R?R1(((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR"s						cBs�eZdZdZdZdZeZeZ	dZ
ed�Zd�Z
d�Zd�Zd	�ZdIdId
�Zd�ZdIdId�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zed�Zd�Zdd�Z ed�Z!d�Z"d�Z#d�Z$dJd�Z%d�Z&d�Z'dIeedId �Z(d!�Z)d"�Z*d#�Z+d$�Z,eedId%�Z-d&�Z.d'�Z/ed(�Z0d)�Z1eed*�Z2d+�Z3dIe4eed,�Z5d-�Z6d.�Z7d/�Z8d0�Z9dIdId1�Z:d2�Z;d3�Z<d4�Z=d5�Z>d6�Z?e4d7�Z@d8�ZAd9�ZBd:�ZCd;�ZDd<�ZEd=�ZFd>�ZGd?�ZHd@�ZIdA�ZJdB�ZKdC�ZLdD�ZMdE�ZNeOeN�ZPdF�ZQeOeQ�ZRdG�ZSdH�ZTRS(Ks
    A single SQL query.
    s
INNER JOINsLEFT OUTER JOINtTtSQLCompilercCs`||_i|_i|_i|_i|_t|_t|_t|_t	�|_
t|_i|_
g|_g|_g|_|�|_||_d|_|�|_g|_d\|_|_t|_g|_t|_t|_t|_t�|_d|_ d|_!d|_"t�|_#d|_$d|_%d|_&d|_'t	�tf|_(dS(Nii(iN((()tmodeltalias_refcountt	alias_mapt	table_maptjoin_maptTruetdefault_colstdefault_orderingtstandard_orderingtsettused_aliasestFalsetfilter_is_stickytincluded_inherited_modelstselecttrelated_select_colsttablestwheretwhere_classR#tgroup_bythavingtorder_byR%R&tdistincttdistinct_fieldstselect_for_updatetselect_for_update_nowaittselect_relatedRRtaggregate_select_maskt_aggregate_select_cachet	max_depthtextratextra_select_maskt_extra_select_cachetextra_tablestextra_order_bytdeferred_loading(R)RFRW((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR*isF																												cCs|j�\}}||S(s)
        Returns the query as a string of SQL with the parameter values
        substituted in (use sql_with_params() to see the unsubstituted string).

        Parameter values won't necessarily be quoted correctly, since that is
        done by the database interface at execution time.
        (tsql_with_params(R)R!R ((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt__str__�scCs|jt�j�S(sw
        Returns the query as an SQL string and the parameters that will be
        subsituted into the query.
        (tget_compilerRtas_sql(R)((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyRj�scCs&|jd|�}||t|�<|S(Ntmemo(R+tid(R)RnR<((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt__deepcopy__�scCs|S(N((R)((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytprepare�scCs�|dkr'|dkr'td��n|r:t|}nx-|jj�D]\}}|jj|�qJW|jj|j�|||�S(NsNeed either using or connection(R#t
ValueErrorRR(titemsR,tcheck_aggregate_supporttcompiler(R)R"R0taliast	aggregate((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyRl�s
cCs
|jjS(s�
        Returns the Options instance (the model._meta) from which to start
        processing. Normally, this is self.model._meta, but it can be changed
        by subclasses.
        (RFt_meta(R)((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytget_meta�scKs�t�}|p|j|_|j|_|jj�|_|jj�|_|jj�|_|jj�|_|j|_|j	|_	|j
|_
|jj�|_|j|_g|_
|j|_|jj�|_|j|_|jdkrd|_n
|j|_|jj�|_|j|_|j|j|_|_|j|_|j|_|j|_|j|_|j|_g|_
|jj�|_|jdkr�d|_n|jj�|_d|_|j |_ |j!j�|_!|j"dkr
d|_"n|j"j�|_"|j#dkr:d|_#n|j#j�|_#|j$|_$|j%|_%tj|j&d�|j&df|_&|j'r�|j(r�|j(j�|_(nt)�|_(t*|_'|j+j,|�t-|d�r�|j.�n|S(s�
        Creates a copy of the current instance. The 'kwargs' parameter can be
        used by clients to update attributes after copying has taken place.
        iit_setup_queryN(/Rt	__class__RFRGtcopyRHRIRJRLRMRNRSRTRURVRWR+RXRYR#RZR[R%R&R\R]R^R_R`RRaRbRcRdReRfRgRhRiRRRPRORQt__dict__tupdatethasattrRz(R)tklassRntkwargstobj((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR+�sh	
	



		&	
cCs|jj||�S(s�Convert the database-returned value into a type that is consistent
        across database backends.

        By default, this defers to the underlying backend operations, but
        it can be overridden by Query classes for specific backends.
        (R,R-(R)R.R/R0((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR-scCs]|dkr|jrdS|S|jr0t|�S|jrCt|�S|j||j|�SdS(s�Resolve the value of aggregates returned by the database to
        consistent (and reasonable) types.

        This is required because of the predisposition of certain backends
        to return Decimal and long types when they are not needed.
        iN(R#t
is_ordinaltinttis_computedtfloatR-R/(R)R.RwR0((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytresolve_aggregate#s		
	
c

Cs�|js
iS|jdk	r�ddlm}||j�}|j�}x@|jj�D]/\}}|jrW||j|<|j|=qWqWWy|j	||�Wq�t
k
r�td�|jD��SXn+|}g|_t
|_i|_|j�|jt�|j�t
|_t
|_g|_|j|�jt�}|dkrog|jj�D]}d^qZ}ntgt|jj�|�D]4\\}}}	||j|	|dt|�f^q��S(sV
        Returns the dictionary with the values of the existing aggregations.
        i����(tAggregateQuerycss|]}|dfVqdS(N(R#(t.0Rv((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pys	<genexpr>TsR0N(R(RYR#tdjango.db.models.sql.subqueriesR�RFR+Rst
is_summarytadd_subqueryRtdictRTRQRLRdtremove_inherited_modelstclear_orderingRKtclear_limitsR^R`RURltexecute_sqlRtzipR�R(
R)R"R�tqueryR�RvRwR<tqtval((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytget_aggregation9s@		

			


			%cCs|j�}t|j�dks<|js<|jr�|jr�ddlm}|}|jt	�|j
�||j�}y|j|d|�Wq�t
k
r�dSXn|j�|jd|�d}td||j�}|jdk	rt||j|j�}n|S(sP
        Performs a COUNT() query using the current filter constraints.
        ii����(R�R"iN(R+tlenRTR(R\R]R�R�R�RKR�RFR�Rtadd_count_columnR�R#tmaxR%R&tmin(R)R"R�R�tsubquerytnumber((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt	get_countns"0



cCs�|j�}|j�|jidd6ddddd�|jdg�|jt�|jdd�|jd|�}t	|j
t��S(NitathighR"(R+tclear_select_clauset	add_extraR#tset_extra_maskR�RKt
set_limitsRltboolR�R(R)R"R�Ru((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pythas_results�s
#
cCs|j|jkstd��|j�s6td��|j|jksTtd��|j|jksrtd��|j�i}|tk}|r�t�nt|j�}|j	�x�|jdD]�}|j
|\}}}	}
}}}
|	|jk}|j|
|
�}
|j
|
||fd|d|d|d	|
�}|rW|j|g�n|j|�|||<|j|s�|j|�q�q�W|s�t|j��}g|jD]}||kr�|^q�}|j|t�n|jr,|jj�}|j|�|jsc|jjt�t�qcn7|jrW|j�}|jt�t�n|j�}|jj||�g|_x�|jD]�\}}t|ttf�r�|j|d
|d
�|df}|jjt||��q�|j |�}|jjt||��q�W|t!krF|j"rF|j"rFt#d��qFn|j"j$|j"�t�}|j%dk	r�|j$|j%�n|j%dk	r�|j$|j%�n|r�|j'|�n|j(|j(7_(|j)r�|j)n|j)|_)|j*p�|j*|_*dS(
sN
        Merge the 'rhs' query into the current one (with any 'rhs' effects
        being applied *after* (that is, "to the right of") anything in the
        current query. 'rhs' is not modified during a call to this function.

        The 'connector' parameter describes how to connect filters from the
        'rhs' query.
        s4Cannot combine queries on two different base models.s3Cannot combine queries once a slice has been taken.s6Cannot combine a unique query with a non-unique query.s6Cannot combine queries with different distinct fields.itreusetouter_if_firsttnullablet
join_fieldisSWhen merging querysets using 'or', you cannot have extra(select=...) on both sides.N(+RFtAssertionErrort
can_filterR\R]R�RRORVtget_initial_aliasRHtLOUTERtgettjoint
promote_joinstdiscardRGtunref_aliastvaluesRKRWR+trelabel_aliasestaddRRXRTt
isinstanceR:R>tappendRtrelabeled_cloneRRdRrR~ReR#R�RgR[Rh(R)trhst	connectort
change_maptconjunctionR�Rvttablet_t	join_typetlhst	join_colsR�R�tpromotet	new_aliastrhs_used_joinst
to_promotetwtcolR/tnew_colRe((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytcombine�s~					

"
	


	
			$	cCs�|j\}}|sdS|j�}i}it|jg�|j6}x
|D]}|jt�}	|j}
|}x�|	d D]}|
}
|j|�d}t	|�r�|j}
n|j
j}
|
j}t	|�s�||
j
|�nt||
|j�q}W|j|	d�\}}}}|dkr4|
}nt	|�sNt|||�qNqNW|r>i}xetj|�D]T\}}xE|jj�D]4\}}||kr�q�nt||p�||�q�WqsWx=tj|�D],\}}||kr�||j|�q�q�Wx�tj|�D]\}}||||�qWn�xGtj|�D]6\}}||krz||j|�qN|||<qNWx0|j�D]"}||kr�t�||<q�q�Wx-tj|�D]\}}||||�q�WdS(s
        Converts the self.deferred_loading data structure to an alternate data
        structure, describing the field that *will* be loaded. This is used to
        compute the columns to select from the database and also by the
        QuerySet class to work out which fields are being initialised on each
        model. Models that have all their fields included aren't mentioned in
        the result, only those that have field restrictions in place.

        The "target" parameter is the instance that is populated (in place).
        The "callback" is a function that is called whenever a (model, field)
        pair need to be added to "target". It accepts three parameters:
        "target", and the model and list of fields being added for that model.
        Ni����i(RiRyROtpktconcrete_modeltsplitRRFtget_field_by_nametis_reverse_o2otrelttoRxR�tadd_to_dictR#Rt	iteritemstget_fields_with_modelR~tget_parent_list(R)ttargettcallbacktfield_namestdefert	orig_optstseentmust_includet
field_nametpartst	cur_modeltoptstnamet	old_modeltsourceR/RFR�tworksetR�tm((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytdeferred_to_datas\
			cCsQ|jj}||kr(t�||<nx"|D]}||j|j�q/WdS(sr
        Callback used by deferred_to_columns(). The "target" parameter should
        be a set instance.
        N(Rxtdb_tableROR�tcolumn(R)R�RFtfieldsR�R/((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytdeferred_to_columns_cbks

cCs�|jj|�}|rF|rF|d}|j|cd7<|tfS|r|d|jt|j�df}|j|�n|}|g|j|<d|j|<|jj|�|t	fS(s	
        Returns a table alias for the given table_name and whether this is a
        new alias or not.

        If 'create' is true, a new alias is always created. Otherwise, the
        most recently created alias for the table (if one exists) is reused.
        iis%s%d(
RIR�RGRQtalias_prefixR�RHR�RVRK(R)t
table_nametcreatetcurrentRv((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyttable_aliasws


 
cCs|j|cd7<dS(s/ Increases the reference count for this alias. iN(RG(R)Rv((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt	ref_alias�sicCs|j|c|8<dS(s/ Decreases the reference count for this alias. N(RG(R)Rvtamount((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR��scst���x�r�jd���j�jdddkrHqn�j�j}|ot�j|j�jk}�j�j�jk}|s��j�js�|r|r�j�j	d�j�}|�j�<�j
���fd��jj�D��qqWdS(sM
        Promotes recursively the join type of given aliases and its children to
        an outer join. If 'unconditional' is False, the join is only promoted if
        it is nullable or the parent join is an outer join.

        Note about join promotion: When promoting any alias, we make sure all
        joins which start from that alias are promoted, too. When adding a join
        in join(), we make sure any join added to already existing LOUTER join
        is generated as LOUTER. This ensures we don't ever have broken join
        chains which contain first a LOUTER join, then an INNER JOIN, that is
        this kind of join should never be generated: a LOUTER b INNER c. The
        reason for avoiding this type of join chain is that the INNER after
        the LOUTER will effectively remove any effect the LOUTER had.
        iiR�c3s7|]-}�j|j�kr|�kr|VqdS(N(RHt	lhs_alias(R�R�(RvtaliasesR)(s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pys	<genexpr>�sN(R:tpopRHR�R#R�R�R�R�t_replacetextendtkeys(R)R�t
unconditionaltparent_aliast
parent_loutertalready_loutertdata((RvR�R)s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR��s	

cCsPxI|jj�j�D]2\}}||j|d�}|j||�qWdS(s�
        This method will reset reference counts for aliases so that they match
        the value passed in :param to_counts:.
        iN(RGR|RsR�R�(R)t	to_countsRvtcur_refcounttunref_amount((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytreset_refcounts�s"cCsLxE|j�D]7\}}||kr
||kr
|j|g�q
q
WdS(s+
        This method is to be used for promoting joins in ORed filters.

        The principle for promotion is: any alias which is used (it is in
        alias_usage_counts), is not used by every child of the ORed filter,
        and isn't pre-existing needs to be promoted to LOUTER join.
        N(RsR�(R)taliases_beforetalias_usage_countst
num_childsRvt	use_count((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytpromote_disjunction�s	csPt�j��jt�j���t�ks6t��fd��|jj��|jj��|jr�g|jD]}�|�^qx|_ng|j	D]!}t
�|j�|j�^q�|_	t
�fd�|jj�D��|_x�|jj�D]s\}}|j|=tg|D]}�j||�^q"�}�j|d|d�f|d}||j|<qWx�tj��D]�\}}|j|}	|	jd|�}	|j||j|<|j|=|	|j|<|j|=|j|	j}
x4t|
�D]&\}}||kr||
|<PqqWx:t|j�D])\}}||kr@||j|<Pq@q@Wq�Wx=|jj�D],\}
}|�kr��||j|
<q�q�Wx[tj|j�D]G\}}|j}|�kr�|jd�|�}||j|<q�q�Wt|d�rLg|jD]}�j||�^q(|_ndS(	s�
        Changes the aliases in change_map (which maps old-alias -> new-alias),
        relabelling any references to them in select columns and the where
        clause.
        csJt|ttf�r9|d}�j||�|dfS|j��SdS(Nii(R�R:R>R�R�(R�t	old_alias(R�(s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytrelabel_column�s
c3s'|]\}}|�|�fVqdS(N((R�tkeyR�(R(s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pys	<genexpr>�siit	rhs_aliasR�t
_lookup_joinsN( ROR�tintersectionR�R�RWR�RZRYRTRR�R/RRRsRJR>R�RR�RHR�RGRIR�t	enumerateRVRSR�RR	(R)R�R�tstidentR�R�RR�t
alias_datat
table_aliasestposRvRR�R�tlj((R�Rs</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytchange_aliases�sR6	(1%
+%





	cCs�t|j�}|td�ks't�t|d�}||_t�}xVt|j�D]E\}}||krwqYnd||f}|||<||j|<qYW|j|�dS(s@
        Changes the alias prefix to the next letter in the alphabet and
        relabels all the aliases. Even tables that previously had no alias will
        get an alias after this call (it's mostly used for nested queries and
        the outer query will already be using the non-aliased table name).

        Subclasses who create their own prefix should override this method to
        produce a similar result (a new prefix and relabelled aliases).

        The 'exceptions' parameter is a container that holds alias names which
        should not be changed.
        tZis%s%dN(tordR�R�tchrRRRVR(R)t
exceptionsR�tprefixR�RRvR�((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytbump_prefixs
		
cCsK|jr&|jd}|j|�n!|jd|j�jdf�}|S(sg
        Returns the first alias for this query, after increasing its reference
        count.
        iN(RVR�R�R#RyR�(R)Rv((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR�-s
	
!cCs,tg|jj�D]}|rd^q�S(s�
        Returns the number of tables in this query with a non-zero reference
        count. Note that after execution, the reference counts are zeroed, so
        tables added in compiler will not be seen by this method.
        i(R�RGR�(R)tcount((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytcount_active_tables9scCs�|\}}}|dks-|dk	s-t�|jj|d�}	|dkrW|	}n%g|	D]}
|
|kr^|
^q^}x>|D]6}|r�|j|j|kr�q�n|j|�|SW|j|t�\}}|s�d}
n4|s|j|j	|j
kr|j
}
n	|j}
t|||
||p0d||�}||j|<||jkrq|j|c|f7<n|f|j|<|S(s�
        Returns an alias for the join in 'connection', either reusing an
        existing alias for that join or creating a new one. 'connection' is a
        tuple (lhs, table, join_cols) where 'lhs' is either an existing
        table alias or a table name. 'join_cols' is a tuple of tuples containing
        columns to join on ((l_id1, r_id1), (l_id2, r_id2)). The join corresponds
        to the SQL equivalent of::

            lhs.l_id1 = table.r_id1 AND lhs.l_id2 = table.r_id2

        The 'reuse' parameter can be either None which means all joins
        (matching the connection) are reusable, or it can be a set containing
        the aliases that can be reused.

        If 'outer_if_first' is True and a new join is created, it will have the
        LOUTER join type.

        A join is always created as LOUTER if the lhs alias is LOUTER to make
        sure we do not generate chains like t1 LOUTER t2 INNER t3.

        If 'nullable' is True, the join can potentially involve NULL values and
        is a candidate for promotion (to "left outer") when combining querysets.

        The 'join_field' is the field we are joining along (if any).
        N((NN((NN(
R#R�RJR�RHR�R�R�RKR�R�tINNERR(R)R0R�R�R�R�R�R�R�texistingR�RvR�R�R�((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR�As0	%

			
cCsu|j�}|jd}i|d6}x?|j�D]1\}}||kr3|j||||�q3q3W||_dS(s�
        If the model that is the basis for this QuerySet inherits other models,
        we need to ensure that those other models have their tables included in
        the query.

        We do this as a separate step so that subclasses know which
        tables are going to be active in the query, without needing to compute
        all the select columns (this method is called from pre_sql_setup(),
        whereas column determination is a later part, and side-effect, of
        as_sql()).
        iN(RyRVR#R�tjoin_parent_modelRS(R)R�t
root_aliasR�R/RF((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytsetup_inherited_models�s

cCs�||kr||S|j|�}|dkr3|S|}x�|D]�}||krZ||S|j|sv|j}q@n|j|�}|j|jg||�\}	}	}	}
}	|j}|
d}||<q@W|p�|dS(s~
        Makes sure the given 'model' is joined in the query. If 'model' isn't
        a parent of 'opts' or if it is None this method is a no-op.

        The 'alias' is the root alias for starting the join, 'seen' is a dict
        of model -> alias of existing joins. It must also contain a mapping
        of None -> some alias. This will be returned in the no-op case.
        i����N(tget_base_chainR#tparentsRxtget_ancestor_linktsetup_joinsR�(R)R�RFRvR�tchaint	curr_optst	int_modelt
link_fieldR�tjoins((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR�s$	

	$	cCsCx3|jj�D]"\}}|r|j|�qqWi|_dS(s�
        Undoes the effects of setup_inherited_models(). Should be called
        whenever select columns (self.select) are set explicitly.
        N(RSRsR�(R)RRv((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR��sc
Cs�|j}|jjt�}t|�dkr�|j|jkr�|d}|}|j|}	|svtd|j||f��qvn�t|�dks�|dg|jD]}
|
j^q�ks�|j	dks�|rW|j|||j��\}}}}
}|j
||
|�\}}}
|j|
t�|dj}|d}	|
d|f}n|d}|j|�}	|}|j||d|d|	d|�dS(	sA
        Adds a single aggregate expression to the Query
        iis-Cannot compute %s('%s'): '%s' is an aggregatei����R�R�R�N(RxtlookupR�RR�RRR�R�RYR#R#R�t
trim_joinsR�RKR�t	get_fieldtadd_to_query(R)RwRFRvR�R�t
field_listR�R�R�tiR/tsourcest	join_listtpathttargetsR�((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt
add_aggregate�s0	$

)$


cCsG|\}}|jt�}|s4td|��nd}t|�}	t|�dkr|d|jkr||jkr|j}
x�t|�D]�\}}y|
jj	|�}
Wnt
k
r�|j�}PnX|d|	kr�y|
jj
}
Wqtk
r|j�}PqXq�q�Wn|j�}|dkr`|dkrQtd��nd}t}n?t|�rx|�}n't|t�r�t||d|�}nttjjr�|dkr�|dkr�t}d}nxY|jj�D]H\}}||d	tj|�fkr�|j|||ft�|Sq�W|j�}|j �}|}yY|j!|||||d
t�\}}}}}|dk	r�|j"|�n||_#Wn9t$k
r�}|j%|tj||j& �||j'�SX|dkr'|tkr'|r't|�dkr'|j(|�n|j)|||�\}}}t*|d�rx|j+|j|||||�}n"t,||d	j-|�||f}|j|t�|rC|dks�|t.krC|j(|�|dkrC|j/|d	�s|j0|dj1|j2krC|jt,||d	j-d�dt.ft�qCn|S(
s?
        Builds a WhereNode for a single filter clause, but doesn't add it
        to this Query. Query.add_q() will then add this filter to the where
        or having Node.

        The 'branch_negated' tells us if the current branch contains any
        negations. This will be used to determine if subqueries are needed.

        The 'current_negated' is used to determine if the current filter is
        negated or not and this will be used to determine if IS NULL filtering
        is needed.

        The difference between current_netageted and branch_negated is that
        branch_negated is set on first negation, but current_negated is
        flipped for each negation.

        Note that add_filter will not do any negating itself, that is done
        upper in the code by add_q().

        The 'can_reuse' is a set of reusable joins for multijoins.

        The method will create a filter clause that can be added to the current
        query. However, if the filter isn't added to the query then the caller
        is responsible for unreffing the joins used.
        sCannot parse keyword query %rtexactii����s Cannot use None as a query valuetisnullR�titallow_explicit_fktget_lookup_constraintN(3R�RRR�tquery_termsRRFRRxR+R	R�R�R�tAttributeErrorRXR#RrRKtcallableR�RRRRR8t!interprets_empty_strings_as_nullsRsR�R�RRyR�R#R~R	Rt
split_excludetleveltnames_with_pathR�R*RR8RR�RQtis_nullableRHR�R�(R)tfilter_exprtbranch_negatedtcurrent_negatedt	can_reusetargR.R�tlookup_typet	num_partstlookup_modeltcounterR�tlookup_fieldtclauseRvRwR�t
allow_manyR/R/R0R1teR2t
constraint((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytbuild_filter�s�%	

		
"

2cCs |jj|j|�d�dS(NR(RWR�RO(R)t
filter_clause((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt
add_filter}scsrt|t�sUt|djt��j�pTt|dd�oT|dj�j�St�fd�|j	D��S(s|
        Returns whether or not all elements of this q_object need to be put
        together in the HAVING clause.
        iitcontains_aggregatec3s|]}�j|�VqdS(N(tneed_having(R�tc(R)(s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pys	<genexpr>�s(
R�RRR�RRRRRtanytchildren(R)R�((R)s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyRS�s
cCs�g}x�|jD]�}t|t�r�|j|A}|jtkrz|j|�rz|jj|�|j|�||_q�|j	|j
||�d�q|j|�r|jj|�|jd|gd|�}|j|�qqW||fS(s�
        Returns a list of q_objects which need to go into the having clause
        instead of the where clause. Removes the splitted out nodes from the
        given q_object. Note that the q_object is altered, so cloning it is
        needed.
        iRVtnegated(RVR�RRWR�RRStremoveR�R�tsplit_having_partsRX(R)tq_objectRWthaving_partsRTt
in_negatedtnew_q((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyRY�s

cCs�|j|�s|g}}n!|j|j�|j�\}}|j}|j||�}|jj|t�x3|D]+}|j||�}|j	j|t�quW|j
r�||_ndS(s�
        A preprocessor for the internal _add_q(). Responsible for
        splitting the given q_object into where and having parts and
        setting up some internal variables.
        N(RSRYR+RWRPt_add_qRWR�RRZRR(R)RZt
where_partR[RPRKthp((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytadd_q�s	
	c
Cs�|j}||jA}|p"|j}|jd|d|j�}|}|rg|tkr^tnt}n|tkr�t�}t|j�}	nx�|jD]�}
|tkr�|j	j
�}nt|
t�r�|j
|
|||�}n!|j|
d|d|d|�}|j||�|tkr�t||j	�}
x+|
D] }|j|d�d||<q<Wq�q�W|tkr�|j|	|t|j��n|S(s8
        Adds a Q-object to the current filter.
        R�RWRDRBRCii(R�RWRXRRR�RORVRVRGR|R�RR^ROR�t
alias_diffR�RR�(R)RZRPRBRCR�t
target_clauseteffective_connectorRRtchildtrefcounts_beforetchild_clausetusedRv((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR^�s<	
			
%c
Cs gg}}x�t|�D]�\}}|gf}	|dkrM|jj}ny|j|�\}
}}}
Wn�tk
rx�|jD]=}|r�||jkr�|j|j�\}
}}}
Pq�q�W|j�t|j	�}t
d|dj|�f��nX|r�|j}x�|j
|�D]�}||kr@|j}q"|j|}|jj�f}|j}|jt|jj|||tt��|	djt|jj|||tt��q"Wnt|
d�r�|
j�}|sLxet|�D]T\}}|jr�|	dj|d|d!�|j|	�t|d|��q�q�Wn|d}|j|�|j}|j}|j}|	dj|�|j|	�q|
}|
f}PqW|t|�dkr|t|�dkrt
d	|||df��qt
d
|��n|||fS(s=
        Walks the names path and turns them PathInfo tuples. Note that a
        single name in 'names' can generate multiple PathInfos (m2m for
        example).

        'names' is the path of names to travle, 'opts' is the model Options we
        start the name resolving from, 'allow_many' and 'allow_explicit_fk'
        are as for setup_joins().

        Returns a list of PathInfo tuples. In addition returns the final field
        (the last used join field), and target (which is a field guaranteed to
        contain the same value as the final field).
        R�s5Cannot resolve keyword %r into field. Choices are: %ss, it
get_path_infoii����isHJoin on field %r not permitted. Did you misspell %r for the lookup type?sJoin on field %r not permitted.( RR�R�R�R	R�tattnametget_all_field_namesR:R(RR�R�R RxR!R�tget_related_fieldR�R
RFRQRKRRitm2mR�RR�tto_optst
target_fieldsR�(R)tnamesR�RLR7R1R?RR�tcur_names_with_pathR/RFtdirectRmtft	availablet
proxied_modelR&tfinal_fieldR2t	pathinfost	inner_postptlast((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt
names_to_path�sd

	
	(3	


				cCs	|g}|j||||�\}	}
}x�t|	�D]�\}}
|
j}|
jrj|j|
j�}nt}||j|
jj�f}|
j	r�|nd}|j|d|d|d|
jd|�}|j|�q7Wt
|
d�r�|
j}
n|
||||	fS(s
        Compute the necessary table joins for the passage through the fields
        given in 'names'. 'opts' is the Options class for the current model
        (which gives the table we are starting from), 'alias' is the alias for
        the table to start the joining from.

        The 'can_reuse' defines the reverse foreign key joins we can reuse. It
        can be None in which case all joins are reusable or a set of aliases
        that can be reused. Note that non-reverse foreign keys are always
        reusable when using setup_joins().

        If 'allow_many' is False, then any reverse foreign key seen will
        generate a MultiJoin exception.

        The 'allow_explicit_fk' controls if field.attname is allowed in the
        lookups.

        Returns the final field involved in the joins, the target field (used
        for any 'where' constraint), the final 'opts' value, the joins and the
        field path travelled to generate the joins.

        The target field is the field containing the concrete value. Final
        field can be something different, for example foreign key pointing to
        that value. Final field is needed for example in some value
        conversions (convert 'obj' in fk__id=obj to pk val using the foreign
        key field for example).
        R�R�R�R�R/N(R{RRnRrR@R�RKR�tget_joining_columnsRmR#R�R�RR/(R)RpR�RvRDRLR7R�R(R1RvR2RR�R�R0R�((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR#3s"				cs�x�tt|��D]�\}}t|�dks;|jr?Pntd�|jjD��}td�|D����j|�s�Pnt�fd�|jj	D��}|j
|j��qW||d|fS(s

        The 'target' parameter is the final field being joined to, 'joins'
        is the full list of join aliases. The 'path' contain the PathInfos
        used to create the joins.

        Returns the final target field and table alias and the new active
        joins.

        We will always trim any direct join if we have the target column
        available already in the previous table. Reverse joins can't be
        trimmed as we don't know if there is anything on the other side of
        the join.
        icss|]}|jVqdS(N(R�(R�tt((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pys	<genexpr>xscss|]}|jVqdS(N(R�(R�R}((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pys	<genexpr>ysc3s,|]"}|dj�kr|dVqdS(iiN(R�(R�tr(tcur_targets(s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pys	<genexpr>|si����(RtreversedR�RrROR�tforeign_related_fieldstissubsetR>trelated_fieldsR�R�(R)R2R(R1Rtinfotjoin_targets((Rs</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR*gs"cCs8t|j�}|jj|j|�t�|j�|jt�|j	|�\}}|j
�|j|jdj
�r�|jdj\}}	|jjt||	|jdj
�dtft�n|jd||fdtdtd|�}
|r4|jd|tfdtdtd|�}|
j|t�n|
S(s\
        When doing an exclude against any kind of N-to-many relation, we need
        to use a subquery. This method constructs the nested query, given the
        original exclude filter (filter_expr) and the portion up to the first
        N-to-many relation field.

        As an example we could have original filter ~Q(child__name='foo').
        We would get here with filter_expr = child__name, prefix = child and
        can_reuse is a set of joins usable for filters in the original query.

        We will turn this into equivalent of:
            WHERE NOT (pk IN (SELECT parent_id FROM thetable
                              WHERE name = 'foo' AND parent_id IS NOT NULL))

        It might be worth it to consider using WHERE NOT EXISTS as that has
        saner null handling, and is easier for the backend's optimizer to
        handle.
        iR5s%s__inRCRBRDs
%s__isnull(RRFRWR�RORRR�RKt
trim_startR�R@RTR/R�RRQR(R)RARRDR?R�ttrimmed_prefixtcontains_louterRvR�t	conditiontor_null_condition((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR=�s$


5cCst�|_t�|_dS(N(RRWRZ(R)((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt	set_empty�scCs"t|jt�p!t|jt�S(N(R�RWRRZ(R)((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytis_empty�scCs�|dk	rM|jdk	r:t|j|j|�|_qM|j||_n|dk	r�|jdk	r�t|j|j|�|_q�|j||_ndS(s�
        Adjusts the limits on the rows retrieved. We use low/high to set these,
        as it makes it more Pythonic to read and write. When the SQL query is
        created, they are converted to the appropriate offset and limit values.

        Any limits passed in here are applied relative to the existing
        constraints. So low is added to the current low value and both will be
        clamped to any existing high value.
        N(R#R&R�R%(R)tlowR�((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR��s
cCsd\|_|_dS(s-
        Clears any existing limits.
        iN(iN(R#R%R&(R)((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR��scCs|jo|jdkS(s�
        Returns True if adding filters to this instance is still possible.

        Typically, this means no limits or offsets have been put on the results.
        N(R%R&R#(R)((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR��scCs9g|_t|_t|_|jd�|jd�dS(s8
        Removes all fields from SELECT clause.
        N(((RTRQRLR`R�tset_aggregate_mask(R)((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR��s
			
cCs
g|_dS(s�
        Clears the list of fields to select (but not extra_select columns).
        Some queryset types completely replace any existing list of select
        columns.
        N(RT(R)((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytclear_select_fields�scGs||_t|_dS(sY
        Adds and resolves the given fields to the query's "distinct on" clause.
        N(R]RKR\(R)R�((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytadd_distinct_fields�s	cCs|j�}|j�}y�x�|D]�}|j|jt�||d|dtdt�\}}}}	}
|j||	d|
�\}}}|	d |}	|j|	d�x0|D](}
|j	j
t||
jf|
��q�Wq"WWn�t
k
rtd|��nntk
rpt|kr"�qqt|j�t|j�t|j��}td|dj|�f��nX|j�dS(	s|
        Adds the given (model) fields to the select set. The field names are
        added in the order specified.
        R7R�i����isInvalid field name: '%s's5Cannot resolve keyword %r into field. Choices are: %ss, N(R�RyR#R�RR#RKR*R�RTR�RR�RRtsortedRkR:RdR(R�R�(R)R�t	allow_m2mRvR�R�R/R2tu2R(R1tfinal_aliastremaining_joinsR�Rp((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt
add_fields�s,
"
.

)cGsug}x-|D]%}tj|�s
|j|�q
q
W|rOtd|��n|rh|jj|�n	t|_dS(sk
        Adds items from the 'ordering' sequence to the query's "order by"
        clause. These items are either field names (not column names) --
        possibly with a direction prefix ('-' or '?') -- or ordinals,
        corresponding to column positions in the 'select' list.

        If 'ordering' is empty, all ordering is cleared from the query.
        sInvalid order_by arguments: %sN(RtmatchR�RR[R�RQRM(R)torderingterrorstitem((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytadd_orderings	
cCs(g|_d|_|r$t|_ndS(s�
        Removes any ordering settings. If 'force_empty' is True, there will be
        no ordering in the resulting query (not even the model's default).
        N((R[RhRQRM(R)tforce_empty((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR�/s		cCs7g|_x'|jD]\}}|jj|�qWdS(s@
        Expands the GROUP BY clause required by the query.

        This will usually be the set of all non-aggregate fields in the
        return data. If the database backend supports grouping by the
        primary key, and the query would be equivalent, the optimization
        will be made automatically.
        N(RYRTR�(R)R�R�((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytset_group_by9s		cCsA|jst|js-|jjddt�}qt|j�dksUtd|j��|jj|jdj�}n�|j�}|js�|jj|j	d|jdf�|jj
fdtdt�}nCt|j�dks�td��|jj|jdjdt�}t|_i|d6|_|jd�d|_dS(	sn
        Converts the query to do count(...) or count(distinct(pk)) in order to
        get its size.
        t*R�is7Cannot add count col with multiple cols in 'select': %riR\s4Cannot add count col with multiple cols in 'select'.N(R\RTtaggregates_moduletCountRKR�R�R�RyR�R#R�R�R�RQRR�RY(R)RR�((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR�Gs$				'	"	
cCs_i}x@|D]8}|}x)|jt�D]}|j|i�}q)Wq
W||_g|_dS(s�
        Sets up the select_related data structure so that we only select
        certain related models (as opposed to all models, when
        self.select_related=True).
        N(R�Rt
setdefaultR`RU(R)R�t
field_dictR/tdtpart((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytadd_select_relatedjs
	c
Cs,|r�t�}|r$t|�}ntg�}x�|j�D]y\}	}
t|
�}
g}|
jd�}x9|dkr�|jt|��|
jd|d�}qmW|
|f||	<q=W|jj|�n|s�|r�|j	j
t||�t�n|r|j
t|�7_
n|r(||_ndS(sn
        Adds data to the various extra_* attributes for user-created additions
        to the query.
        s%si����iN(RR;RsRtfindR�tnextRdR~RWR�RRRgR>Rh(
R)RTt
select_paramsRWR RVR[tselect_pairst
param_iterR�tentrytentry_paramsR((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR�xs(	cCst�tf|_dS(sB
        Remove any fields from the deferred loading set.
        N(RORKRi(R)((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytclear_deferred_loading�scCsL|j\}}|r0|j|�tf|_n|j|�tf|_dS(sp
        Add the given list of model field names to the set of fields to
        exclude from loading from the database when automatic column selection
        is done. The new field names are added to any existing field names that
        are deferred (or removed from any existing field names that are marked
        as the only ones for immediate loading).
        N(RitunionRKt
differenceRQ(R)R�RR�((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytadd_deferred_loading�scCs�|j\}}t|�}d|krP|jd�|j|j�jj�n|rq|j|�tf|_n|tf|_dS(s
        Add the given list of model field names to the set of fields to
        retrieve when the SQL is executed ("immediate loading" fields). The
        field names replace any existing immediate loading field names. If
        there are field names already specified for deferred loading, those
        names are removed from the new field_names before storing the new names
        for immediate loading. (That is, immediate loading overrides any
        existing immediate values, but respects existing deferrals.)
        R�N(	RiRORXR�RyR�R�R�RQ(R)R�RR�((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytadd_immediate_loading�s

cCsFy|jSWn4tk
rAi}|j||j�||_|SXdS(sI
        If any fields are marked to be deferred, returns a dictionary mapping
        models to a set of names in those fields that will be loaded. If a
        model is not in the returned dictionary, none of it's fields are
        deferred.

        If no fields are marked for deferral, returns an empty dictionary.
        N(t_loaded_field_names_cacheR:R�tget_loaded_field_names_cb(R)t
collection((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pytget_loaded_field_names�s
	cCs*tg|D]}|j^q
�||<dS(s>
        Callback used by get_deferred_field_names().
        N(ROR�(R)R�RFR�Rs((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR��scCs4|dkrd|_nt|�|_d|_dS(sGSet the mask of aggregates that will actually be returned by the SELECTN(R#RaRORb(R)Rp((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR��scCs4|dkrd|_nt|�|_d|_dS(s�
        Set the mask of extra select items that will be returned by SELECT,
        we don't actually remove them from the Query since they might be used
        later
        N(R#ReRORf(R)Rp((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR��scCs}|jdk	r|jS|jdk	rrtg|jj�D]'\}}||jkr8||f^q8�|_|jS|jSdS(s�The SortedDict of aggregate columns that are not masked, and should
        be used in the SELECT clause.

        This result is cached for optimization purposes.
        N(RbR#RaRRRs(R)tktv((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt_aggregate_select�s'cCs}|jdk	r|jS|jdk	rrtg|jj�D]'\}}||jkr8||f^q8�|_|jS|jSdS(N(RfR#ReRRdRs(R)R�R�((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt
_extra_select	s'cCs`g}x!|D]\}}|j|�q
Wt}g|jD].}||jksb||jdkr:|^q:}xbt|�D]T\}}	|	jr�Pn|j||dj|jkr�t	}n|j
||�q{W|	jj}
|}g}xK|D]C\}
}	|t
|	�dkrPn|j|
�|t
|	�8}q�W|j|
jdj�tj|�}|j||dj|jkr�g|
jD]}|d^q�}||d}|j
||�|
j|jd||d�}|r(|jj|t�q(n*g|
jD]}|d^q}||}g|D]}t||jf|�^q/|_||fS(s�
        Trims joins from the start of the join path. The candidates for trim
        are the PathInfos in names_with_path structure that are m2m joins.

        Also sets the select column so the start matches the join.

        This method is meant to be used for generating the subquery joins &
        cols in split_exclude().

        Returns a lookup usable for doing outerq.filter(lookup=self). Returns
        also if the joins in the prefix contain a LEFT OUTER join.
        _iiN(R�RQRVR	RRmRHR�R�RKR�R�R/R�R�R�R�RR�R�tget_extra_restrictionRXR#RWR�RRR�RT(R)R?t	all_pathsR�tpathsR�R}t
lookup_tablest
trimmed_pathsR1R�tpaths_in_prefixR�R�R~t
select_fieldstselect_aliastextra_restrictionRs((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR�sD
>	!	
!  
.cCs(ttjjr|jrtS|jSdS(s%
        A helper to check if the given field should be treated as nullable.

        Some backends treat '' as null and Django treats such fields as
        nullable for those backends. In such situations field.null can be
        False even if we should treat the field as nullable.
        N(RRR8R<tempty_strings_allowedRKtnull(R)R/((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR@Rs
	N((URARBRCRR�R�RR9tbase_aggregates_moduleR�RuRR*RkRjRpRqR#RlRyR+R-R�R�R�R�R�R�R�RQR�R�R�R�R�RRRR�RR�RRR�R3RORQRSRYRaR^R{RKR#R*R=R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�tpropertyR(R�R'R�R@(((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyRZs�>					E				5	#	
	}	S		&			
	>		@		 		1�			&	P3		5					
		#		
		#		 										<tASCcCs:t|}|ddkr,|d|dfS||dfS(s
    Returns the field name and direction for an order specification. For
    example, '-foo' is returned as ('foo', 'DESC').

    The 'default' param is used to indicate which way no prefix (or a '+'
    prefix) should sort. The '-' prefix always sorts the opposite way.
    it-i(R
(R/tdefaulttdirn((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt
get_order_dires
cCs7||kr ||j|�nt|g�||<dS(ss
    A helper function to add "value" to the set of values for "key", whether or
    not "key" already exists.
    N(R�RO(R�RR.((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR�sscCst|d�o|jjS(s�
    A little helper to check if the given field is reverse-o2o. The field is
    expected to be some sort of relation field or related object.
    R�(RR/tunique(R/((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyR�}scst��fd��D��S(sw
    Given the before and after copies of refcounts works out which aliases
    have been added to the after copy.
    c3s1|]'}�|�j|d�kr|VqdS(i����N(R�(R�R}(trefcounts_afterRf(s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pys	<genexpr>�s(RO(RfR�((R�Rfs</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyRb�s(9RCR|tdjango.utils.datastructuresRtdjango.utils.encodingRtdjango.utils.treeRtdjango.utilsRt	django.dbRRtdjango.db.models.constantsRtdjango.db.models.aggregatesRtdjango.db.models.expressionsRtdjango.db.models.fieldsR	tdjango.db.models.relatedR
tdjango.db.models.sqlRR�tdjango.db.models.sql.constantsRR
RRRRt#django.db.models.sql.datastructuresRRRt django.db.models.sql.expressionsRtdjango.db.models.sql.whereRRRRRRRtdjango.core.exceptionsRt__all__tobjectRRR�R�R�Rb(((s</tmp/pip-install-XxeQeY/django/django/db/models/sql/query.pyt<module>s>.48�������	
	

https://t.me/AnonymousX5 - 2025