ó
®â0_c           @   s0   d  Z  d d l m Z d e f d „  ƒ  YZ d S(   sO  
weakref_backports is a partial backport of the weakref module for python
versions below 3.4.

Copyright (C) 2013 Python Software Foundation, see LICENSE.python for details.

The following changes were made to the original sources during backporting:

 * Added `self` to `super` calls.
 * Removed `from None` when raising exceptions.

iÿÿÿÿ(   t   reft
   WeakMethodc           B   sD   e  Z d  Z d	 Z d
 d „ Z d „  Z d „  Z d „  Z e	 j
 Z
 RS(   s—   
    A custom `weakref.ref` subclass which simulates a weak reference to
    a bound method, working around the lifetime problem of bound methods.
    t	   _func_reft
   _meth_typet   _alivet   __weakref__c            s¦   y | j  } | j } Wn, t k
 rD t d j t | ƒ ƒ ƒ ‚ n X‡  ‡ f d †  } t j |  | | ƒ } t | | ƒ | _ t | ƒ | _	 t
 | _ t | ƒ ‰ | S(   Ns)   argument should be a bound method, not {}c            s;   ˆ ƒ  } | j  r7 t | _  ˆ  d  k	 r7 ˆ  | ƒ q7 n  d  S(   N(   R   t   Falset   None(   t   argt   self(   t   callbackt   self_wr(    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/dispatch/weakref_backports.pyt   _cb   s
    			(   t   __self__t   __func__t   AttributeErrort	   TypeErrort   formatt   typeR    t   __new__R   R   t   TrueR   (   t   clst   methR
   t   objt   funcR   R	   (    (   R
   R   sC   /tmp/pip-unpacked-wheel-BAJOf3/django/dispatch/weakref_backports.pyR      s    			c         C   sM   t  t |  ƒ j ƒ  } |  j ƒ  } | d  k s9 | d  k r= d  S|  j | | ƒ S(   N(   t   superR   t   __call__R   R   R   (   R	   R   R   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/dispatch/weakref_backports.pyR   .   s
    c         C   sS   t  | t ƒ rO |  j s# | j r- |  | k St j |  | ƒ oN |  j | j k St S(   N(   t
   isinstanceR   R   R    t   __eq__R   R   (   R	   t   other(    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/dispatch/weakref_backports.pyR   5   s
    
"c         C   sS   t  | t ƒ rO |  j s# | j r- |  | k	 St j |  | ƒ pN |  j | j k St S(   N(   R   R   R   R    t   __ne__R   R   (   R	   R   (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/dispatch/weakref_backports.pyR   <   s
    
"(   R   R   R   R   N(   t   __name__t
   __module__t   __doc__t	   __slots__R   R   R   R   R   R    t   __hash__(    (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/dispatch/weakref_backports.pyR      s   			N(   R!   t   weakrefR    R   (    (    (    sC   /tmp/pip-unpacked-wheel-BAJOf3/django/dispatch/weakref_backports.pyt   <module>   s   