î
ªÍ X9  ã               @   sÛ   d  d l  m Z d  d l Z d  d l Z Gd d „  d e ƒ Z Gd d „  d e ƒ Z Gd d „  d e ƒ Z	 Gd	 d
 „  d
 e
 ƒ Z Gd d „  d e
 ƒ Z Gd d „  d ƒ Z e d ƒ Z e d ƒ Z Gd d „  d e ƒ Z d S)é    )Úabsolute_importNc               @   s   e  Z d  Z d S)ÚRemovedInDjango20WarningN)Ú__name__Ú
__module__Ú__qualname__© r   r   úF/home/ubuntu/projects/ifolica/build/django/django/utils/deprecation.pyr      s   r   c               @   s   e  Z d  Z d S)ÚRemovedInNextVersionWarningN)r   r   r   r   r   r   r   r	      s   r	   c               @   s(   e  Z d  Z d d „  Z d d „  Z d S)Úwarn_about_renamed_methodc             C   s(   | |  _  | |  _ | |  _ | |  _ d  S)N)Ú
class_nameÚold_method_nameÚnew_method_nameÚdeprecation_warning)Úselfr   r   r   r   r   r   r   Ú__init__   s    			z"warn_about_renamed_method.__init__c                s   ‡  ‡ f d d †  } | S)Nc                 s9   t  j d ˆ j ˆ j ˆ j f ˆ j d ƒ ˆ  |  | Ž  S)Nz(`%s.%s` is deprecated, use `%s` instead.é   )ÚwarningsÚwarnr   r   r   r   )ÚargsÚkwargs)Úfr   r   r   Úwrapped   s
    z3warn_about_renamed_method.__call__.<locals>.wrappedr   )r   r   r   r   )r   r   r   Ú__call__   s    z"warn_about_renamed_method.__call__N)r   r   r   r   r   r   r   r   r   r
      s   r
   c                   s.   e  Z d  Z d Z f  Z ‡  f d d †  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.
    c                s)  t  t |  ƒ j |  | | | ƒ } xt j | ƒ D]ð } | j } xÞ |  j D]Ó } | d } | j j | ƒ }	 | d }
 | j j |
 ƒ } | d } t	 | | Œ } | r÷ |	 r÷ t
 j d | | |
 f | d ƒ t | |
 |	 ƒ t | | | |	 ƒ ƒ n  |	 rJ | rJ t | | | | ƒ ƒ qJ qJ Wq1 W| S)Nr   é   r   z&`%s.%s` method should be renamed `%s`.)Úsuperr   Ú__new__ÚinspectZgetmror   Úrenamed_methodsÚ__dict__Úgetr
   r   r   Úsetattr)ÚclsÚnameÚbasesÚattrsÚ	new_classÚbaser   Zrenamed_methodr   Z
old_methodr   Z
new_methodr   Úwrapper)Ú	__class__r   r   r   .   s(    !	



!zRenameMethodsBase.__new__)r   r   r   Ú__doc__r   r   r   r   )r)   r   r       s   
r   c                   s"   e  Z d  Z ‡  f d d †  Z ‡  S)ÚDeprecationInstanceCheckc                s<   t  j d |  j |  j f |  j d ƒ t t |  ƒ j | ƒ S)Nz%`%s` is deprecated, use `%s` instead.r   )r   r   r   Úalternativer   r   r+   Ú__instancecheck__)r   Úinstance)r)   r   r   r-   L   s    z*DeprecationInstanceCheck.__instancecheck__)r   r   r   r-   r   r   )r)   r   r+   K   s   r+   c               @   s|   e  Z d  Z d Z d Z d d „  Z d d „  Z d d „  Z d	 d
 „  Z d d „  Z	 d d „  Z
 d d „  Z d d „  Z d S)ÚCallableBoolzS
    An boolean-like object that is also callable for backwards compatibility.
    Tc             C   s   | |  _  d  S)N)Úvalue)r   r0   r   r   r   r   Z   s    zCallableBool.__init__c             C   s   |  j  S)N)r0   )r   r   r   r   Ú__bool__]   s    zCallableBool.__bool__c             C   s   t  j d t d d ƒ|  j S)Nz‚Using user.is_authenticated() and user.is_anonymous() as a method is deprecated. Remove the parentheses to use it as an attribute.Ú
stacklevelr   )r   r   r   r0   )r   r   r   r   r   `   s    zCallableBool.__call__c             C   s   |  j  S)N)r0   )r   r   r   r   Ú__nonzero__h   s    zCallableBool.__nonzero__c             C   s   d |  j  S)NzCallableBool(%r))r0   )r   r   r   r   Ú__repr__k   s    zCallableBool.__repr__c             C   s   |  j  | k S)N)r0   )r   Úotherr   r   r   Ú__eq__n   s    zCallableBool.__eq__c             C   s   |  j  | k S)N)r0   )r   r5   r   r   r   Ú__ne__q   s    zCallableBool.__ne__c             C   s   t  |  j p | ƒ S)N)Úboolr0   )r   r5   r   r   r   Ú__or__t   s    zCallableBool.__or__N)r   r   r   r*   Zdo_not_call_in_templatesr   r1   r   r3   r4   r6   r7   r9   r   r   r   r   r/   T   s   r/   FTc                   s1   e  Z d  Z d ‡  f d d † Z d d „  Z ‡  S)ÚMiddlewareMixinNc                s    | |  _  t t |  ƒ j ƒ  d  S)N)Úget_responser   r:   r   )r   r;   )r)   r   r   r   |   s    	zMiddlewareMixin.__init__c             C   sg   d  } t  |  d ƒ r' |  j | ƒ } n  | s? |  j | ƒ } n  t  |  d ƒ rc |  j | | ƒ } n  | S)NÚprocess_requestÚprocess_response)Úhasattrr<   r;   r=   )r   ÚrequestÚresponser   r   r   r   €   s    zMiddlewareMixin.__call__)r   r   r   r   r   r   r   )r)   r   r:   {   s   r:   )Ú
__future__r   r   r   ÚPendingDeprecationWarningr   ÚDeprecationWarningr	   Úobjectr
   Útyper   r+   r/   ZCallableFalseZCallableTruer:   r   r   r   r   Ú<module>   s   +	#