ó
ÐH/\c           @` sÉ   d  d l  m Z d  d l  m Z d  d l  m Z d  d l m Z d  d l m Z d  d l m Z d  d l m	 Z	 d g Z
 d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ d  d l m Z e e ƒ  d ƒ d S(   i    (   t   absolute_import(   t   division(   t   print_function(   t   WeakKeyDictionary(   t   ref(   t   heappop(   t   heappusht   IdentRegistryt   ValuedWeakRefc           B` s   e  Z d  Z d Z RS(   s.   
    A weak ref with an associated value.
    t   value(   R	   (   t   __name__t
   __module__t   __doc__t	   __slots__(    (    (    s,   lib/python2.7/site-packages/gevent/_ident.pyR      s   c           B` s2   e  Z d  Z d „  Z d „  Z d „  Z d „  Z RS(   s  
    Maintains a unique mapping of (small) positive integer identifiers
    to objects that can be weakly referenced.

    It is guaranteed that no two objects will have the the same
    identifier at the same time, as long as those objects are
    also uniquely hashable.
    c         C` s   t  ƒ  |  _ g  |  _ d  S(   N(   R   t	   _registryt   _available_idents(   t   self(    (    s,   lib/python2.7/site-packages/gevent/_ident.pyt   __init__&   s    c         C` sƒ   y |  j  | d SWn t k
 r& n X|  j rB t |  j ƒ } n t |  j  ƒ } t | |  j ƒ } | | _ | | f |  j  | <| S(   sW   
        Retrieve the identifier for *obj*, creating one
        if necessary.
        i    (   R   t   KeyErrorR   R   t   lenR   t   _return_identR	   (   R   t   objt   identt   vref(    (    s,   lib/python2.7/site-packages/gevent/_ident.pyt	   get_ident-   s    		c         C` s&   t  d  k	 r" t  |  j | j ƒ n  d  S(   N(   R   t   NoneR   R	   (   R   R   (    (    s,   lib/python2.7/site-packages/gevent/_ident.pyR   D   s    c         C` s   t  |  j ƒ S(   N(   R   R   (   R   (    (    s,   lib/python2.7/site-packages/gevent/_ident.pyt   __len__M   s    (   R
   R   R   R   R   R   R   (    (    (    s,   lib/python2.7/site-packages/gevent/_ident.pyR      s
   				(   t   import_c_accels   gevent.__identN(   t
   __future__R    R   R   t   weakrefR   R   t   heapqR   R   t   __all__R   t   objectR   t   gevent._utilR   t   globals(    (    (    s,   lib/python2.7/site-packages/gevent/_ident.pyt   <module>   s   	5