o
    0×¾gÉ  ã                   @   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
G d	d
„ d
eƒZG dd„ deƒZd dlmZ eeƒ dƒ dS )é    )Úabsolute_import)Údivision)Úprint_function)ÚWeakKeyDictionary)Úref)Úheappop)ÚheappushÚIdentRegistryc                   @   s   e Zd ZdZdZdS )ÚValuedWeakRefz.
    A weak ref with an associated value.
    )ÚvalueN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__© r   r   úW/var/www/html/backend_erp/backend_erp_env/lib/python3.10/site-packages/gevent/_ident.pyr
      s    r
   c                   @   s0   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
S )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                 C   s   t ƒ | _g | _d S ©N)r   Ú	_registryÚ_available_idents©Úselfr   r   r   Ú__init__&   s   
zIdentRegistry.__init__c                 C   sd   z| j | d W S  ty   Y n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Úvrefr   r   r   Ú	get_ident-   s   ÿ
zIdentRegistry.get_identc                 C   s   t d urt | j|jƒ d S d S r   )r   r   r   )r   r   r   r   r   r   D   s   üzIdentRegistry._return_identc                 C   s
   t | jƒS r   )r   r   r   r   r   r   Ú__len__M   s   
zIdentRegistry.__len__N)r   r   r   r   r   r   r   r    r   r   r   r   r	      s    		)Úimport_c_accelzgevent.__identN)Ú
__future__r   r   r   Úweakrefr   r   Úheapqr   r   Ú__all__r
   Úobjectr	   Úgevent._utilr!   Úglobalsr   r   r   r   Ú<module>   s   ÿ5