
    i                        d Z ddlmZ ddlmZ ddlmZ ddlZg dZd eej                  vsJ  G d d	ej                  Z	 e	            Z
dad
 Zd Zd Zd Zd Zd Zd Zd ZddlmZ  e e            d           dS )z"
Maintains the thread local hub.

    )absolute_import)division)print_functionN)get_hubget_hub_noargsget_hub_if_existsgeventc                        e Zd Z fdZ xZS )_Threadlocalc                     t          t          |                                            d | _        d | _        d | _        d S N)superr   __init__Hubloophub)self	__class__s    </usr/local/lib/python3.11/dist-packages/gevent/_hub_local.pyr   z_Threadlocal.__init__   s:    2 	lD!!**,,,	    )__name__
__module____qualname__r   __classcell__)r   s   @r   r   r      s8                r   r   c                  p    	 t           j        } n# t          $ r d} Y nw xY w| t          x} 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   AttributeErrorhubtypes    r   get_hub_classr    =   sN    
"    %((,"N    c                 
    | a d S r   )r   r   s    r   set_default_hub_classr#   K   s    
CCCr   c                      	 t           j        } n# t          $ r d} Y nw xY w| $t                      } |            x} 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.

    .. versionchanged:: 1.5a3
       The *args* and *kwargs* arguments are now completely ignored.

    .. versionchanged:: 23.7.0
       The long-deprecated ``args`` and ``kwargs`` parameters are no
       longer accepted.
    Nr   r   r   r    r   r   s     r   r   r   O   s[    *   
{//!(*lJr!   c                      	 t           j        } n# t          $ r d } Y nw xY w| $t                      } |            x} t           _        | S r   r%   r&   s     r   r   r   o   s[       
{//!(*lJr!   c                  >    	 t           j        S # t          $ r Y dS w xY w)ze
    Return the hub for the current thread.

    Return ``None`` if no hub has been created yet.
    N)r   r   r    r   r   r   r   z   s4        tts    
c                     | t           _        d S r   )r   r   )r   s    r   set_hubr+      s    Lr   c                      t           j        S r   r   r   r)   r   r   get_loopr.      s    r   c                     | t           _        d S r   r-   )r   s    r   set_loopr0      s    Lr   )import_c_accelzgevent.__hub_local)__doc__
__future__r   r   r   _thread__all__str_localr   r   r   r    r#   r   r   r   r+   r.   r0   gevent._utilr1   globalsr)   r   r   <module>r:      sm    ' & & & & &       % % % % % %    ss7>******    7>   @ |~~
      @	 	 	  ,       ( ' ' ' ' ' wwyy. / / / / /r   