3
Z_ð]Í  ã               @   sP   d dl Z d dlmZ ddgZdd„ ZG dd„ deƒZdd	„ ZG d
d„ deƒZdS )é    N)ÚgreenthreadÚ	get_identÚlocalc               C   s   t tjƒ ƒS )z= Returns ``id()`` of current greenlet.  Useful for debugging.)Úidr   Ú
getcurrent© r   r   ú6/tmp/pip-build-yz_zf6az/eventlet/eventlet/corolocal.pyr      s    c               @   s   e Zd ZdZdd„ ZdS )Ú
_localbaseÚ_local__argsÚ_local__greensc             O   sN   t j| ƒ}t j|d||fƒ t j|dtjƒ ƒ |s6|rJ| jt jkrJtdƒ‚|S )Nr
   r   z*Initialization arguments are not supported)ÚobjectÚ__new__Ú__setattr__ÚweakrefÚWeakKeyDictionaryÚ__init__Ú	TypeError)ÚclsÚargsÚkwÚselfr   r   r   r      s    
z_localbase.__new__N)r
   r   )Ú__name__Ú
__module__Ú__qualname__Ú	__slots__r   r   r   r   r   r	      s   r	   c             C   sj   t j| dƒ}tjƒ }||krTi ||< t| ƒ}|jt jk	rTt j| dƒ\}}| j||Ž t j| d|| ƒ d S )Nr   r
   Ú__dict__)r   Ú__getattribute__r   r   Útyper   r   )ZthrlZgreensÚcurr   r   r   r   r   r   Ú_patch   s    r   c               @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )r   c             C   s   t | ƒ tj| |ƒS )N)r   r   r   )r   Úattrr   r   r   r   +   s    zlocal.__getattribute__c             C   s   t | ƒ tj| ||ƒS )N)r   r   r   )r   r    Úvaluer   r   r   r   /   s    zlocal.__setattr__c             C   s   t | ƒ tj| |ƒS )N)r   r   Ú__delattr__)r   r    r   r   r   r"   3   s    zlocal.__delattr__N)r   r   r   r   r   r"   r   r   r   r   r   *   s   )	r   Zeventletr   Ú__all__r   r   r	   r   r   r   r   r   r   Ú<module>   s   