
    fki~0                         S SK r S SKrS SKrS SKrS SKJr  S SKJrJrJ	r	  S SK
r
S SKJr  \ R                  S 5       r " S S\5      r " S S	\5      r\r\r " S
 S5      r " S S\5      rS r " S S5      rg)    N)Counter)iscoroutinefunctionmarkcoroutinefunctionsync_to_async)	signaturec                  l    [        [        SS 5      n U c  g[        R                  R	                  U 5      4$ )N__file__ )getattrdjangoospathdirname)files    ]/var/www/events.demo-site.click/venv/lib/python3.13/site-packages/django/utils/deprecation.pydjango_file_prefixesr      s.    6:t,D|GGOOD!##    c                       \ rS rSrSrg)RemovedInDjango61Warning   r
   N__name__
__module____qualname____firstlineno____static_attributes__r
   r   r   r   r          r   r   c                       \ rS rSrSrg)RemovedInDjango70Warning   r
   Nr   r
   r   r   r   r      r   r   r   c                        \ rS rSrS rS rSrg)warn_about_renamed_method!   c                 4    Xl         X l        X0l        X@l        g N)
class_nameold_method_namenew_method_namedeprecation_warning)selfr&   r'   r(   r)   s        r   __init__"warn_about_renamed_method.__init__"   s     %..#6 r   c                    ^ ^ UU 4S jnU$ )Nc            	         > [         R                  " STR                  < STR                  < STR                  < S3TR
                  S5        T" U 0 UD6$ )N`.z` is deprecated, use `z
` instead.   )warningswarnr&   r'   r(   r)   )argskwargsfr*   s     r   wrapper3warn_about_renamed_method.__call__.<locals>.wrapper+   sJ    MM??D$8$8$:N:NP((	 d%f%%r   r
   )r*   r6   r7   s   `` r   __call__"warn_about_renamed_method.__call__*   s    	& r   )r&   r)   r(   r'   N)r   r   r   r   r+   r9   r   r
   r   r   r"   r"   !   s    7
r   r"   c                   0   ^  \ rS rSrSrSrU 4S jrSrU =r$ )RenameMethodsBase7   a  
Handles the deprecation paths when renaming a method.

It does the following:
    1) Define the new method if missing and complain about it.
    2) Define the old method if missing.
    3) Complain whenever an old method is called.

See #15363 for more details.
r
   c                 ,  > [         TU ]  XX#5      n[        R                  " U5       H  nUR                  nU R
                   H  nUS   nUR                  R                  U5      n	US   n
UR                  R                  U
5      nUS   n[        U/UQ76 nU(       dJ  U	(       aC  [        R                  " SU< SU< SU
< S3US5        [        XZU	5        [        XXU" U	5      5        U	(       a  M  U(       d  M  [        XXU" U5      5        M     M     U$ )Nr      r1   r/   r0   z` method should be renamed `z`.)super__new__inspectgetmror   renamed_methods__dict__getr"   r2   r3   setattr)clsnamebasesattrs	new_classbaser&   renamed_methodr'   
old_methodr(   
new_methodr)   r7   	__class__s                 r   rA   RenameMethodsBase.__new__E   s    GOCu<	NN9-DJ"%"5"5"0"3!]]..?
"0"3!]]..?
&4Q&7#3JPP "jMM%I+	 D:>D7:3FG "zjjD7:3FG+ #6 .2 r   )	r   r   r   r   __doc__rD   rA   r   __classcell__rQ   s   @r   r<   r<   7   s    	 O r   r<   c                   ^ ^ U U4S jnU$ )a4  
Function/method decorator to deprecate some or all positional arguments.

The decorated function will map any positional arguments after the ``*`` to
the corresponding keyword arguments and issue a deprecation warning.

The decorator takes two arguments: a RemovedInDjangoXXWarning warning
category and a list of parameter names that have been changed from
positional-or-keyword to keyword-only, in their original positional order.

Works on both functions and methods. To apply to a class constructor,
decorate its __init__() method. To apply to a staticmethod or classmethod,
use @deprecate_posargs after @staticmethod or @classmethod.

Example: to deprecate passing option1 or option2 as posargs, change::

    def some_func(request, option1, option2=True):
        ...

to::

    @deprecate_posargs(RemovedInDjangoXXWarning, ["option1", "option2"])
    def some_func(request, *, option1, option2=True):
        ...

After the deprecation period, remove the decorator (but keep the ``*``)::

    def some_func(request, *, option1, option2=True):
        ...

Caution: during the deprecation period, do not add any new *positional*
parameters or change the remaining ones. For example, this attempt to add a
new param would break code using the deprecated posargs::

    @deprecate_posargs(RemovedInDjangoXXWarning, ["option1", "option2"])
    def some_func(request, wrong_new_param=None, *, option1, option2=True):
        # Broken: existing code may pass a value intended as option1 in the
        # wrong_new_param position.
        ...

However, it's acceptable to add new *keyword-only* parameters and to
re-order the existing ones, so long as the list passed to
@deprecate_posargs is kept in the original posargs order. This change will
work without breaking existing code::

    @deprecate_posargs(RemovedInDjangoXXWarning, ["option1", "option2"])
    def some_func(request, *, new_param=None, option2=True, option1):
        ...

The @deprecate_posargs decorator adds a small amount of overhead. In most
cases it won't be significant, but use with care in performance-critical
code paths.
c                   >^ ^^^^	^
^ [        T [        5      (       a  [        S5      e[        T [        5      (       a  [        S5      e[        T [        5      (       a  [        S5      e[        T 5      R                  m
[        S T
R                  5        5       5      nU[        R                  R                     S:  a  [        S5      eU[        R                  R                     U[        R                  R                     -   mU[        R                  R                     nUS:  a  [        S5      e[        U
4S	 jT 5       5      (       a  [        S
5      e[!        T5      m	TT	-   mT R"                  mTS:X  a3  T R$                  R'                  SS5      S   nUR)                  SS5      nUmUUUUU	U4S jm[+        T 5      (       a#  [,        R.                  " T 5      U UU4S j5       nU$ [,        R.                  " T 5      U UU4S j5       nU$ )NzS@deprecate_posargs cannot be applied to a class. (Apply it to the __init__ method.)z-Apply @classmethod before @deprecate_posargs.z.Apply @staticmethod before @deprecate_posargs.c              3   8   #    U  H  oR                   v   M     g 7fr%   )kind).0params     r   	<genexpr>7deprecate_posargs.<locals>.decorator.<locals>.<genexpr>   s     FoUjjos   r   zE@deprecate_posargs() cannot be used with variable positional `*args`.r?   zm@deprecate_posargs() requires at least one keyword-only parameter (after a `*` entry in the parameters list).c              3      >#    U  H;  nUT;  =(       d*    TU   R                   [        R                  R                  :g  v   M=     g 7fr%   )rY   rB   	ParameterKEYWORD_ONLY)rZ   rI   paramss     r   r\   r]      s@      
( U&,"3"3w7H7H7U7U"UU(s   AAzQ@deprecate_posargs() requires all remappable_names to be keyword-only parameters.r+   z	<locals>.z	.__init__ c           
        >^	 [        U 5      =nT:  a  [        T ST ST SU S35      eTSUT-
   n[        U5      [        U5      -  m	T	(       a,  SR                  U	4S jU 5       5      n[        T SU S	35      e[	        [        X0TS S
S95      nU ST nX-  nSR                  S U 5       5      n[        R                  " SU ST S3T
[        5       S9  Xg4$ )z_
Move deprecated positional args to kwargs and issue a warning.
Return updated (args, kwargs).
z() takes at most z# positional argument(s) (including z deprecated) but z were given.Nz, c              3   >   >#    U  H  oT;   d  M
  S U S 3v   M     g7f'Nr
   )rZ   rI   	conflictss     r   r\   Vdeprecate_posargs.<locals>.decorator.<locals>.remap_deprecated_args.<locals>.<genexpr>   s#      *,:Di>OKavQKNs   	zB() got both deprecated positional and keyword argument values for r0   T)strictc              3   .   #    U  H  nS U S 3v   M     g7frf   r
   )rZ   rI   s     r   r\   ri      s     *R>4QtfA;>s   zPassing positional argument(s) z to z0() is deprecated. Use keyword arguments instead.)skip_file_prefixes)	len	TypeErrorsetjoindictzipr2   r3   r   )r4   r5   num_positional_argsremapped_namesconflicts_strremapped_kwargsremaining_argsupdated_kwargsremapped_names_strrh   r)   	func_namemax_positional_argsnum_positional_paramsnum_remappable_argsremappable_namess            @r   remap_deprecated_argsCdeprecate_posargs.<locals>.decorator.<locals>.remap_deprecated_args   sI   
 (+4y0#4GG k!23F2G H..A-BBS*+<9  .=%(==N N+c&k9I $		 *,:* !   k "++8/<  #N)>)?$@NO ""8#89N#5N "&*R>*R!RMM12D1ET) U@ @##7#9	 "11r   c                  b   >#    [        U 5      T:  a
  T" X5      u  pT" U 0 UD6I S h  vN $  N7fr%   rm   r4   r5   funcr|   r   s     r   r7   5deprecate_posargs.<locals>.decorator.<locals>.wrapper   s5     t944#8#FLD!4262222s   %/-/c                  F   > [        U 5      T:  a
  T" X5      u  pT" U 0 UD6$ r%   r   r   s     r   r7   r     s,    t944#8#FLDT,V,,r   )
isinstancetypern   classmethodstaticmethodr   
parametersr   valuesrB   r_   VAR_POSITIONALPOSITIONAL_ONLYPOSITIONAL_OR_KEYWORDr`   anyrm   r   r   rsplitreplacer   	functoolswraps)r   num_by_kindnum_keyword_only_params
local_namer&   r7   rz   r{   r|   r}   ra   r   r)   r~   s   `     @@@@@@r   	decorator$deprecate_posargs.<locals>.decorator   s   dD!!+  dK((KLLdL))LMM4++FfmmoFFw((7781<W 
 ))99:'++AABC 	 #.g.?.?.L.L"M"Q&>   
(
 
 
 + 
 ""2336IIMM	
" **11+qA"EJ#++K<J"I,	2 ,	2\ t$$__T"3 #3  __T"- #-
 r   r
   )r)   r~   r   s   `` r   deprecate_posargsr   d   s    nsj r   c                   B   ^  \ rS rSrSrSrU 4S jrS rS rS r	Sr
U =r$ )MiddlewareMixini  Tc                    > Uc  [        S5      eXl        [        U R                  5      U l        U R                  (       a  [	        U 5        [
        TU ]  5         g )Nzget_response must be provided.)
ValueErrorget_responser   
async_moder   r@   r+   )r*   r   rQ   s     r   r+   MiddlewareMixin.__init__  sK    =>>( .d.?.?@?? "$'r   c                     SU R                   R                  < S[        U R                  SU R                  R                   R                  5      < S3$ )N<z get_response=r   >)rQ   r   r   r   r   )r*   s    r   __repr__MiddlewareMixin.__repr__$  sB    NN''!!!!++44
 	
r   c                 
   U R                   (       a  U R                  U5      $ S n[        U S5      (       a  U R                  U5      nU=(       d    U R	                  U5      n[        U S5      (       a  U R                  X5      nU$ )Nprocess_requestprocess_response)r   	__acall__hasattrr   r   r   r*   requestresponses      r   r9   MiddlewareMixin.__call__.  ss    ??>>'**4*++++G4H9t0094+,,,,W?Hr   c                 .  #    Sn[        U S5      (       a"  [        U R                  SS9" U5      I Sh  vN nU=(       d    U R                  U5      I Sh  vN n[        U S5      (       a"  [        U R                  SS9" X5      I Sh  vN nU$  N[ N; N
7f)zP
Async version of __call__ that is swapped in when an async request
is running.
Nr   T)thread_sensitiver   )r   r   r   r   r   r   s      r   r   MiddlewareMixin.__acall__:  s     
 4*++*$$!%  H ?T%6%6w%??4+,,*%%!% ! !H   @!s3   1BB!BB2BB	BBB)r   r   )r   r   r   r   sync_capableasync_capabler+   r   r9   r   r   rT   rU   s   @r   r   r     s&    LM

 r   r   )r   rB   r   r2   collectionsr   asgiref.syncr   r   r   r   django.utils.inspectr   cacher   DeprecationWarningr   PendingDeprecationWarningr   RemovedInNextVersionWarningRemovedAfterNextVersionWarningr"   r   r<   r   r   r
   r   r   <module>r      s      	   R R  * $ $	1 		8 	 7 !9  ,* *Zl^8 8r   