
    <|h                         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
 G d	 d
e      Z G d de      Zd dlmZ  e e       d       y)    )absolute_import)division)print_function)WeakKeyDictionary)ref)heappop)heappushIdentRegistryc                       e Zd ZdZdZy)ValuedWeakRefz.
    A weak ref with an associated value.
    )valueN)__name__
__module____qualname____doc__	__slots__     L/var/www/html/test/engine/venv/lib/python3.12/site-packages/gevent/_ident.pyr   r      s     Ir   r   c                   (    e Zd ZdZd Zd Zd Zd Zy)r
   a  
    Maintains a unique mapping of (small) non-negative 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                 0    t               | _        g | _        y N)r   	_registry_available_identsselfs    r   __init__zIdentRegistry.__init__&   s    *, "$r   c                    	 | j                   |   d   S # t        $ r Y nw xY w| j                  rt        | j                        }nt	        | j                         }t        || j                        }||_        ||f| j                   |<   |S )zW
        Retrieve the identifier for *obj*, creating one
        if necessary.
        r   )r   KeyErrorr   r   lenr   _return_identr   )r   objidentvrefs       r   	get_identzIdentRegistry.get_ident-   s    	>>#&q)) 		 !!D223E 'ES$"4"45
$dmss    	  c                 R    t         !t        | j                  |j                         y y r   )r	   r   r   )r   r$   s     r   r!   zIdentRegistry._return_identD   s%      T++TZZ8	  r   c                 ,    t        | j                        S r   )r    r   r   s    r   __len__zIdentRegistry.__len__M   s    4>>""r   N)r   r   r   r   r   r%   r!   r(   r   r   r   r
   r
      s    $.9#r   )import_c_accelzgevent.__identN)
__future__r   r   r   weakrefr   r   heapqr   r	   __all__r   objectr
   gevent._utilr)   globalsr   r   r   <module>r1      sU   
 '  % &    C 2#F 2#j ( wy* +r   