
    jTE                        S SK r 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  S SK	J
r
  S SKrS SKJr  \ R                  S 5       r " S S\5      r " S	 S
\5      r\rSS SS.S jrS r " S S5      r " S S\5      rS r " S S5      rg)    N)Counter)iscoroutinefunctionmarkcoroutinefunction)sync_to_async)	signaturec                      [        [        SS 5      n U c  g[        R                  R	                  [        R                  R                  U 5      S5      4$ )N__file__  )getattrdjangoospathjoindirname)files    P/var/www/html/KUNJ/venv/lib/python3.13/site-packages/django/utils/deprecation.pydjango_file_prefixesr      s=    6:t,D|GGLL.355    c                       \ rS rSrSrg)RemovedInNextVersionWarning   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!   )skip_name_prefixesskip_framesinternal_modulesc                6   Uc  Sn[        U[        5      (       d  [        S5      e[        S U 5       5      nS nS n[        R                  " 5       Sp U" U" X5      6 u  pUbR  U(       aK  U" U5      R                  U5      (       a/  U" X5      u  pU(       a  U" U5      R                  U5      (       a  M/  [        U5       H  n
U" X5      u  pM     U=(       a    U" U5      R                  U5      nAU(       d  [        R                  " XU	S-   S	9  gg! Af = f)
a  Issue a warning when a deprecated feature is used outside of Django.

Skip the warning when called from within Django, to avoid cascading
warnings when one deprecated feature is implemented on top of another.

Examine the stack to determine the "effective caller" (the code using the
deprecated feature). By default, this is the third frame from the top
(ignoring this helper plus the call site).

Provide `skip_name_prefixes` (a string or tuple of strings) to skip
additional frames by prefix-matching each frame's fully qualified name
(dotted module path plus qualname). `skip_name_prefixes` can be used to
skip specific functions, all methods in a class, or everything in a module.
Skipping stops at the first non-matching frame. Useful when a shared helper
is called through multiple paths of varying depth with a common prefix.

Provide `skip_frames` (an integer) to skip a fixed number of additional
frames (e.g., exactly one decorator or shared helper function). If both
options are provided, `skip_name_prefixes` is applied first.

Provide `internal_modules` (a tuple of names, defaulting to ("django",)) to
customize what counts as "internal". A frame is internal when its fully
qualified name starts with one of these names followed by a dot.

The warning is issued only if the effective caller (the first non-skipped
frame) is outside Django, attributed to that frame. If all frames are
skipped, it falls back to the base of the stack.

Note: To unconditionally issue a warning identifying the first caller
outside Django as its source, don't use this function. Instead, use::

    warnings.warn(..., skip_file_prefixes=django_file_prefixes())

to avoid unnecessary stack inspection overhead.
N)r   z0internal_modules must be a tuple of module namesc              3   *   #    U  H	  o S 3v   M     g7f).Nr
   ).0mods     r   	<genexpr>*warn_about_external_use.<locals>.<genexpr>R   s     D3CCQi3Cs   c                 p    U R                   R                  SS5      nU SU R                  R                   3$ )Nr   __main__r(   )	f_globalsgetf_codeco_qualname)framemod_names     r   get_fq_name,warn_about_external_use.<locals>.get_fq_nameT   s4    ??&&z:>1U\\55677r   c                 2    U b  U R                   US-   4$ S U4$ )N   )f_back)r3   levels     r   back%warn_about_external_use.<locals>.backX   s%    <<**U{r   r   r8   )category
stacklevel)	
isinstancetuple	TypeErrorinspectcurrentframe
startswithrangewarningswarn)messager=   r#   r$   r%   internal_prefixesr5   r;   r3   r:   _is_internals               r   warn_about_external_userL   "   s   X &&..JKKD3CDD8
 '')15T%/0)K.99:LMM#E1 K.99:LMM {#A-LE5 $ PE 2 = =>O PgUQYG  s   A D 7<D Dc           	          [         R                  " U5      (       d  [        U[        [        45      (       a  UR
                  nOf[         R                  " U5      (       d  [         R                  " U5      (       a  UnO-[        U[        5      (       a  UR                  nO[        S5      e[         R                  " U5      n [         R                  " U5      n[         R                  " U5      u  pVUR&                  n [(        R*                  U   R,                  R/                  S0 5      n[         R2                  " XXFXxS9  g! [        [        [        4 a     [         R"                  " X[%        5       S9   gf = f! [        [0        4 a    Sn Ncf = f)aR  Issue a warning about a specific function, class, or method definition.

The warning will point to the source filename and line number where
'target' is _defined_ (not where it is being _called_ as with other warning
helpers). Use this to warn about code that isn't currently on the call
stack, e.g., deprecation based on the return value of a called method or
inspecting a function's signature to see if it supports an updated API.

Supported usage:
warn_about_implementation(message, category, some_function)
warn_about_implementation(message, category, SomeClass)
warn_about_implementation(message, category, SomeClass.method)
warn_about_implementation(message, category, self.method) [a bound method]

To warn about a property without invoking its descriptor, call with
'target' set to inspect.getattr_static(class_or_instance, "property_name").
zotarget must be a function, class, bound method, or unbound descriptor (classmethod, staticmethod, or property).skip_file_prefixesN__warningregistry__)moduleregistry)rB   ismethodr?   classmethodstaticmethod__func__
isfunctionisclasspropertyfgetrA   unwrapgetsourcefilegetsourcelinesAttributeErrorOSErrorrF   rG   r   r   sysmodules__dict__
setdefaultKeyErrorwarn_explicit)	rH   r=   targetfunctionfilenamerJ   linenorQ   rR   s	            r   warn_about_implementationrj   q   sE   $ :f{L6Q#R#R??			F	#	#wv'>'>	FH	%	%;;8
 	

 ~~h'H((2**84	   F;;v&//::;PRTU 8F GY/ g<P<RS H% s$   .E  <-E8  2E54E58FF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)selfrp   rq   rr   rs   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`r(   z` is deprecated, use `z
` instead.   )rF   rG   rp   rq   rr   rs   )argskwargsfrt   s     r   wrapper3warn_about_renamed_method.__call__.<locals>.wrapper   sJ    MM??D$8$8$:N:NP((	 d%f%%r   r
   )rt   r}   r~   s   `` r   __call__"warn_about_renamed_method.__call__   s    	& r   )rp   rs   rr   rq   N)r   r   r   r   ru   r   r   r
   r   r   rl   rl      s    7
r   rl   c                   0   ^  \ rS rSrSrSrU 4S jrSrU =r$ )RenameMethodsBase   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   r8   rz   ry   r(   z` method should be renamed `z`.)super__new__rB   getmror   renamed_methodsrb   r0   rl   rF   rG   setattr)clsnamebasesattrs	new_classbaserp   renamed_methodrq   
old_methodrr   
new_methodrs   r~   	__class__s                 r   r   RenameMethodsBase.__new__   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__r   r   r   __classcell__r   s   @r   r   r      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ro   )kind)r)   params     r   r+   7deprecate_posargs.<locals>.decorator.<locals>.<genexpr>+  s     FoUjjos   r   zE@deprecate_posargs() cannot be used with variable positional `*args`.r8   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ro   )r   rB   	ParameterKEYWORD_ONLY)r)   r   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.ru   z	<locals>.z	.__init__r   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
   )r)   r   	conflictss     r   r+   Vdeprecate_posargs.<locals>.decorator.<locals>.remap_deprecated_args.<locals>.<genexpr>h  s#      *,:Di>OKavQKNs   	zB() got both deprecated positional and keyword argument values for r(   T)strictc              3   .   #    U  H  nS U S 3v   M     g7fr   r
   )r)   r   s     r   r+   r   x  s     *R>4QtfA;>s   zPassing positional argument(s) z to z0() is deprecated. Use keyword arguments instead.rN   )	lenrA   setr   dictziprF   rG   r   )r{   r|   num_positional_argsremapped_namesconflicts_strremapped_kwargsremaining_argsupdated_kwargsremapped_names_strr   rs   	func_namemax_positional_argsnum_positional_paramsnum_remappable_argsremappable_namess            @r   remap_deprecated_argsCdeprecate_posargs.<locals>.decorator.<locals>.remap_deprecated_argsT  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ro   r   r{   r|   funcr   r   s     r   r~   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$ ro   r   r   s     r   r~   r     s,    t944#8#FLDT,V,,r   )r?   typerA   rT   rU   r   
parametersr   valuesrB   r   VAR_POSITIONALPOSITIONAL_ONLYPOSITIONAL_OR_KEYWORDr   anyr   r   r   rsplitreplacer   	functoolswraps)r   num_by_kindnum_keyword_only_params
local_namerp   r~   r   r   r   r   r   r   rs   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
   )rs   r   r   s   `` r   deprecate_posargsr      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   ru   )rt   r   r   s     r   ru   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   >)r   r   r   r   r   )rt   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   rt   requestresponses      r   r   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_capableru   r   r   r   r   r   r   s   @r   r   r     s&    LM

 r   r   )r   rB   r   r`   rF   collectionsr   r   r   asgiref.syncr   r   django.utils.inspectr   cacher   DeprecationWarningr   PendingDeprecationWarningr!   RemovedAfterNextVersionWarningrL   rj   rl   r   r   r   r   r
   r   r   <module>r      s      	 
   > &  * 6 6	"4 		8 	 ":  LH^1h ,* *Zl^8 8r   