B
    H/\
                 @   s   d Z ddlmZ ddlmZ ddlmZ ddlmZ dddgZG d	d
 d
eej	Z
e
 Zdadd Zdd Zdd Zdd Zdd Zdd Zdd Zdd ZddlmZ ee d dS )z"
Maintains the thread local hub.

    )absolute_import)division)print_function)thread_mod_nameget_hubget_hub_noargsget_hub_if_existsc                   s   e Zd Z fddZ  ZS )_Threadlocalc                s$   t t|   d | _d | _d | _d S )N)superr	   __init__Hubloophub)self)	__class__ 0lib/python3.7/site-packages/gevent/_hub_local.pyr      s    z_Threadlocal.__init__)__name__
__module____qualname__r   __classcell__r   r   )r   r   r	      s   r	   Nc              C   s   t j} | dkrt } t _| S )zReturn the type of hub to use for the current thread.

    If there's no type of hub for the current thread yet, 'gevent.hub.Hub' is used.
    N)_threadlocalr   )hubtyper   r   r   get_hub_class(   s    
r   c             C   s   | a d S )N)r   )r   r   r   r   set_default_hub_class2   s    r   c              O   s(   t j}|dkr$t }|| | }t _|S )a  
    Return the hub for the current thread.

    If a hub does not exist in the current thread, a new one is
    created of the type returned by :func:`get_hub_class`.

    .. deprecated:: 1.3b1
       The ``*args`` and ``**kwargs`` arguments are deprecated. They were
       only used when the hub was created, and so were non-deterministic---to be
       sure they were used, *all* callers had to pass them, or they were order-dependent.
       Use ``set_hub`` instead.
    N)r   r   r   )argskwargsr   r   r   r   r   r   6   s
    c              C   s$   t j} | d kr t }|  } t _| S )N)r   r   r   )r   r   r   r   r   r   I   s
    c               C   s   t jS )z`Return the hub for the current thread.

    Return ``None`` if no hub has been created yet.
    )r   r   r   r   r   r   r   S   s    c             C   s
   | t _d S )N)r   r   )r   r   r   r   set_hub[   s    r   c               C   s   t jS )N)r   r   r   r   r   r   get_loop^   s    r   c             C   s
   | t _d S )N)r   r   )r   r   r   r   set_loopa   s    r   )import_c_accelzgevent.__hub_local)__doc__Z
__future__r   r   r   Zgevent._compatr   __all__
__import___localr	   r   r   r   r   r   r   r   r   r   r   Zgevent._utilr    globalsr   r   r   r   <module>   s(   

