+
    Tj)                       ^ RI t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHt ^ RIHt ^ RIHtHtHt ^ R	IHtHtHt ^ R
IHt ^ RIHt ^ RIHt ^ RIHt ^ RI H!t!H"t" ^ RI#H$t$  ! R R4      t% ! R R4      t& ! R R]4      t' ! R R4      t(] ! R R](]&4      4       t)]&PT                  ]&PV                  ]&PX                  ]&PZ                  ]&P\                  3 U u/ uF(  p V ]P^                  ]P^                  ]P^                  3.bK*  	  up ]&PT                  ]&P`                  ]&PV                  ]&PX                  ]&PZ                  ]&P\                  3 U u/ uFl  p V ]Pb                  ]Pb                  ]Pb                  3]Pd                  ]Pd                  ]Pd                  3]Pf                  ]Pf                  ]Pf                  3.bKn  	  up ]&PT                  ]&P`                  ]&PV                  ]&PX                  ]&PZ                  3 U u/ uF  p V ]Pb                  ]Pf                  ]Pf                  3]Pf                  ]Pb                  ]Pf                  3]Pb                  ]Pd                  ]Pd                  3]Pd                  ]Pb                  ]Pd                  3.bK  	  up ]&Ph                  ]&Pj                  ]&Pl                  ]&Pn                  ]&Pp                  3 U u/ uF(  p V ]Pb                  ]Pb                  ]Pb                  3.bK*  	  up ]&PT                  ]&P`                  ]&PV                  ]&PX                  ]&PZ                  ]&P\                  3 U u/ uFC  p V ]9! ]Pu                  R ]Pb                  ]Pf                  ]Pd                  3 4       4      4      bKE  	  up ]&PT                  ]Pv                  ]Px                  ]Pz                  3]Pz                  ]Px                  ]Pz                  3]Px                  ]Pv                  ]Pz                  3]Px                  ]Pz                  ]Pz                  3]Px                  ]Px                  ]Px                  3]P|                  ]Px                  ]P|                  3]Px                  ]P|                  ]P|                  3./]&P`                  ]Pv                  ]Px                  ]Pz                  3]Pz                  ]Px                  ]Pz                  3]Pv                  ]Pv                  ]Px                  3]Pv                  ]Pz                  ]Px                  3]Pz                  ]Pv                  ]Px                  3]Pz                  ]Pz                  ]Px                  3]Px                  ]Px                  ]Px                  3]P|                  ]Px                  ]P|                  3]P|                  ]P|                  ]Px                  3.	/.t?]! ]94      t@R tA]? F5  tB]BP                  4        F  w  tDtE]E F  w  tFtGtH]A! ]F]D]G]H4       K  	  K   	  K7  	  ]P                  ! ^R7      R 4       tJ ! R R]%])4      tK ! R  R!]K4      tL ! R" R#]K4      tM]! R$R%7       ! R& R']&4      4       tN ! R( R)]N4      tO ! R* R+]N4      tP ! R, R-]N4      tQ]! R.R%7       ! R/ R0]%])4      4       tR]! R1R%7       ! R2 R3]%])4      4       tS ! R4 R5])4      tT ! R6 R7])4      tU ! R8 R9])4      tV ! R: R;])4      tW ! R< R=])4      tX ! R> R?])4      tY ! R@ RA]R4      tZ ! RB RC]Z4      t[]! RDR%7       ! RE RF]%])4      4       t\ ! RG RH]\4      t]]! RIR%7       ! RJ RK])4      4       t^]! RLR%7       ! RM RN]%])4      4       t_ ! RO RP](]&4      t` ! RQ RR]`4      ta]! RSR%7       ! RT RU])4      4       tb ! RV RW]%])4      tc ! RX RY]	4      td ! RZ R[])4      te ! R\ R]]e4      tf ! R^ R_]e4      tgR# u up i u up i u up i u up i u up i )`    N)defaultdictDecimal)Enum)chainNoneType)UUID)EmptyResultSet
FieldErrorFullResultSet)DatabaseErrorNotSupportedError
connection)fields)
LOOKUP_SEP)Q)deconstructible)cached_propertyclassproperty)make_hashablec                   *   a  ] tR t^t o RtR tRtV tR# )SQLiteNumericMixinzd
Some expressions with output_field=DecimalField() must be cast to
numeric to be properly filtered.
c                    V P                   ! W3/ VB w  rE V P                  P                  4       R 8X  d
   RV,          pWE3#   \         d     YE3# i ; i)DecimalFieldz(CAST(%s AS NUMERIC)))as_sqloutput_fieldget_internal_typer   )selfcompilerr   extra_contextsqlparamss   &&&,  Q/var/www/idalgo/venv/lib/python3.14/site-packages/django/db/models/expressions.py	as_sqliteSQLiteNumericMixin.as_sqlite   sc    kk(H-H	  224F-3 {  	{	s   (A AA N)__name__
__module____qualname____firstlineno____doc__r%   __static_attributes____classdictcell____classdict__s   @r$   r   r      s     
     r   c                      a  ] tR t^&t o RtRtRtRtRtRt	Rt
RtR	tR
tRtRtR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t R t!R t"R  t#R! t$R" t%R# t&R$ t'R% t(R& t)R't*V t+R(# ))
Combinablezi
Provide the ability to combine one or two objects with
some connector. For example F('foo') + F('bar').
+-*/^z%%&|z<<z>>#c                |    \        VR 4      '       g   \        V4      pV'       d   \        WV 4      # \        WV4      # resolve_expression)hasattrValueCombinedExpression)r   other	connectorreverseds   &&&&r$   _combineCombinable._combine?   s6    u233%LE%e==!$599r1   c                <    V P                  RV P                  R4      # )   FrE   MULr   s   &r$   __neg__Combinable.__neg__L   s    }}R511r1   c                :    V P                  WP                  R 4      # FrE   ADDr   rB   s   &&r$   __add__Combinable.__add__O       }}UHHe44r1   c                :    V P                  WP                  R 4      # rP   rE   SUBrS   s   &&r$   __sub__Combinable.__sub__R   rV   r1   c                :    V P                  WP                  R 4      # rP   rJ   rS   s   &&r$   __mul__Combinable.__mul__U   rV   r1   c                :    V P                  WP                  R 4      # rP   rE   DIVrS   s   &&r$   __truediv__Combinable.__truediv__X   rV   r1   c                :    V P                  WP                  R 4      # rP   rE   MODrS   s   &&r$   __mod__Combinable.__mod__[   rV   r1   c                :    V P                  WP                  R 4      # rP   rE   POWrS   s   &&r$   __pow__Combinable.__pow__^   rV   r1   c                    \        V R R4      '       d/   \        VR R4      '       d   \        V 4      \        V4      ,          # \        R4      hconditionalFFUse .bitand(), .bitor(), and .bitxor() for bitwise logical operations.getattrr   NotImplementedErrorrS   s   &&r$   __and__Combinable.__and__a   C    4..75-QV3W3WT7QuX%%!T
 	
r1   c                :    V P                  WP                  R 4      # rP   )rE   BITANDrS   s   &&r$   bitandCombinable.bitandh       }}UKK77r1   c                :    V P                  WP                  R 4      # rP   )rE   BITLEFTSHIFTrS   s   &&r$   bitleftshiftCombinable.bitleftshiftk   s    }}U$5$5u==r1   c                :    V P                  WP                  R 4      # rP   )rE   BITRIGHTSHIFTrS   s   &&r$   bitrightshiftCombinable.bitrightshiftn   s    }}U$6$6>>r1   c                    \        V R R4      '       d/   \        VR R4      '       d   \        V 4      \        V4      ,          # \        R4      hro   rr   rS   s   &&r$   __xor__Combinable.__xor__q   rw   r1   c                :    V P                  WP                  R 4      # rP   )rE   BITXORrS   s   &&r$   bitxorCombinable.bitxorx   r|   r1   c                    \        V R R4      '       d/   \        VR R4      '       d   \        V 4      \        V4      ,          # \        R4      hro   rr   rS   s   &&r$   __or__Combinable.__or__{   rw   r1   c                :    V P                  WP                  R 4      # rP   )rE   BITORrS   s   &&r$   bitorCombinable.bitor   s    }}UJJ66r1   c                :    V P                  WP                  R 4      # TrQ   rS   s   &&r$   __radd__Combinable.__radd__       }}UHHd33r1   c                :    V P                  WP                  R 4      # r   rX   rS   s   &&r$   __rsub__Combinable.__rsub__   r   r1   c                :    V P                  WP                  R 4      # r   rJ   rS   s   &&r$   __rmul__Combinable.__rmul__   r   r1   c                :    V P                  WP                  R 4      # r   r`   rS   s   &&r$   __rtruediv__Combinable.__rtruediv__   r   r1   c                :    V P                  WP                  R 4      # r   re   rS   s   &&r$   __rmod__Combinable.__rmod__   r   r1   c                :    V P                  WP                  R 4      # r   rj   rS   s   &&r$   __rpow__Combinable.__rpow__   r   r1   c                    \        R 4      hrq   rt   rS   s   &&r$   __rand__Combinable.__rand__       !T
 	
r1   c                    \        R 4      hr   r   rS   s   &&r$   __ror__Combinable.__ror__   r   r1   c                    \        R 4      hr   r   rS   s   &&r$   __rxor__Combinable.__rxor__   r   r1   c                    \        V 4      # N)NegatedExpressionrL   s   &r$   
__invert__Combinable.__invert__   s     &&r1   r'   N),r(   r)   r*   r+   r,   rR   rY   rK   ra   rk   rf   ry   r   r~   r   r   rE   rM   rT   rZ   r]   rb   rg   rl   ru   rz   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r-   r.   r/   s   @r$   r3   r3   &   s      C
C
C
C
C C
 FELMF:2555555
8>?
8
7444444





' 'r1   r3   c                       ] tR t^tRtR# )OutputFieldIsNoneErrorr'   N)r(   r)   r*   r+   r-   r'   r1   r$   r   r      s    r1   r   c                   |  a  ] tR t^t o Rt]tRtRtRt	Rt
RtRtRtR(R ltR tR tR tR	 tR
 tR t]R 4       t]R 4       t]R 4       t]R 4       tR)R lt]R 4       t]R 4       t]R 4       t]R 4       tR t ]!R 4       t"]R 4       t#R t$R t%R t&R t'R t(R t)R t*R t+R  t,R! t-R" t.R# t/R$ t0R% t1R& t2R't3V t4R# )*BaseExpressionz%Base class for all query expressions.FTNc                    Ve	   Wn         R # R # r   r   r   r   s   &&r$   __init__BaseExpression.__init__   s    # , $r1   c                ^    V P                   P                  4       pVP                  R R4       V# )convert_valueN)__dict__copypop)r   states   & r$   __getstate__BaseExpression.__getstate__   s'    ""$		/4(r1   c                    V P                   V P                  J d   . MV P                   .V P                  P                  V4      ,           # r   )r   _convert_value_noopr   get_db_convertersr   r   s   &&r$   r    BaseExpression.get_db_converters   sG     !!T%=%== $$%//
;	< 	<r1   c                    . # r   r'   rL   s   &r$   get_source_expressions%BaseExpression.get_source_expressions       	r1   c                    V'       d   Q hR # r   r'   r   exprss   &&r$   set_source_expressions%BaseExpression.set_source_expressions   s    y5r1   c                    V Uu. uFC  p\        VR 4      '       d   TM+\        V\        4      '       d   \        V4      M
\	        V4      NKE  	  up# u upi r=   )r?   
isinstancestrFr@   )r   expressionsargs   &* r$   _parse_expressions!BaseExpression._parse_expressions   s\     #
 # 3 455  *3 4 4af%*F #
 	
 
s   A	Ac                    \        R4      h)a.  
Responsible for returning a (sql, [params]) tuple to be included
in the current query.

Different backends can provide their own implementation, by
providing an `as_{vendor}` method and patching the Expression:

```
def override_as_sql(self, compiler, connection):
    # custom logic
    return super().as_sql(compiler, connection)
setattr(Expression, 'as_' + connection.vendor, override_as_sql)
```

Arguments:
 * compiler: the query compiler responsible for generating the query.
   Must have a compile method, returning a (sql, [params]) tuple.
   Calling compiler(value) will return a quoted `value`.

 * connection: the database connection used for the current query.

Return: (sql, params)
  Where `sql` is a string containing ordered sql parameters to be
  replaced with the elements of the list `params`.
z"Subclasses must implement as_sql()r   r   r    r   s   &&&r$   r   BaseExpression.as_sql   s    4 ""FGGr1   c                    \         ;QJ d*    R  V P                  4        4       F  '       g   K   R# 	  R# ! R  V P                  4        4       4      # )c              3   L   "   T F  q;'       d    VP                   x  K  	  R # 5ir   )contains_aggregate.0exprs   & r$   	<genexpr>4BaseExpression.contains_aggregate.<locals>.<genexpr>   s#      
9V,,T,,,9V   $$TFanyr   rL   s   &r$   r   !BaseExpression.contains_aggregate   sO    s 
9=9T9T9V
ss 	
s 	
s 
9=9T9T9V
 
 	
r1   c                    \         ;QJ d*    R  V P                  4        4       F  '       g   K   R# 	  R# ! R  V P                  4        4       4      # )c              3   L   "   T F  q;'       d    VP                   x  K  	  R # 5ir   )contains_over_clauser   s   & r$   r   6BaseExpression.contains_over_clause.<locals>.<genexpr>  s#      
;X4..T...;Xr   TFr   rL   s   &r$   r   #BaseExpression.contains_over_clause  sO    s 
;?;V;V;X
ss 	
s 	
s 
;?;V;V;X
 
 	
r1   c                    \         ;QJ d*    R  V P                  4        4       F  '       g   K   R# 	  R# ! R  V P                  4        4       4      # )c              3   N   "   T F  pT;'       d    VP                   x  K  	  R # 5ir   )contains_column_referencesr   s   & r$   r   <BaseExpression.contains_column_references.<locals>.<genexpr>  s(      
5 44T4445s   %%TFr   rL   s   &r$   r   )BaseExpression.contains_column_references	  O    s 
335
ss 	
s 	
s 
335
 
 	
r1   c                    \         ;QJ d*    R  V P                  4        4       F  '       g   K   R# 	  R# ! R  V P                  4        4       4      # )c              3   x   "   T F0  pT;'       d"    \        VR R4      ;'       g    VP                  x  K2  	  R# 5i)subqueryFN)rs   contains_subqueryr   s   & r$   r   3BaseExpression.contains_subquery.<locals>.<genexpr>  s9      
5 QQgdJ6PP$:P:PQ5s   :::TFr   rL   s   &r$   r    BaseExpression.contains_subquery  r   r1   c           
        V P                  4       pWFn        VP                  4        Uu. uF  pVe   VP                  WW4V4      MRNK  	  ppV P                  '       g]   \
        ;QJ d    R V 4       F  '       g   K   RM	  RM! R V 4       4      '       d#   \        V P                  P                   R24      hVP                  V4       V# u upi )a  
Provide the chance to do any preprocessing or validation before being
added to the query.

Arguments:
 * query: the backend query implementation
 * allow_joins: boolean allowing or denying use of joins
   in this query
 * reuse: a set of reusable joins for multijoins
 * summarize: a terminal aggregate clause
 * for_save: whether this expression about to be used in a save or
   update

Return: an Expression to be added to the query.
Nc              3   B   "   T F  p\        V\        4      x  K  	  R # 5ir   )r   ColPairsr   s   & r$   r   4BaseExpression.resolve_expression.<locals>.<genexpr>3  s      9
3E4JtX&&3E   TFz4 expression does not support composite primary keys.)
r   
is_summaryr   r>   allows_composite_expressionsr   
ValueError	__class__r(   r   )	r   queryallow_joinsreuse	summarizefor_savecr   source_expressionss	   &&&&&&   r$   r>   !BaseExpression.resolve_expression  s    $ IIK  002
 3 # ''EhW 3 	 
 000SS 9
3E9
SSS 9
3E9
 6
 6
 >>**+ ,* *  	
  !34!
s   "Cc                J    \        V P                  \        P                  4      # r   )r   r   r   BooleanFieldrL   s   &r$   rp   BaseExpression.conditional=  s    $++V-@-@AAr1   c                    V P                   # r   r   rL   s   &r$   fieldBaseExpression.fieldA  s       r1   c                D    V P                  4       pVf   \        R4      hV# )z+Return the output type of this expressions.z4Cannot resolve expression type, unknown output_field)_resolve_output_fieldr   r   s   & r$   r   BaseExpression.output_fieldE  s0     113(F  r1   c                @     V P                   #   \         d     R# i ; i)zn
Return the output field of this expression, or None if
_resolve_output_field() didn't return an output type.
N)r   r   rL   s   &r$   _output_field_or_none$BaseExpression._output_field_or_noneO  s%    	$$$% 		s    c           	     
   R V P                  4        4       pV Fe  pV FZ  p\        W#P                  4      '       d   K   \        RVP                  P                  : RVP                  P                  : R24      h	  Vu # 	  R# )aE  
Attempt to infer the output type of the expression.

As a guess, if the output fields of all source fields match then simply
infer the same type here.

If a source's output field resolves to None, exclude it from this
check. If all sources are None, then an error is raised higher up the
stack in the output_field property.
c              3   0   "   T F  qf   K  Vx  K  	  R # 5ir   r'   )r   sources   & r$   r   7BaseExpression._resolve_output_field.<locals>.<genexpr>h  s      
!9vFF!9s   
z!Expression contains mixed types: , . You must set output_field.N)get_source_fieldsr   r  r   r(   )r   sources_iterr   r  s   &   r$   r  $BaseExpression._resolve_output_fieldZ  s{    
!%!7!7!9
 )L&!,0@0@AA$ )22;;",,55	  '   )r1   c                    V # r   r'   value
expressionr   s   &&&r$   r   "BaseExpression._convert_value_noopx  s    r1   c                    V P                   pVP                  4       pVR8X  d   R # VP                  R4      '       d   R # VR8X  d   R # V P                  # )z
Expressions provide their own converters because users have the option
of manually specifying the output_field which may be a different type
from the one the database returns.

FloatFieldc                 $    V f   R # \        V 4      # r   )floatr&  s   &&&r$   <lambda>.BaseExpression.convert_value.<locals>.<lambda>  s    75<7r1   IntegerFieldc                 $    V f   R # \        V 4      # r   )intr&  s   &&&r$   r.  r/    s    53u:5r1   r   c                 $    V f   R # \        V 4      # r   r   r&  s   &&&r$   r.  r/    s    975>9r1   )r   r   endswithr   )r   r  internal_types   &  r$   r   BaseExpression.convert_value|  sn     !!//1L(  ##N33  n,  '''r1   c                8    V P                   P                  V4      # r   )r   
get_lookup)r   lookups   &&r$   r8  BaseExpression.get_lookup  s      ++F33r1   c                8    V P                   P                  V4      # r   )r   get_transformr   names   &&r$   r<  BaseExpression.get_transform  s      ..t44r1   c                    V P                  4       pTP                  V P                  4        Uu. uF  pVe   VP                  V4      MR NK  	  up4       V# u upi r   )r   r   r   relabeled_clone)r   
change_mapclonees   &&  r$   rA  BaseExpression.relabeled_clone  sa    		$$ 4466A 23!!*-DH6	
 s    Ac                   V'       g   V # VP                  V 4      ;p'       d   V# V P                  4       ;p'       g   V # V P                  4       pTP                  V Uu. uF  pVf   R MVP	                  V4      NK  	  up4       V# u upi r   )getr   r   r   replace_expressions)r   replacementsreplacementr  rC  r   s   &&    r$   rH  "BaseExpression.replace_expressions  s    K&**400;0&*&A&A&CC"CK		$$ /.D $*B*B<*PP.	
 s    Bc                    \        4       pV P                  4        F  pVf   K	  WP                  4       ,          pK!  	  V# r   )setr   get_refs)r   refsr   s   &  r$   rN  BaseExpression.get_refs  s9    u//1D|MMO#D 2 r1   c                .    \         P                   ! V 4      # r   r   rL   s   &r$   r   BaseExpression.copy      yyr1   c           	     
   V P                  4       pTP                  V P                  4        Uu. uFC  p\        V\        4      '       d   \	        V VP
                   24      MVP                  V4      NKE  	  up4       V# u upi r   )r   r   r   r   r   r>  prefix_references)r   prefixrC  r   s   &&  r$   rV   BaseExpression.prefix_references  s    		$$ !779 :D "$** ,-//78 :		
 s   A	B c                    V P                   '       g   V .# . pV P                  4        F"  pVP                  VP                  4       4       K$  	  V# r   )r   r   extendget_group_by_colsr   colsr  s   &  r$   r[   BaseExpression.get_group_by_cols  sG    &&&6M113FKK0023 4r1   c                ^    V P                  4        Uu. uF  qP                  NK  	  up# u upi )z9Return the underlying field types used by this aggregate.)r   r  )r   rD  s   & r$   r"   BaseExpression.get_source_fields  s)    151L1L1NO1NA''1NOOOs   *c                    \        V 3/ VB # r   OrderByr   kwargss   &,r$   ascBaseExpression.asc      t&v&&r1   c                    \        V 3R R/VB # 
descendingTrb  rd  s   &,r$   descBaseExpression.desc      t7777r1   c                    V # r   r'   rL   s   &r$   reverse_orderingBaseExpression.reverse_ordering      r1   c              #     "   V x  V P                  4        F=  pV'       g   K  \        VR4      '       d   VP                  4        Rj  xL
  K9  Vx  K?  	  R#  L5i)zQ
Recursively yield this expression and all subexpressions, in
depth-first order.
flattenN)r   r?   rt  )r   r   s   & r$   rt  BaseExpression.flatten  sJ     
 
//1Dt4++#||~--J 2 .s   A%A	A
Ac                x    \        V P                  R4      '       d   V P                  P                  WV4      # W#3# )zn
Custom format for select clauses. For example, EXISTS expressions need
to be wrapped in CASE WHEN on Oracle.
select_format)r?   r   rw  r   r    r"   r#   s   &&&&r$   rw  BaseExpression.select_format  s8    
 4$$o66$$228&II{r1   c                    \        V R R4      '       g    V P                  4       w  pV# V #   \         d   p\        R4      ThRp?ii ; i) constraint_validation_compatibleTzdExpressions with constraint_validation_compatible set to False must have only one source expression.N)rs   r   r  )r   r(  rD  s   &  r$   get_expression_for_validation,BaseExpression.get_expression_for_validation  s_     t?FF" $ ; ; = "!   < s   + AAAr   r   NTNFF)5r(   r)   r*   r+   r,   NotImplementedempty_result_set_valuer  
filterablewindow_compatibleallowed_defaultr{  set_returningr  r   r   r   r   r   r   r   r   r   r   r   r   r>   propertyrp   r  r   r  r  staticmethodr   r   r8  r<  rA  rH  rN  r   rV  r[  r"  rf  rl  rp  rt  rw  r|  r-   r.   r/   s   @r$   r   r      s~    /+JJO'+$M#( -
<
H8 
 

 
 

 
 
 
 
$L B B ! !     <   ( (,45 P'8 r1   r   c                      a  ] tR tRt o Rt]]P                  ! ^R7      R 4       4       t]	R 4       t
]R 4       tR tR tR	tV tR
# )
Expressioni  z:An expression that can be combined with other expressions.maxsizec                B    \         P                  ! V P                  4      # r   )inspect	signaturer   )clss   &r$   _constructor_signature!Expression._constructor_signature  s       ..r1   c                B  a  \        V\        4      '       d    \        \        S P                  V4      4      # \        V\        4      '       dO   \        ;QJ d%    . V 3R  lVP                  4        4       F  NK  	  5# ! V 3R  lVP                  4        4       4      # \        V\        P                  4      '       d\   VP                  '       d?   VP                  '       d-   VP                  P                  P                  VP                  3# \        V4      # \        V4      # )c              3   N   <"   T F  w  rVSP                  V4      3x  K  	  R # 5ir   )	_identity)r   keyvalr  s   &  r$   r   'Expression._identity.<locals>.<genexpr>  s!     Q=xs#s}}S12=s   "%)r   tuplemapr  dictitemsr   Fieldr>  model_metalabeltyper   )r  r'  s   f&r$   r  Expression._identity  s    eU##S]]E233eT""5Q5;;=Q5Q5Q5;;=QQQeV\\**zzzekkk{{((..

::;U##r1   c                f   V P                   w  rV P                  P                  ! V .VO5/ VB pVP                  4        \	        VP
                  P                  4       4      p\        V4       V P                  .pV F(  w  rgV P                  V4      pVP                  Wg34       K*  	  \        V4      # r   )_constructor_argsr  bind_partialapply_defaultsiter	argumentsr  nextr  r  appendr  )r   argsre  r  r  identityr   r'  s   &       r$   r  Expression.identity  s    --//<<TSDSFS	  ",,2245	YNN##JC NN5)EOOSL) $ Xr1   c                l    \        V\        4      '       g   \        # VP                  V P                  8H  # r   )r   r  r  r  rS   s   &&r$   __eq__Expression.__eq__,  s(    %,,!!~~..r1   c                ,    \        V P                  4      # r   )hashr  rL   s   &r$   __hash__Expression.__hash__1  s    DMM""r1   r'   N)r(   r)   r*   r+   r,   r   	functools	lru_cacher  classmethodr  r   r  r  r  r-   r.   r/   s   @r$   r  r    sd     D%/ & / 	$ 	$  /
# #r1   r  c              3   D   "   T F  pV\         V3\         W3.x  K  	  R # 5ir   r   )r   
field_types   & r$   r   r     s,       #J h
3h
5WX#s    c                B    \         V,          P                  WV34       R# )z
Register combinable types:
    lhs <connector> rhs -> result
e.g.
    register_combinable_fields(
        IntegerField, Combinable.ADD, FloatField, FloatField
    )
N)_connector_combinatorsr  )lhsrC   rhsresults   &&&&r$   register_combinable_fieldsr    s     9%,,c-?@r1   r  c                     \         P                  V R4      pV F.  w  rEp\        W4      '       g   K  \        W%4      '       g   K,  Vu # 	  R # )Nr'   )r  rG  
issubclass)rC   lhs_typerhs_typecombinatorscombinator_lhs_typecombinator_rhs_typecombined_types   &&&    r$   _resolve_combined_typer    sH    (,,Y;KCN?-h44:
 :
 ! 	 DOr1   c                   z   a a ] tR tRt oRV 3R lltR tR tR tR tR t	R t
RV 3R	 llt]R
 4       tRtVtV ;t# )rA   i  c                L   < \         SV `  VR 7       W n        Wn        W0n        R# r   N)superr   rC   r  r  )r   r  rC   r  r   r  s   &&&&&r$   r   CombinedExpression.__init__  s"    l3"r1   c                N    R P                  V P                  P                  V 4      # )z<{}: {}>)formatr  r(   rL   s   &r$   __repr__CombinedExpression.__repr__  s      !8!8$??r1   c                d    R P                  V P                  V P                  V P                  4      # )z{} {} {})r  r  rC   r  rL   s   &r$   __str__CombinedExpression.__str__  s#      4>>488DDr1   c                2    V P                   V P                  .# r   r  r  rL   s   &r$   r   )CombinedExpression.get_source_expressions  s    $((##r1   c                $    Vw  V n         V n        R # r   r  r   s   &&r$   r   )CombinedExpression.set_source_expressions  s    "$(r1   c           	        \        V P                  \        V P                  P                  4      \        V P
                  P                  4      4      pVfq   \        RV P                  : RV P                  P                  P                  P                   RV P
                  P                  P                  P                   R24      hV! 4       # )NzCannot infer type of z# expression involving these types: r   r!  )
r  rC   r  r  r  r  r   r   r  r(   )r   r  s   & r$   r  (CombinedExpression._resolve_output_field  s     /NN//0//0

  ''9 :((//99BBC288((22;;< = !  r1   c                j   . p. pVP                  V P                  4      w  rVVP                  V4       VP                  V4       VP                  V P                  4      w  rVVP                  V4       VP                  V4       R pVP
                  P                  V P                  V4      pWu,          V3# z(%s))compiler  r  rZ  r  opscombine_expressionrC   )r   r    r   r   expression_paramsr"   r#   expression_wrappers   &&&     r$   r   CombinedExpression.as_sql  s    &&txx03  (&&txx03  (#nn//L!'):::r1   c                f  < \         S
V `  VVVVV4      p\        V \        \        34      '       g    VP
                  P                  P                  4       p VP                  P                  P                  4       pRWx09   d2   Wx8w  d,   \        VP
                  VP                  VP                  4      # 0 Rmp	V P                  V P                  8X  d-   Wy9   d'   Wx8X  d!   \	        VP
                  VP                  4      # V#   \        \        3 d    R p Li ; i  \        \        3 d    R p Li ; i)NDurationField>   	DateField	TimeFieldDateTimeField)r  r>   r   DurationExpressionTemporalSubtractionr  r   r   AttributeErrorr   r  rC   rY   )r   r  r	  r
  r  r  resolvedr  r  datetime_fieldsr  s   &&&&&&    r$   r>   %CombinedExpression.resolve_expression  s    7-
 $!35H IJJ #<<44FFH #<<44FFH 8"668;O)LL("4"4hll  JO$((*/(*8<<FF# #J/    #J/   s#   $D $D DDD0/D0c                j    V P                   P                  ;'       d    V P                  P                  # r   )r  r  r  rL   s   &r$   r  "CombinedExpression.allowed_default&  s$    xx''DDDHH,D,DDr1   )rC   r  r  r   r~  )r(   r)   r*   r+   r   r  r  r   r   r  r   r>   r   r  r-   r.   __classcell__r  r0   s   @@r$   rA   rA     sL     @E$#";@ E E Er1   rA   c                   >   a a ] tR tRt oR tV 3R ltR tRtVtV ;t	# )r  i+  c                     VP                   pVP                  4       R 8X  d1   VP                  V4      w  rVVP                  P	                  V4      V3#  VP                  V4      #   \
         d     Li ; i)r  )r   r   r  r  format_for_duration_arithmeticr   )r   sider    r   outputr"   r#   s   &&&&   r$   r  DurationExpression.compile,  s~    	R&&F '')_<&..t4!~~DDSI6QQ = %%  		s   A% %A32A3c                  < VP                   P                  '       d   \        SV `  W4      # VP                  P                  V 4       . p. pV P                  V P                  W4      w  rVVP                  V4       VP                  V4       V P                  V P                  W4      w  rVVP                  V4       VP                  V4       R pVP                  P                  V P                  V4      pWu,          V3# r  )featureshas_native_duration_fieldr  r   r  check_expression_supportr  r  r  rZ  r  combine_duration_expressionrC   )	r   r    r   r   r  r"   r#   r  r  s	   &&&     r$   r   DurationExpression.as_sql7  s    8887>(77//5ll488XB3  (ll488XB3  (#nn88U!'):::r1   c                   V P                   ! W3/ VB w  rEV P                  \        P                  \        P                  09   dw    V P
                  P                  P                  4       pV P                  P                  P                  4       p0 RmpWh9  g   Wx9  d   \        RV P                   R24      h WE3# WE3#   \        \        3 d     YE3# i ; i)r   zInvalid arguments for operator .>   r+  r   r0  r  )r   rC   r3   rK   ra   r  r   r   r  r   r  r   )	r   r    r   r!   r"   r#   r  r  allowed_fieldss	   &&&,     r$   r%   DurationExpression.as_sqliteH  s    kk(H-H>>jnnjnn==8800BBD8800BBD" 1X5S'9$..9IK  6T {s{ #J/  {s   AB> >CCr'   )
r(   r)   r*   r+   r  r   r%   r-   r.   r  r  s   @@r$   r  r  +  s     	&;" r1   r  c                   Z   a a ] tR tRt o]P
                  ! 4       tV 3R ltR tRt	Vt
V ;t# )r  i^  c                <   < \         SV `  WP                  V4       R # r   )r  r   rY   )r   r  r  r  s   &&&r$   r   TemporalSubtraction.__init__a  s    hh,r1   c                    VP                   P                  V 4       VP                  V P                  4      pVP                  V P                  4      pVP                   P                  V P                  P                  P                  4       W44      # r   )r  r  r  r  r  subtract_temporalsr   r   )r   r    r   r  r  s   &&&  r$   r   TemporalSubtraction.as_sqld  sk    //5txx(txx(~~00HH!!335s
 	
r1   r'   )r(   r)   r*   r+   r   r  r   r   r   r-   r.   r  r  s   @@r$   r  r  ^  s"     '')L-
 
r1   r  zdjango.db.models.F)pathc                   n   a  ] tR tRt o RtRtR tR tR tR t	RR	 lt
R
 tR tR tR tR tR tRtV tR# )r   im  zDAn object capable of resolving references to existing query objects.Fc                    Wn         R# )zF
Arguments:
 * name: the name of the field this expression references
Nr>  r=  s   &&r$   r   
F.__init__s  s	    
 	r1   c                b    R P                  V P                  P                  V P                  4      # {}({}))r  r  r(   r>  rL   s   &r$   r  
F.__repr__z  s!    t~~66		BBr1   c                    \        W4      # r   )Sliced)r   	subscripts   &&r$   __getitem__F.__getitem__}  s    d&&r1   c                H    \        R V P                  P                   R24      h)zargument of type 'z' is not iterable)	TypeErrorr  r(   rS   s   &&r$   __contains__F.__contains__  s%     ,T^^-D-D,EEVWXXr1   Nc                <    VP                  V P                  W#V4      # r   )resolve_refr>  r   r  r	  r
  r  r  s   &&&&&&r$   r>   F.resolve_expression  s       K	JJr1   c                :   VP                  V 4      ;pe   V# V P                  P                  \        4      vr4V'       g   V # VP                  \	        V4      4      ;p e   VP
                  f   V # V F$  pVP                  V4      pVf   V u # V! V4      pK&  	  V# r   )rG  r>  splitr   r   r  r<  )r   rI  rJ  
field_name
transforms	transformtransform_classs   &&     r$   rH  F.replace_expressions  s    '++D11K>"&))//*"=
 K'++AjM::K 66>K#I)77	BO&)+6K	 $
 r1   c                    \        V 3/ VB # r   rb  rd  s   &,r$   rf  F.asc  rh  r1   c                    \        V 3R R/VB # rj  rb  rd  s   &,r$   rl  F.desc  rn  r1   c                v    V P                   VP                   8H  ;'       d    V P                  VP                  8H  # r   )r  r>  rS   s   &&r$   r  F.__eq__  s*    ~~0LLTYY%**5LLr1   c                ,    \        V P                  4      # r   )r  r>  rL   s   &r$   r  
F.__hash__  s    DIIr1   c                .    \         P                   ! V 4      # r   rR  rL   s   &r$   r   F.copy  rT  r1   r
  r~  )r(   r)   r*   r+   r,   r  r   r  r  r  r>   rH  rf  rl  r  r  r   r-   r.   r/   s   @r$   r   r   m  sM     NOC'Y
K
('8M r1   r   c                   P   a a ] tR tRt oRtRtRtR tV 3R ltR t	R t
RtVtV ;t# )	ResolvedOuterRefi  z
An object that contains a reference to an outer query.

In this case, the reference to the outer query has been resolved because
the inner query has been used as a subquery.
Fc                    \        R 4      h)zXThis queryset contains a reference to an outer query and may only be used in a subquery.)r  r   r  re  s   &*,r$   r   ResolvedOuterRef.as_sql  s    *
 	
r1   c                   < \         SV `  ! V/ VB pVP                  '       d   \        R V P                   R24      h\
        V P                  9   Vn        V# )z<Referencing outer query window expression is not supported: r  )r  r>   r   r   r>  r   possibly_multivalued)r   r  re  colr  s   &*, r$   r>   #ResolvedOuterRef.resolve_expression  s[    g($9&9####N99+Q   $.#: 
r1   c                    V # r   r'   r   relabelss   &&r$   rA   ResolvedOuterRef.relabeled_clone  rr  r1   c                    . # r   r'   rL   s   &r$   r[  "ResolvedOuterRef.get_group_by_cols  r   r1   r'   )r(   r)   r*   r+   r,   r   r   r   r>   rA  r[  r-   r.   r  r  s   @@r$   r/  r/    s1       
 r1   r/  c                   4   a  ] tR tRt o RtRtR tR tRtV t	R# )OuterRefi  Fc                    \        V P                  V P                  4      '       d   V P                  # \        V P                  4      # r   )r   r>  r  r/  r1  s   &*,r$   r>   OuterRef.resolve_expression  s0    dii0099		**r1   c                    V # r   r'   r8  s   &&r$   rA  OuterRef.relabeled_clone  rr  r1   r'   N)
r(   r)   r*   r+   r   r   r>   rA  r-   r.   r/   s   @r$   r>  r>    s       +
 r1   r>  c                   F   a a ] tR tRt oRtV 3R ltR tRR ltRtVt	V ;t
# )r  i  z
An object that contains a slice of an F expression.

Object resolves the column on which the slicing is applied, and then
applies the slicing if possible.
c                6  < \         SV `  VP                  4       Wn        \	        V\
        4      '       d*   V^ 8  d   \        R4      hV^,           V n        ^V n        R# \	        V\        4      '       Ed   VP                  e   VP                  ^ 8  g    VP                  e   VP                  ^ 8  d   \        R4      hVP                  e   \        R4      hVP                  '       d9   VP                  '       d'   VP                  VP                  8  d   \        R4      hVP                  f   ^MVP                  ^,           V n        VP                  f
   RV n        R# VP                  VP                  ;'       g    ^ ,
          V n        R# \        R4      h)r   z#Negative indexing is not supported.NzStep argument is not supported.z,Slice stop must be greater than slice start.z7Argument to slice must be either int or slice instance.)r  r   r>  objr   r2  r  startlengthslicestopstepr  )r   rE  r  r  s   &&&r$   r   Sliced.__init__  s$   "i%%1} !FGG"QDJDK	5))+	!0C*y~~/A !FGG~~) !BCC~~~)///inny6V !OPP'oo59??Q;NDJ~~%"'nn	0D0D1EUVVr1   c                    V P                   ^,
          pV P                  f   RMWP                  ,           p\        W4      pV P                  P                   RV P
                  : RV: R2# )rH   N(r   ))rF  rG  rH  r  r*   rE  )r   rF  rI  r  s   &   r$   r  Sliced.__repr__  sX    

Q{{*t0C%&	..--.a|2i]!LLr1   c                4   VP                  V P                  W#V4      p\        V P                  \        V P
                  34      '       d   V P                  P                  WW4V4      pMTpVP                  P                  WpP                  V P                  4      # r   )r  r>  r   rE  r>  r  r>   r   slice_expressionrF  rG  )r   r  r	  r
  r  r  r  r   s   &&&&&&  r$   r>   Sliced.resolve_expression  sy     $$TYYINdhh4>> :;;88..EhD D$$55dJJTTr1   )rG  rE  rF  r~  )r(   r)   r*   r+   r,   r   r  r>   r-   r.   r  r  s   @@r$   r  r    s"     W2MU Ur1   r  zdjango.db.models.Funcc                      a a ] tR tRt oRtRtRtRtRtRR/V 3R llt	R t
R	 tR
 tR tRR ltV 3R lt]R 4       tRtVtV ;t# )Funci  zAn SQL function call.Nz%(function)s(%(expressions)s)r   r   c               Z  < V P                   eq   \        V4      V P                   8w  dW   \        RV P                  P                  : RV P                   : RV P                   ^8X  d   RMR: R\        V4      : R2	4      h\
        SV `  VR7       V P                  ! V!  V n        W0n	        R # )	N'z' takes exactly  argumentr  z (z given)r   )
aritylenr  r  r(   r  r   r   r  extra)r   r   r   r[  r  s   &$*,r$   r   Func.__init__"  s    ::!c+&6$**&D NN++JJ"&**/J{B$  	l3"&"9"9;"G
r1   c                   V P                   P                  R  V P                   4       4      p/ V P                  CV P	                  4       CpV'       dV   RP                  R \        VP                  4       4       4       4      pRP                  V P                  P                  W4      # RP                  V P                  P                  V4      # )c              3   8   "   T F  p\        V4      x  K  	  R # 5ir   r   r   r   s   & r$   r    Func.__repr__.<locals>.<genexpr>2       #P8OCHH8O   r   c              3   j   "   T F)  w  r\        V4      R ,           \        V4      ,           x  K+  	  R# 5i)=Nr_  )r   r  r  s   &  r$   r   ra  5  s*      :OhcC3S)):Os   13
{}({}, {})r  )

arg_joinerjoinr  r[  _get_repr_optionssortedr  r  r  r(   )r   r  r[  s   &  r$   r  Func.__repr__1  s    ###P8O8O#PP:4:::!7!7!9:II :@:O E  &&t~~'>'>LLt~~66==r1   c                    / # )zAReturn a dict of extra __init__() options to include in the repr.r'   rL   s   &r$   ri  Func._get_repr_options;  s    	r1   c                    V P                   # r   r  rL   s   &r$   r   Func.get_source_expressions?  s    &&&r1   c                    Wn         R # r   ro  r   s   &&r$   r   Func.set_source_expressionsB  s    "'r1   c                   VP                   P                  V 4       . p. pV P                   F9  p	 VP                  V	4      w  rVP                  V
4       VP                  V4       K;  	  / V P                  CVCpVe   W=R&   MVP                  RV P                  4       T;'       g    VP                  RV P                  4      pT;'       g    VP                  RV P                   4      pVP#                  V4      ;VR&   VR&   WM,          \%        V4      3#   \         d=    \        T	R \        4      pT\        J d   h TP                  \        T4      4      w  r EL\         d!    TP                  \        R4      4      w  r ELBi ; i)r  Tfunctiontemplaterg  r   r  )r  r  r  r  r   rs   r  r@   r   r  rZ  r[  
setdefaultrt  rG  ru  rg  rh  r  )r   r    r   rt  ru  rg  r!   	sql_partsr#   r   arg_sql
arg_paramsr  datas   &&&&&&,       r$   r   Func.as_sqlE  sq    	//5	**C
D&.&6&6s&;# W%MM*% + /$**.. 'OOJ6BBtxx
DMMBJJ488L$//#J
.8ooi.HH]d7mf--- " V)01>*& *^;&.&6&6u=S7T&U#  D&.&6&6uT{&C#Ds   DAFF%FFc                   < \         SV `  4       pV P                  R ,          Vn        V P                  P                  4       Vn        V# :NNN)r  r   r  r[  )r   r   r  s   & r$   r   	Func.copyl  s8    w|~"&"9"9!"<ZZ__&
r1   c                    \         ;QJ d&    R  V P                   4       F  '       d   K   R# 	  R# ! R  V P                   4       4      # )c              3   8   "   T F  qP                   x  K  	  R # 5ir   r  )r   r(  s   & r$   r   'Func.allowed_default.<locals>.<genexpr>t  s     X@W*--@Wrc  FT)allr  rL   s   &r$   r  Func.allowed_defaultr  s7    sX@W@WXssXsXsX@W@WXXXr1   )r[  r  NNN)r(   r)   r*   r+   r,   rt  ru  rg  rY  r   r  ri  r   r   r   r   r   r  r-   r.   r  r  s   @@r$   rT  rT    sc     H.HJE$ >'(%.N Y Y Yr1   rT  zdjango.db.models.Valuec                   z   a a ] tR tRt oRtRtRtRV 3R lltR tR t	RV 3R llt
R	 tR
 t]R 4       tRtVtV ;t# )r@   iw  z9Represent a wrapped value as a node within an expression.FTc                4   < \         SV `  VR7       Wn        R# )a
  
Arguments:
 * value: the value this expression represents. The value will be
   added into the sql parameter list and properly quoted.

 * output_field: an instance of the model field type that this
   expression will return, such as IntegerField() or CharField().
r   N)r  r   r'  )r   r'  r   r  s   &&&r$   r   Value.__init__  s     	l3
r1   c                P    V P                   P                   R V P                  : R2# )rM  rN  )r  r(   r'  rL   s   &r$   r  Value.__repr__  s$    ..))*!DJJ>;;r1   c                F   VP                   P                  V 4       V P                  pV P                  pVe_   V P                  '       d   VP                  W2R7      pMVP                  W2R7      p\        VR4      '       d   VP                  W1V4      V.3# Vf   R. 3# RV.3# )N)r   get_placeholderNULLz%s)	r  r  r'  r  r  get_db_prep_saveget_db_prep_valuer?   r  )r   r    r   r  r   s   &&&  r$   r   Value.as_sql  s    //5jj11#}}}"33C3O"44S4P|%677#33C:NQTPUUU; 2:cU{r1   c                6   < \         SV `  WW4V4      pWVn        V# r   )r  r>   r  r   r  r	  r
  r  r  r  r  s   &&&&&& r$   r>   Value.resolve_expression  s"     G&u5XV
r1   c                    . # r   r'   rL   s   &r$   r[  Value.get_group_by_cols  r   r1   c                   \        V P                  \        4      '       d   \        P                  ! 4       # \        V P                  \
        4      '       d   \        P                  ! 4       # \        V P                  \        4      '       d   \        P                  ! 4       # \        V P                  \        4      '       d   \        P                  ! 4       # \        V P                  \        P                  4      '       d   \        P                  ! 4       # \        V P                  \        P                  4      '       d   \        P                  ! 4       # \        V P                  \        P                  4      '       d   \        P                   ! 4       # \        V P                  \        P"                  4      '       d   \        P$                  ! 4       # \        V P                  \&        4      '       d   \        P(                  ! 4       # \        V P                  \*        4      '       d   \        P,                  ! 4       # \        V P                  \.        4      '       d   \        P0                  ! 4       # R # r   )r   r'  r   r   	CharFieldboolr  r2  r0  r-  r+  datetimer  dater  timer  	timedeltar  r   r   bytesBinaryFieldr
   	UUIDFieldrL   s   &r$   r  Value._resolve_output_field  s{   djj#&&##%%djj$''&&((djj#&&&&((djj%(($$&&djj("3"344''))djj(--00##%%djj(--00##%%djj("4"455''))djj'**&&((djj%((%%''djj$''##%% (r1   c                    V P                   # r   r'  rL   s   &r$   r  Value.empty_result_set_value  s    zzr1   r  r   r~  )r(   r)   r*   r+   r,   r  r  r   r  r   r>   r[  r  r  r  r-   r.   r  r  s   @@r$   r@   r@   w  sK     C HO
<$&0   r1   r@   c                   \   a a ] tR tRt oRtR	V 3R lltR tR tR tR
V 3R llt	Rt
VtV ;t# )RawSQLi  Tc                v   < Vf   \         P                  ! 4       pWuV n        V n        \        SV `  VR7       R # Nr   )r   r  r"   r#   r  r   )r   r"   r#   r   r  s   &&&&r$   r   RawSQL.__init__  s2    !<<>L #$+l3r1   c                x    R P                  V P                  P                  V P                  V P                  4      # rf  )r  r  r(   r"   r#   rL   s   &r$   r  RawSQL.__repr__  s)    ""4>>#:#:DHHdkkRRr1   c                @    R V P                   ,          V P                  3# r  )r"   r#   r   s   &&&r$   r   RawSQL.as_sql  s     $++--r1   c                    V .# r   r'   rL   s   &r$   r[  RawSQL.get_group_by_cols  	    vr1   c                  < VP                   '       d   VP                   P                  P                   Fw  pVP                  P                   FZ  pVP                  P                  4       V P                  P                  4       9   g   K<  VP                  VP                  W#V4        Ku  	  Ky  	  \        SV `)  WW4V4      # r   )r  r  all_parentslocal_fieldscolumnlowerr"   r  r>  r  r>   )	r   r  r	  r
  r  r  parentparent_fieldr  s	   &&&&&&  r$   r>   RawSQL.resolve_expression  s     ;;;++++77$*LL$=$=L#**002dhhnn6FF))(--{9  %> 8 w)(
 	
r1   )r#   r"   r   r~  )r(   r)   r*   r+   r  r   r  r   r[  r>   r-   r.   r  r  s   @@r$   r  r    s)     O4S.
 
r1   r  c                   ,   a  ] tR tRt o R tR tRtV tR# )Stari  c                    R # )z'*'r'   rL   s   &r$   r  Star.__repr__  s    r1   c                
    R . 3# )r6   r'   r   s   &&&r$   r   Star.as_sql  s    Bwr1   r'   N)r(   r)   r*   r+   r  r   r-   r.   r/   s   @r$   r  r    s      r1   r  c                   V   a a ] tR tRt oRtR	V 3R lltR tR tR
R ltR t	Rt
VtV ;t# )DatabaseDefaulti  zV
Expression to use DEFAULT keyword during insert otherwise the underlying
expression.
c                2   < \         SV `  V4       Wn        R # r   r  r   r(  r   r(  r   r  s   &&&r$   r   DatabaseDefault.__init__  s    &$r1   c                    V P                   .# r   r(  rL   s   &r$   r   &DatabaseDefault.get_source_expressions        r1   c                    Vw  V n         R # r   r  r   s   &&r$   r   &DatabaseDefault.set_source_expressions   s    "r1   c                    V P                   P                  VVVVVR 7      pV'       g   V# \        W`P                  R7      # ))r  r	  r
  r  r  r   )r(  r>   r  r  )r   r  r	  r
  r  r  resolved_expressions   &&&&&& r$   r>   "DatabaseDefault.resolve_expression  sO     #oo@@# A 
 &&.H.H
 	
r1   c                x    VP                   P                  '       g   VP                  V P                  4      # R . 3# )DEFAULT)r  "supports_default_keyword_in_insertr  r(  r   s   &&&r$   r   DatabaseDefault.as_sql  s3    ""EEE##DOO44"}r1   r  r   r~  )r(   r)   r*   r+   r,   r   r   r   r>   r   r-   r.   r  r  s   @@r$   r  r    s(     
%!#
$ r1   r  c                   \   a a ] tR tRt oRtRtRV 3R lltR tR tR t	R t
R	 tR
tVtV ;t# )Coli  TFc                P   < Vf   Tp\         SV `  VR7       WuV n        V n        R # r  )r  r   aliastarget)r   r  r  r   r  s   &&&&r$   r   Col.__init__  s,    !Ll3"'
DKr1   c                    V P                   V P                  r!V'       d   V\        V4      3M\        V4      3pR P                  V P                  P
                  RP                  V4      4      # )r  r   )r  r  r   r  r  r(   rh  )r   r  r  identifierss   &   r$   r  Col.__repr__%  sM    

DKKv.3uc&k*#f+t~~66		+8NOOr1   c                    V P                   V P                  P                  rCV'       d   W43MV3pR P                  \	        VP
                  V4      4      pVR3# )r  r'   )r  r  r  rh  r  quote_name_unless_alias)r   r    r   r  r  r  r"   s   &&&    r$   r   
Col.as_sql*  sH    

DKK$6$6v).uoVIhhs8;;[IJBwr1   c                    V P                   f   V # V P                  VP                  V P                   V P                   4      V P                  V P                  4      # r   )r  r  rG  r  r   r8  s   &&r$   rA  Col.relabeled_clone0  sF    ::K~~LLTZZ0$++t?P?P
 	
r1   c                    V .# r   r'   rL   s   &r$   r[  Col.get_group_by_cols7  r  r1   c                    V P                   V P                  8X  d   V P                  P                  V4      # V P                  P                  V4      V P                   P                  V4      ,           # r   )r  r   r   r   s   &&r$   r   Col.get_db_converters:  s^    ;;$+++$$66zBB  22
KK))*56 	6r1   )r  r  r   )r(   r)   r*   r+   r   r4  r   r  r   rA  r[  r   r-   r.   r  r  s   @@r$   r  r    s5     !% 0P

6 6r1   r  c                   n   a a ] tR tRt oV 3R ltR tR tR tR tR t	R t
R	 tR
 tR tR tRtVtV ;t# )r  iB  c                L   < \         SV `  VR 7       Wn        W n        W0n        R# r  )r  r   r  targetssources)r   r  r  r  r   r  s   &&&&&r$   r   ColPairs.__init__C  s"    l3
r1   c                ,    \        V P                  4      # r   )rZ  r  rL   s   &r$   __len__ColPairs.__len__I  s    4<<  r1   c                4    \        V P                  4       4      # r   )r  get_colsrL   s   &r$   __iter__ColPairs.__iter__L  s    DMMO$$r1   c           
         V P                   P                   R V P                  : RV P                  : RV P                  : RV P
                  : R2
# )rM  r   rN  )r  r(   r  r  r  r   rL   s   &r$   r  ColPairs.__repr__O  sL    ~~&&'qb8H||b!2!2 5Q8	
r1   c           	         \        V P                  V P                  4       UUu. uF  w  r\        V P                  W4      NK  	  upp# u uppi r   )zipr  r  r  r  )r   r  r  s   &  r$   r  ColPairs.get_colsU  sE     #&dllDLL"A
"A 

F+"A
 	
 
s   !A	c                "    V P                  4       # r   )r  rL   s   &r$   r   ColPairs.get_source_expressions[  s    }}r1   c                   a  \         ;QJ d    V 3R  lV 4       F  '       d   K   RM	  RM! V 3R  lV 4       4      '       g   Q hV Uu. uF  q"P                  NK  	  upS n        V Uu. uF  q"P                  NK  	  upS n        R# u upi u upi )c              3      <"   T F6  p\        V\        4      ;'       d    VP                  SP                  8H  x  K8  	  R # 5ir   )r   r  r  )r   r   r   s   & r$   r   2ColPairs.set_source_expressions.<locals>.<genexpr>_  s2     XRW$:dC(EETZZ4::-EERWs
   A"AFTN)r  r  r  r  r  )r   r   r5  s   f& r$   r   ColPairs.set_source_expressions^  sd    sXRWXsssXRWXXXXX.34es

e4-23Uc		U3 53s   B(Bc                    . p. pV P                  4       pV F8  pVP                  W4      w  rxVP                  V4       VP                  V4       K:  	  R P	                  V4      V3# )r   )r  r   r  rZ  rh  )	r   r    r   cols_sqlcols_paramsr]  r5  r"   r#   s	   &&&      r$   r   ColPairs.as_sqlc  sa    }}C**X:KCOOC v& 
 yy"K//r1   c                    V P                  VP                  V P                  V P                  4      V P                  V P                  V P
                  4      # r   )r  rG  r  r  r  r  r8  s   &&r$   rA  ColPairs.relabeled_cloneo  s;    ~~LLTZZ0$,,djj
 	
r1   c                    V # r   r'   r1  s   &*,r$   r>   ColPairs.resolve_expressiont  rr  r1   c                    W#3# r   r'   rx  s   &&&&r$   rw  ColPairs.select_formatw  s
    {r1   )r  r  r  )r(   r)   r*   r+   r   r  r  r  r  r   r   r   rA  r>   rw  r-   r.   r  r  s   @@r$   r  r  B  sA     !%

4

0

 r1   r  c                   j   a a ] tR tRt oRtV 3R ltR tR tR tRR lt	R t
R	 tR
 tR tRtVtV ;t# )Refi{  zr
Reference to column alias of the query. For example, Ref('sum_cost') in
qs.annotate(sum_cost=Sum('cost')) query.
c                @   < \         SV `  4        WuV n        V n        R # r   )r  r   rO  r  )r   rO  r  r  s   &&&r$   r   Ref.__init__  s    !%	4;r1   c                x    R P                  V P                  P                  V P                  V P                  4      # r  )r  r  r(   rO  r  rL   s   &r$   r  Ref.__repr__  s)    ""4>>#:#:DIIt{{SSr1   c                    V P                   .# r   r  rL   s   &r$   r   Ref.get_source_expressions  s    }r1   c                    Vw  V n         R # r   r  r   s   &&r$   r   Ref.set_source_expressions  s    r1   c                    V # r   r'   r  s   &&&&&&r$   r>   Ref.resolve_expression  s	    
 r1   c                    V P                   0# r   )rO  rL   s   &r$   rN  Ref.get_refs  s    		{r1   c                f    V P                  4       pV P                  P                  V4      Vn        V# r   )r   r  rA  )r   r9  rC  s   && r$   rA  Ref.relabeled_clone  s(    		{{228<r1   c                P    VP                   P                  V P                  4      . 3# r   )r  
quote_namerO  r   s   &&&r$   r   
Ref.as_sql  s     ~~((3R77r1   c                    V .# r   r'   rL   s   &r$   r[  Ref.get_group_by_cols  r  r1   )rO  r  r~  )r(   r)   r*   r+   r,   r   r  r   r   r>   rN  rA  r   r[  r-   r.   r  r  s   @@r$   r  r  {  s=     
.T
8 r1   r  c                   L   a a ] tR tRt oRtRtR tV 3R ltR tR t	Rt
VtV ;t# )	ExpressionListi  z
An expression containing multiple expressions. Can be used to provide a
list of expressions as an argument to another expression, like a partition
clause.
z%(expressions)sc                Z    V P                   P                  R  V P                   4       4      # )c              3   8   "   T F  p\        V4      x  K  	  R # 5ir   r_  r`  s   & r$   r   )ExpressionList.__str__.<locals>.<genexpr>  rb  rc  )rg  rh  r  rL   s   &r$   r  ExpressionList.__str__  s#    ###P8O8O#PPPr1   c                L   < V P                   '       g   R# \        SV `  ! V/ VB # ) )r"  r'   )r  r  r   )r   r  re  r  s   &*,r$   r   ExpressionList.as_sql  s(    &&&Mw~t.v..r1   c                (    V P                   ! W3/ VB # r   )r   )r   r    r   r!   s   &&&,r$   r%   ExpressionList.as_sqlite  s    {{8A=AAr1   c                v    . pV P                  4        F"  pVP                  VP                  4       4       K$  	  V# r   r   rZ  r[  )r   group_by_colsr   s   &  r$   r[   ExpressionList.get_group_by_cols  s7    //1D  !7!7!9: 2r1   r'   )r(   r)   r*   r+   r,   ru  r  r   r%   r[  r-   r.   r  r  s   @@r$   r  r    s,      !HQ/
B r1   r  c                   J   a a ] tR tRt oRtRtV 3R lt]R 4       tRt	Vt
V ;t# )OrderByListi  FzORDER BY %(expressions)sc                :   < R  V 4       p\         SV `  ! V/ VB  R# )c              3      "   T FH  p\        V\        4      '       d,   V^ ,          R8X  d   \        \        VR,          4      RR7      MTx  KJ  	  R# 5i)r   r5   :rH   NNTrk  N)r   r   rc  r   r   s   & r$   r   'OrderByList.__init__.<locals>.<genexpr>  sK      
 $ dC((T!W^ $r(5 $s   AAN)r  r   )r   r   r[  r  s   &*,r$   r   OrderByList.__init__  s(    
 $
 	+//r1   c                    Vf   R # \        V\        \        34      '       d   V'       g   R # V ! V!  # \        V\        4      '       g   \	        VR4      '       d	   V ! V4      # \        V RV: R24      h)Nr>   z] must be either a string reference to a field, an expression, or a list or tuple of them not r  )r   listr  r   r?   r  )r  contextparams   &&&r$   
from_paramOrderByList.from_param  st    =edE]++;s##wu6J'K'Ku:i DDI9AO
 	
r1   r'   )r(   r)   r*   r+   r  ru  r   r  r5  r-   r.   r  r  s   @@r$   r+  r+    s-     O)H	0 
 
 
r1   r+  z"django.db.models.ExpressionWrapperc                   j   a a ] tR tRt oRtV 3R ltR tR tV 3R ltR t	R t
]R	 4       tR
tVtV ;t# )ExpressionWrapperi  z
An expression that can wrap another expression so that it can provide
extra context to the inner expression, such as the output_field.
c                4   < \         SV `  VR 7       Wn        R# r  r  r  s   &&&r$   r   ExpressionWrapper.__init__  s    l3$r1   c                "    V^ ,          V n         R# r   Nr  r   s   &&r$   r   (ExpressionWrapper.set_source_expressions      (r1   c                    V P                   .# r   r  rL   s   &r$   r   (ExpressionWrapper.get_source_expressions  r  r1   c                   < \        V P                  \        4      '       d<   V P                  P                  4       pV P                  Vn        VP                  4       # \        SV `  4       # r   )r   r(  r  r   r   r[  r  r   r(  r  s   & r$   r[  #ExpressionWrapper.get_group_by_cols  sS    dooz22--/J&*&7&7J#//11 w(**r1   c                8    VP                  V P                  4      # r   )r  r(  r   s   &&&r$   r   ExpressionWrapper.as_sql  s    00r1   c                b    R P                  V P                  P                  V P                  4      # r  )r  r  r(   r(  rL   s   &r$   r  ExpressionWrapper.__repr__  s!    t~~66HHr1   c                .    V P                   P                  # r   )r(  r  rL   s   &r$   r  !ExpressionWrapper.allowed_default  s    ...r1   r  )r(   r)   r*   r+   r,   r   r   r   r[  r   r  r  r  r-   r.   r  r  s   @@r$   r8  r8    sB     
%#!+1I / / /r1   r8  c                   ^   a a ] tR tRt oRtV 3R ltR tV 3R ltR	V 3R lltR t	Rt
VtV ;t# )
r   i  z1The logical negation of a conditional expression.c                P   < \         SV `  V\        P                  ! 4       R 7       R# r  )r  r   r   r  rB  s   &&r$   r   NegatedExpression.__init__  s    &2E2E2GHr1   c                6    V P                   P                  4       # r   )r(  r   rL   s   &r$   r   NegatedExpression.__invert__
  s    ##%%r1   c                b  <  \         SV `  W4      w  r4TP                  P                  pTP                  T P                  4      '       g	   RT R2T3# RT 2T3#   \         dJ    TP                  P                  pTP
                  '       g   Ru # TP                  \        R4      4      u # i ; i)1=1Tz
CASE WHEN z = 0 THEN 1 ELSE 0 ENDzNOT )rP  r'   )r  r   r   r   r  &supports_boolean_expr_in_select_clauser  r@   r  0conditional_expression_supported_in_where_clauser(  )r   r    r   r"   r#   r  r  r  s   &&&    r$   r   NegatedExpression.as_sql  s    	1'.>KC !!%% CCDOOTTu$:;VCCcU|V##  	1**33HBBB  ##E$K00		1s   A 2B.B.B.-B.c                z   < \         SV `  WW4V4      p\        VP                  R R4      '       g   \	        R4      hV# )rp   Fz*Cannot negate non-conditional expressions.)r  r>   rs   r(  r  )r   r  r	  r
  r  r  r  r  s   &&&&&& r$   r>   $NegatedExpression.resolve_expression  sC     7-(
 x**M5AAHIIr1   c                    VP                   P                  P                  pVP                   P                  P                  '       g*   V! V P
                  4      '       d   R P                  V4      pW#3# zCASE WHEN {} THEN 1 ELSE 0 END)r   r  rR  r  rQ  r(  r  )r   r    r"   r#   $expression_supported_in_where_clauses   &&&& r$   rw  NegatedExpression.select_format'  s_    
 ##TT 	- ##,,SSS4T__EE299#>C{r1   r'   r~  )r(   r)   r*   r+   r,   r   r   r   r>   rw  r-   r.   r  r  s   @@r$   r   r     s'     ;I&$  r1   r   zdjango.db.models.Whenc                      a a ] tR tRt oRtRtRV 3R lltR tR tR t	R t
RV 3R	 lltR
 tRR ltR t]R 4       tRtVtV ;t# )Wheni7  z"WHEN %(condition)s THEN %(result)sFc                  < V'       d2   Vf   \        R/ VB R r1M \        VRR4      '       d   \        V3/ VB R r1Ve   \        VRR4      '       d	   V'       d   \        R4      h\        V\         4      '       d   V'       g   \	        R4      h\
        SV `  R R7       Wn        V P                  V4      ^ ,          V n	        R # )Nrp   FzLWhen() supports a Q object, a boolean expression, or lookups as a condition.z1An empty Q() can't be used as a When() condition.r   r'   )
r   rs   r  r   r  r  r   	conditionr   r  )r   r]  thenlookupsr  s   &&&,r$   r   When.__init__=  s     %&\\47M599%&y%<G%<d7GI}e$L$LPW"  i##IPQQd+"--d3A6r1   c                >    R V P                   : RV P                  : 2# )zWHEN z THEN r]  r  rL   s   &r$   r  When.__str__N  s    $(NNDKK@@r1   c                @    R V P                   P                  : RV : R2# <z: >r  r(   rL   s   &r$   r  When.__repr__Q      !^^44d;;r1   c                2    V P                   V P                  .# r   rb  rL   s   &r$   r   When.get_source_expressionsT  s    ,,r1   c                $    Vw  V n         V n        R # r   rb  r   s   &&r$   r   When.set_source_expressionsW  s    &+#r1   c                   < \         SV `  WW4V4      pV'       d2   VP                  e$   V P                  P                  WW4RR7      Vn        V# )NF)r  )r  r>   r]  r  s   &&&&&& r$   r>   When.resolve_expressionZ  sO     G&u5XV/ ..;;Eu < AK r1   c                0    V P                   P                  .# r   )r  r  rL   s   &r$   r"  When.get_source_fieldsf  s    1122r1   c                   VP                   P                  V 4       Tp. pVP                  V P                  4      w  rxWuR &   VP                  V P                  4      w  rWR&   T;'       g    V P
                  pW5,          . VOVOV
O53# rb  )r  r  r  r]  r  ru  )r   r    r   ru  r!   template_params
sql_paramscondition_sqlcondition_params
result_sqlresult_paramss   &&&&,      r$   r   When.as_sqlj  s    //5'
*2*:*:4>>*J''4$$,$4$4T[[$A!
$.!,,t}}) ,
,
,
 ,
 
 	
r1   c                v    . pV P                  4        F"  pVP                  VP                  4       4       K$  	  V# r   r'  r\  s   &  r$   r[  When.get_group_by_colsy  s4    113FKK0023 4r1   c                j    V P                   P                  ;'       d    V P                  P                  # r   )r]  r  r  rL   s   &r$   r  When.allowed_default  s$    ~~--MM$++2M2MMr1   rb  NNr~  r   )r(   r)   r*   r+   ru  rp   r   r  r  r   r   r>   r"  r   r[  r   r  r-   r.   r  r  s   @@r$   r[  r[  7  sY     3HK7"A<-,
3
 N N Nr1   r[  zdjango.db.models.Casec                      a a ] tR tRt oRtRtRtRRRR/V 3R lltR	 tR
 t	R t
R tV 3R ltRR ltV 3R lt]R 4       tRtVtV ;t# )Casei  z
An SQL searched CASE expression:

    CASE
        WHEN n > 0
            THEN 'positive'
        WHEN n < 0
            THEN 'negative'
        ELSE 'zero'
    END
z#CASE %(cases)s ELSE %(default)s ENDrW  defaultNr   c                 < \         ;QJ d    R  V 4       F  '       d   K   RM	  RM! R  V 4       4      '       g   \        R4      h\        SV `  V4       \	        V4      V n        V P                  V4      ^ ,          V n        W@n        R# )c              3   B   "   T F  p\        V\        4      x  K  	  R # 5ir   )r   r[  )r   cases   & r$   r    Case.__init__.<locals>.<genexpr>  s     <ed:dD))er  FTz.Positional arguments must all be When objects.N)	r  r  r  r   r2  casesr   r  r[  )r   r  r   r  r[  r  s   &$$*,r$   r   Case.__init__  sd    s<e<sss<e<<<LMM&%[
..w7:
r1   c                j    R RP                  R V P                   4       4      : RV P                  : 2# )zCASE r   c              3   8   "   T F  p\        V4      x  K  	  R # 5ir   r_  )r   r  s   & r$   r   Case.__str__.<locals>.<genexpr>  s     1jc!ffjrc  z, ELSE )rh  r  r  rL   s   &r$   r  Case.__str__  s)    II1djj11LL
 	
r1   c                @    R V P                   P                  : RV : R2# re  rh  rL   s   &r$   r  Case.__repr__  rj  r1   c                6    . V P                   OV P                  N# r   r  r  rL   s   &r$   r   Case.get_source_expressions  s    **T\\**r1   c                $    VEv V n         V n        R # r   r  r   s   &&r$   r   Case.set_source_expressions  s    $)!T\r1   c                T   < \         SV `  4       pVP                  R ,          Vn        V# r}  )r  r   r  )r   r  r  s   & r$   r   	Case.copy  s"    GLN''!*r1   c                   VP                   P                  V 4       V P                  '       g   VP                  V P                  4      # / V P
                  CVCp. p. pV P                   F9  p	 VP                  V	4      w  rTP                  T
4       TP                  T4       K;  	  V P                  pV'       d   VP                  V4      w  rME\        V\        4      '       d   VP                  ;pe   ^ RIHp V! W4      pVP                  V4      # T;'       g    V P                   pVP#                  V4      VR&   WR&   VP                  V4       T;'       g    VP%                  RV P&                  4      pW6,          pV P                  e-   VP                   P)                  V P*                  4      V,          pVV3#   \         d     EKd  \         d    T	P                  p  EK6  i ; i)N)Castr  r  ru  )r  r  r  r  r  r[  r   r   r  r  rZ  r   r@   r  django.db.models.functionsr  case_joinerrh  rG  ru  unification_cast_sqlr   )r   r    r   ru  r  r!   rt  
case_partsru  r  case_sqlcase_paramsr  default_sqldefault_paramsr   r  r"   s   &&&&&,            r$   r   Case.as_sql  s    	//5zzz##DLL119TZZ9=9

JJD(0(8(8(>% h'k*  llG*2*:*:7*C'K 7E**%,%B%BB\O;w5##G,,!55T%5%5#.#3#3J#? %0	".)MM22:t}}M(%%1..55d6G6GH3NCJ; "   ++s   -F>>G)G)G)(G)c                x   < V P                   '       g   V P                  P                  4       # \        SV `	  4       # r   )r  r  r[  r  )r   r  s   &r$   r[  Case.get_group_by_cols  s-    zzz<<1133w(**r1   c                    V P                   P                  ;'       dI    \        ;QJ d&    R  V P                   4       F  '       d   K   R# 	  R# ! R  V P                   4       4      # )c              3   8   "   T F  qP                   x  K  	  R # 5ir   r  )r   case_s   & r$   r   'Case.allowed_default.<locals>.<genexpr>  s      4
/9e!!zrc  FT)r  r  r  r  rL   s   &r$   r  Case.allowed_default  s[    ||++ 
 
 4
/3zz4
 	
 	
 4
/3zz4
 1
 	
r1   )r  r  r[  r  )r(   r)   r*   r+   r,   ru  r  r   r  r  r   r   r   r   r[  r   r  r-   r.   r  r  s   @@r$   r  r    sf     
 5HKt $ 
<+*
)V+
 
 
 
r1   r  c                      a a ] tR tRt oRtRtRtRtRtRV 3R llt	R t
R	 tR
 tV 3R ltV 3R lt]R 4       tR tRR ltR tRtVtV ;t# )Subqueryi  z
An explicit subquery. It may contain OuterRef() references to the outer
query which will be resolved when it is applied to that query.
z(%(subquery)s)FNTc                   < \        VR V4      P                  4       V n        RV P                  n        VP	                  RV P
                  4      V n        W0n        \        SV `!  V4       R# )r  Tru  N)	rs   rC  r  r   r   ru  r[  r  r   )r   querysetr   r[  r  s   &&&,r$   r   Subquery.__init__  sP    Xw9??A
"

		*dmm<
&r1   c                    V P                   .# r   r  rL   s   &r$   r   Subquery.get_source_expressions  s    

|r1   c                "    V^ ,          V n         R# r<  r  r   s   &&r$   r   Subquery.set_source_expressions  s    1X
r1   c                .    V P                   P                  # r   )r  r   rL   s   &r$   r  Subquery._resolve_output_field  s    zz&&&r1   c                  < \         SV `  ! V/ VB p\        V 4      \        J d   V P                  \        P                  8X  d   R VP
                  n         V P                   T P                  '       dX   \        T P                  4      \        TP
                  P                  4      Jd"   \        TP
                  T P                  R7      # TP
                  # V#   \         d    TP
                  u # i ; i)Tr   )
r  r>   r  r  ru  r  r   r   r  r8  )r   r  re  r  r  s   &*, r$   r>   Subquery.resolve_expression  s    7-t>v>:!dmmx7H7H&H/3HNN,&!!    T$*;*;%<D++E & )dFWFWXX>>! " &~~%&s   C C32C3c                b   < \         SV `  4       pVP                  P                  4       Vn        V# r   )r  r   r  rC  )r   rC  r  s   & r$   r   Subquery.copy  s'    kk'')r1   c                .    V P                   P                  # r   )r  external_aliasesrL   s   &r$   r  Subquery.external_aliases  s    zz***r1   c                6    V P                   P                  4       # r   )r  get_external_colsrL   s   &r$   r  Subquery.get_external_cols  s    zz++--r1   c                   VP                   P                  V 4       / V P                  CVCpV P                  P	                  W4      w  rgV^R VR&   T;'       g    VP                  RV P                  4      pW5,          pW3# )rH   r   ru  rI   )r  r  r[  r  r   rG  ru  )	r   r    r   ru  r!   rt  subquery_sqlru  r"   s	   &&&&,    r$   r   Subquery.as_sql"  s}    //59TZZ9=9#'::#4#4X#J &21R&8
#MM22:t}}M(r1   c                :    V P                   P                  V R 7      # ))wrapper)r  r[  rL   s   &r$   r[  Subquery.get_group_by_cols,  s    zz++D+99r1   )r[  r  ru  r   )r(   r)   r*   r+   r,   ru  r   r  r   r   r   r   r  r>   r   r  r  r  r   r[  r-   r.   r  r  s   @@r$   r  r    sh     
  H!H''"
 + +.: :r1   r  c                   n   a a ] tR tRt oRt]P                  ! 4       tRtV 3R lt	R t
V 3R ltRtVtV ;t# )Existsi0  zEXISTS(%(subquery)s)Fc                h   < \         SV `  ! V3/ VB  V P                  P                  4       V n        R # r   )r  r   r  exists)r   r  re  r  s   &&,r$   r   Exists.__init__5  s)    ,V,ZZ&&(
r1   c                v    VP                   P                  P                  '       g   R P                  V4      pW#3# rW  )r   r  rQ  r  rx  s   &&&&r$   rw  Exists.select_format9  s4     ""++RRR299#>C{r1   c                   <  \         SV `  ! V.VO5/ VB #   \         dJ    TP                  P                  pTP
                  '       g   Ru # TP                  \        R4      4      u # i ; i)1=0F)r  r'   )r  r   r   r   r  rQ  r  r@   )r   r    r  re  r  r  s   &&*, r$   r   Exists.as_sqlA  sh    	27>(<T<V<< 	2**33HBBB  ##E%L11		2s    2A+
A+A+*A+r  )r(   r)   r*   r+   ru  r   r  r   r  r   rw  r   r-   r.   r  r  s   @@r$   r  r  0  s2     %H&&(L")2 2r1   r  zdjango.db.models.OrderByc                   t   a  ] tR tRt o RtRtRtRtRR ltR t	R t
R	 tRR
 ltR tR tR tR tR tRtV tR# )rc  iK  z%(expression)s %(ordering)sFTNc                    V'       d   V'       d   \        R 4      hVRJ g   VRJ d   \        R4      hW0n        W@n        W n        \	        VR4      '       g   \        R4      hWn        R# )z1nulls_first and nulls_last are mutually exclusiveFz7nulls_first and nulls_last values must be True or None.r>   z%expression must be an expression typeN)r  nulls_first
nulls_lastrk  r?   r(  )r   r(  rk  r  r  s   &&&&&r$   r   OrderBy.__init__R  s]    :PQQ%:#6VWW&$$z#788DEE$r1   c                x    R P                  V P                  P                  V P                  V P                  4      # )z{}({}, descending={}))r  r  r(   r(  rk  rL   s   &r$   r  OrderBy.__repr__^  s.    &--NN##T__doo
 	
r1   c                "    V^ ,          V n         R# r<  r  r   s   &&r$   r   OrderBy.set_source_expressionsc  r>  r1   c                    V P                   .# r   r  rL   s   &r$   r   OrderBy.get_source_expressionsf  r  r1   c                b   \        V P                  \        4      '       d   . p. pV P                  P                  4        F[  pV P	                  4       pVP
                  ! V.4       VP                  V4      w  rVP                  V	4       VP                  V
4       K]  	  R P                  V4      V3# T;'       g    V P                  pVP                  P                  '       d9   V P                  '       d   RV,          pMV P                  '       d
   RV,          pMV P                  '       d9   V P                  '       d   VP                  P                   '       g   RV,          pMIV P                  '       d8   V P                  '       g   VP                  P                   '       g
   RV,          pVP"                  P%                  V 4       VP                  V P                  4      w  rRTRV P                  '       d   RMR/VCpWcP'                  R	4      ,          pW<,          P)                  4       V3# )
r   z%s NULLS LASTz%s NULLS FIRSTz%%(expression)s IS NULL, %sz%%(expression)s IS NOT NULL, %sr(  orderingDESCASCz%(expression)s)r   r(  r  r  r   r   r  r  rZ  rh  ru  r   supports_order_by_nulls_modifierr  r  rk  order_by_nulls_firstr  r  countrstrip)r   r    r   ru  r!   rw  r#   r5  r   r"   
col_paramsexpression_sqlplaceholderss   &&&&,        r$   r   OrderBy.as_sqli  s   doox00IF//1yy{++SE2"*"2"24"8  %j) 2 99Y'//,,t}}???*X5!!!+h6J$7$7$L$L$L88C!!!OOO
(;(;(P(P(P<xG//5!)!1!1$//!B.$///u
 

 	..!122'//1699r1   c                D   VP                   P                  '       gu   VP                  P                  V P                  4      '       dJ   V P                  4       p\        \        V P                  R R7      RR7      Vn        VP                  ! W4      # V P                  W4      # )T)r^  F)r  )	r  rQ  r  rR  r(  r   r  r[  r   )r   r    r   r   s   &&& r$   	as_oracleOrderBy.as_oracle  s~     ##JJJOO  99;D"T__40DO ;;x44{{800r1   c                v    . pV P                  4        F"  pVP                  VP                  4       4       K$  	  V# r   r'  r\  s   &  r$   r[  OrderBy.get_group_by_cols  s4    113FKK0023 4r1   c                    V P                   '       * V n         V P                  '       d   R V n        RV n        V # V P                  '       d   R V n        RV n        V # TN)rk  r  r  rL   s   &r$   rp  OrderBy.reverse_ordering  sQ    "oo-"DO#D  ___#D"DOr1   c                    R V n         R# )FNr.  rL   s   &r$   rf  OrderBy.asc  s	    r1   c                    R V n         R# r  r.  rL   s   &r$   rl  OrderBy.desc  s	    r1   )rk  r(  r  r  )FNNr   )r(   r)   r*   r+   ru  rp   r{  r  r   r  r   r   r   r  r[  rp  rf  rl  r-   r.   r/   s   @r$   rc  rc  K  sS     ,HK',$#' 
%

#!":H1"  r1   rc  c                   |   a a ] tR tRt oRtRtRtRV 3R lltR tR t	R t
RR	 ltV 3R
 ltR tR tR tRtVtV ;t# )Windowi  z %(expression)s OVER (%(window)s)FTc                  < W n         W0n        W@n        \        VR R4      '       g'   \	        RVP
                  P                  ,          4      hV P                   eQ   \        V P                   \        \        34      '       g   V P                   3V n         \        V P                   !  V n         \        P                  RV P                  4      V n        \        SV `9  VR7       V P                  V4      ^ ,          V n        R# )r  Fz3Expression '%s' isn't compatible with OVER clauses.NzWindow.order_byr   )partition_byorder_byframers   r  r  r(   r   r  r2  r  r+  r5  r  r   r   source_expression)r   r(  r  r  r  r   r  s   &&&&&&r$   r   Window.__init__  s     ) 
z#6>>E&&//0 
 (d//%??%)%6%6$8! .0A0A BD#../@$--Pl3!%!8!8!DQ!Gr1   c                .    V P                   P                  # r   )r  r   rL   s   &r$   r  Window._resolve_output_field  s    %%222r1   c                ^    V P                   V P                  V P                  V P                  .# r   r  r  r  r  rL   s   &r$   r   Window.get_source_expressions  s%    &&(9(94==$**UUr1   c                <    Vw  V n         V n        V n        V n        R # r   r  r   s   &&r$   r   Window.set_source_expressions  s    OTL 14=$*r1   c                6   VP                   P                  V 4       VP                  P                  '       g   \	        R 4      hVP                  V P                  4      w  rE. RrvV P                  eD   V P                  P                  VVRR7      w  rVP                  V4       V\        V	4      ,          pV P                  eA   VP                  V P                  4      w  rVP                  V
4       V\        V4      ,          pV P                  '       dA   VP                  V P                  4      w  rVP                  V4       V\        V4      ,          pT;'       g    V P                  pVRVRRP                  V4      P                  4       /,          . VOVO53# )z1This backend does not support window expressions.zPARTITION BY %(expressions)s)r    r   ru  r(  windowrW  r'   )r  r  r  supports_over_clauser   r  r  r  r   r  r  r  r  ru  rh  strip)r   r    r   ru  expr_sqlr#   
window_sqlwindow_paramssql_exprru  	order_sqlorder_params	frame_sqlframe_paramss   &&&&          r$   r   Window.as_sql  sl   //5""777#$WXX#++D,B,BC$&M(#'#4#4#;#;!%7 $< $ H
 h'U:..M==$&.&6&6t}}&E#Ii(U<00M:::&.&6&6tzz&B#Ii(U<00M,,t}} h#((::N:T:T:VWW%f%}%
 	
r1   c                H  < \        V P                  \        P                  4      '       dh   V P	                  4       pVP
                  ! 4       p\        P                  ! 4       V^ ,          n        VP                  ! V4       \        \        V`+  W4      # V P                  W4      # )r   )r   r   r   r   r   r   r+  r   r  r  r%   r   )r   r    r   r   r  r  s   &&&  r$   r%   Window.as_sqlite  s}    d'')<)<==99;D!%!<!<!>171B1B1Dq!.''(:;0FF{{800r1   c           	         R P                  \        V P                  4      V P                  '       d   R\        V P                  4      ,           MR\        V P                  ;'       g    R4      \        V P
                  ;'       g    R4      4      # )z{} OVER ({}{}{})zPARTITION BY r"  )r  r   r  r  r  r  rL   s   &r$   r  Window.__str__  sk    !((&&'8<8I8I8IOc$"3"344r##$

  b!	
 	
r1   c                @    R V P                   P                  : RV : R2# re  rh  rL   s   &r$   r  Window.__repr__  rj  r1   c                    . pV P                   '       d*   VP                  V P                   P                  4       4       V P                  e*   VP                  V P                  P                  4       4       V# r   )r  rZ  r[  r  )r   r(  s   & r$   r[  Window.get_group_by_cols  s[      !2!2!D!D!FG==$  !@!@!BCr1   )r  r  r  r  )NNNNr   )r(   r)   r*   r+   ru  r   r   r   r  r   r   r   r%   r  r  r[  r-   r.   r  r  s   @@r$   r  r    sN     1H H63VU
B1
< r1   r  c                   6   a  ] tR tRt o RtRtRtRtR tRt	V t
R# )	WindowFrameExclusioni   zCURRENT ROWGROUPTIESz	NO OTHERSc                L    V P                   P                   R V P                   2# )r  )r  r*   _name_rL   s   &r$   r  WindowFrameExclusion.__repr__&  s"    ..--.a}==r1   r'   N)r(   r)   r*   r+   CURRENT_ROWr  r  	NO_OTHERSr  r-   r.   r/   s   @r$   r  r     s#     KEDI> >r1   r  c                   b   a  ] tR tRt o RtRtRR ltR tR tR t	R	 t
R
 tR tR tR tRtV tR# )WindowFramei*  a>  
Model the frame clause in window expressions. There are two types of frame
clauses which are subclasses, however, all processing and validation (by no
means intended to be complete) is done here. Thus, providing an end for a
frame is optional (the default is UNBOUNDED FOLLOWING, which is the last
row in the frame).
z7%(frame_type)s BETWEEN %(start)s AND %(end)s%(exclude)sNc                    \        V4      V n        \        V4      V n        \        V\        \
        34      '       g#   \        V P                  P                   R 24      hW0n	        R# )z3.exclusion must be a WindowFrameExclusion instance.N)
r@   rF  endr   r	   r  r  r  r*   	exclusion)r   rF  r!  r"  s   &&&&r$   r   WindowFrame.__init__5  sY    5\
:)h0D%EFF>>../ 01 1  #r1   c                $    Vw  V n         V n        R # r   rF  r!  r   s   &&r$   r   "WindowFrame.set_source_expressions?  s    $
DHr1   c                2    V P                   V P                  .# r   r%  rL   s   &r$   r   "WindowFrame.get_source_expressionsB  s    

DHH%%r1   c                T    V P                   f   R# RV P                   P                   2# )Nr"  z	 EXCLUDE )r"  r'  rL   s   &r$   get_exclusionWindowFrame.get_exclusionE  s'    >>!4>>//011r1   c           
        VP                   P                  V 4       V P                  W P                  P                  V P
                  P                  4      w  r4V P                  '       d(   VP                  P                  '       g   \        R 4      hV P                  RV P                  RVRVRV P                  4       /,          . 3# )z6This backend does not support window frame exclusions.
frame_typerF  r!  exclude)r  r  window_frame_start_endrF  r'  r!  r"  r  supports_frame_exclusionr   ru  r-  r*  )r   r    r   rF  r!  s   &&&  r$   r   WindowFrame.as_sqlJ  s    //500

(($((..

 >>>*"5"5"N"N"N#H  MMdoos4--/	 	
 		
r1   c                @    R V P                   P                  : RV : R2# re  rh  rL   s   &r$   r  WindowFrame.__repr__^  rj  r1   c                    . # r   r'   rL   s   &r$   r[  WindowFrame.get_group_by_colsa  r   r1   c           
        V P                   P                  e]   V P                   P                  ^ 8  dB   R\        V P                   P                  4      \        P                  P
                  3,          pMV P                   P                  e7   V P                   P                  ^ 8X  d   \        P                  P                  pMV P                   P                  eT   V P                   P                  ^ 8  d9   RV P                   P                  \        P                  P                  3,          pM\        P                  P                  pV P                  P                  eT   V P                  P                  ^ 8  d9   RV P                  P                  \        P                  P                  3,          pMV P                  P                  e7   V P                  P                  ^ 8X  d   \        P                  P                  pMV P                  P                  e]   V P                  P                  ^ 8  dB   R\        V P                  P                  4      \        P                  P
                  3,          pM\        P                  P                  pV P                  RV P                  RVRVRV P                  4       /,          # )Nz%d %sr-  rF  r!  r.  )rF  r'  absr   r  	PRECEDINGr  	FOLLOWINGUNBOUNDED_PRECEDINGr!  UNBOUNDED_FOLLOWINGru  r-  r*  )r   rF  r!  s   &  r$   r  WindowFrame.__str__d  s   ::'DJJ,<,<q,@s4::#3#34jnn6N6NOOEZZ)djj.>.>!.CNN..EZZ)djj.>.>.Btzz//1I1IJJENN66E88>>%$((..1*<TXX^^Z^^-E-EFFCXX^^'DHHNNa,?..,,CXX^^'DHHNNQ,>S0*..2J2JKKC..44C}}$//U3t))+	 
 
 	
r1   c                    \        R 4      h)z3Subclasses must implement window_frame_start_end().r   r   r   rF  r!  s   &&&&r$   r/  "WindowFrame.window_frame_start_end}  s    !"WXXr1   )r!  r"  rF  r  )r(   r)   r*   r+   r,   ru  r   r   r   r*  r   r  r[  r  r/  r-   r.   r/   s   @r$   r  r  *  sF      IH#%&2

(<
2Y Yr1   r  c                   *   a  ] tR tRt o RtR tRtV tR# )RowRangei  ROWSc                8    VP                   P                  W#4      # r   )r  window_frame_rows_start_endr>  s   &&&&r$   r/  RowRange.window_frame_start_end  s    ~~99%EEr1   r'   Nr(   r)   r*   r+   r-  r/  r-   r.   r/   s   @r$   rA  rA    s     JF Fr1   rA  c                   *   a  ] tR tRt o RtR tRtV tR# )
ValueRangei  RANGEc                8    VP                   P                  W#4      # r   )r  window_frame_range_start_endr>  s   &&&&r$   r/  !ValueRange.window_frame_start_end  s    ~~::5FFr1   r'   NrF  r/   s   @r$   rH  rH    s     JG Gr1   rH  )hr   r  r  r  collectionsr   decimalr   enumr   	itertoolsr   typesr	   uuidr
   django.core.exceptionsr   r   r   	django.dbr   r   r   django.db.modelsr   django.db.models.constantsr   django.db.models.query_utilsr   django.utils.deconstructr   django.utils.functionalr   r   django.utils.hashabler   r   r3   r   r   r  rR   rK   ra   rf   rk   PositiveIntegerFieldrY   r0  r+  r   ry   r   r~   r   r   r2  from_iterabler  r  r  r  _connector_combinationsr  r  dr  rC   field_typesr  r  r  r  r  rA   r  r  r   r/  r>  r  rT  r@   r  r  r  r  r  r  r  r+  r8  r   r[  r  r  r  rc  r  r  r  rA  rH  )rC   s   0r$   <module>r`     s3       #      L L B B # 1 * 4 B /  A' A'H	Z 	V Vr
 *# *# *#B NNNNNNNNNN

I 	++++++
 	

0 NNNNNN NNNNNN	
	
I 	  &"5"5v7J7JK 1 163D3DE  &"5"5v7J7JK
 	

	
4 NNNNNNNNNN

I 	  &"5"5v7J7JK  &"5"5v7J7JK  &"3"3V5F5FG 3 3V5F5FG	
 	

* ##$$
	
I 	  &"5"5v7J7JK
 	

	2 NNNNNNNNNNNN

I 	4   ''''%%#  	
 		

, 	v33V5I5IJ!!6#7#79M9MN!!6#3#3V5I5IJ!!6#7#79M9MN!!6#7#79M9MNv33V5E5EF!!6#3#3V5E5EF
 	v33V5I5IJ!!6#7#79M9MNv//1E1EFv33V5I5IJ!!6#3#3V5I5IJ!!6#7#79M9MN!!6#7#79M9MNv33V5E5EFv//1E1EF
Ow r %T* 	A 
!A"#'')	; +Cf&sIsFC !, #, 
! S!! "!TE+Z TEn0+ 0f
, 
 *+=
 = ,=@"q "J
q 
6UQ 6Ur -.ZYz ZY /ZYz ./M
 M 0M` 
Z  
F: %j %P$6* $6N6z 6r&* &RT 8
. 
> :;!/*J !/ <!/H0) 0f -.JN: JN /JNZ -.`
z `
 /`
FD:~z D:N2X 26 01fj f 2fRh hV>4 >TY* TYnF{ FG GQ2"$ s!   $._A2_	B_._!
A	_&