
    Hwgm                         d dl Z d dlZd dlmZmZmZ  G d de      Z G d de      Z	eZ
e	Z G d d      Z G d	 d
e      Z G d de      Z G d d      Zy)    N)iscoroutinefunctionmarkcoroutinefunctionsync_to_asyncc                       e Zd Zy)RemovedInDjango50WarningN__name__
__module____qualname__     O/var/www/horilla/myenv/lib/python3.12/site-packages/django/utils/deprecation.pyr   r          r   r   c                       e Zd Zy)RemovedInDjango51WarningNr   r   r   r   r   r      r   r   r   c                       e Zd Zd Zd Zy)warn_about_renamed_methodc                 <    || _         || _        || _        || _        y )N)
class_nameold_method_namenew_method_namedeprecation_warning)selfr   r   r   r   s        r   __init__z"warn_about_renamed_method.__init__   s#     %..#6 r   c                       fd}|S )Nc            	          t        j                  dj                  dj                  dj                  dj
                  d        | i |S )N`.` is deprecated, use `
` instead.   )warningswarnr   r   r   r   )argskwargsfr   s     r   wrapperz3warn_about_renamed_method.__call__.<locals>.wrapper   sJ    MM??D$8$8$:N:NP((	 d%f%%r   r   )r   r&   r'   s   `` r   __call__z"warn_about_renamed_method.__call__   s    	& r   N)r	   r
   r   r   r(   r   r   r   r   r      s    7
r   r   c                   &     e Zd ZdZdZ fdZ xZS )RenameMethodsBasea#  
    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         |   | |||      }t        j                  |      D ]  }|j                  }| j
                  D ]  }|d   }|j                  j                  |      }	|d   }
|j                  j                  |
      }|d   }t        |g| }|sC|	rAt        j                  d|d|d|
d|d       t        ||
|	       t        || ||	             |	r|st        || ||               |S )Nr      r!   r   r   z` method should be renamed `z`.)super__new__inspectgetmror	   renamed_methods__dict__getr   r"   r#   setattr)clsnamebasesattrs	new_classbaser   renamed_methodr   
old_methodr   
new_methodr   r'   	__class__s                 r   r.   zRenameMethodsBase.__new__7   s   GOCue<	NN9- 	HDJ"%"5"5 H"0"3!]]..?
"0"3!]]..?
&4Q&7#3JPP "jMM%I+	 D/:>D/7:3FG "jD/7:3FG+H	H2 r   )r	   r
   r   __doc__r1   r.   __classcell__r>   s   @r   r*   r*   )   s    	 O r   r*   c                        e Zd Z fdZ xZS )DeprecationInstanceCheckc                     t        j                  d| j                  d| j                  d| j                  d       t
        |   |      S )Nr   r   r    r!   )r"   r#   r	   alternativer   r-   __instancecheck__)r   instancer>   s     r   rF   z*DeprecationInstanceCheck.__instancecheck__W   s?    7;}}dFVFVW$$	

 w(22r   )r	   r
   r   rF   r@   rA   s   @r   rC   rC   V   s    3 3r   rC   c                   >     e Zd ZdZdZ fdZd Zd Zd Zd Z	 xZ
S )MiddlewareMixinTc                 j    |t        d      || _        | j                          t        |           y )Nzget_response must be provided.)
ValueErrorget_response_async_checkr-   r   )r   rL   r>   s     r   r   zMiddlewareMixin.__init__d   s4    =>>(r   c                     d| j                   j                  dt        | j                  d| j                  j                   j                        dS )N<z get_response=r   >)r>   r   getattrrL   r	   r   s    r   __repr__zMiddlewareMixin.__repr__k   sB    NN''!!!!++44
 	
r   c                 F    t        | j                        rt        |        yy)z
        If get_response is a coroutine function, turns us into async mode so
        a thread is not consumed during a whole request.
        N)r   rL   r   rR   s    r   rM   zMiddlewareMixin._async_checku   s!    
 t001 "$' 2r   c                     t        |       r| j                  |      S d }t        | d      r| j                  |      }|xs | j	                  |      }t        | d      r| j                  ||      }|S )Nprocess_requestprocess_response)r   	__acall__hasattrrV   rL   rW   r   requestresponses      r   r(   zMiddlewareMixin.__call__   sp    t$>>'**4*+++G4H9t0094+,,,Wh?Hr   c                   K   d}t        | d      r% t        | j                  d      |       d{   }|xs | j                  |       d{   }t        | d      r& t        | j                  d      ||       d{   }|S 7 U7 :7 
w)zh
        Async version of __call__ that is swapped in when an async request
        is running.
        NrV   T)thread_sensitiverW   )rY   r   rV   rL   rW   rZ   s      r   rX   zMiddlewareMixin.__acall__   s     
 4*+]$$!%  H ?T%6%6w%??4+,]%%!% x! !H   @!s3   /BBBB	1B BB	BB)r	   r
   r   sync_capableasync_capabler   rS   rM   r(   rX   r@   rA   s   @r   rI   rI   `   s&    LM
(
r   rI   )r/   r"   asgiref.syncr   r   r   DeprecationWarningr   PendingDeprecationWarningr   RemovedInNextVersionWarningRemovedAfterNextVersionWarningr   typer*   rC   rI   r   r   r   <module>rg      sf      R R	1 		8 	 7 !9  ,* *Z3t 3< <r   