o
    0×¾g\  ã                   @   sž   d 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G d
d„ de
ƒZG dd„ de
ƒZG dd„ deƒZG dd„ deƒZdS )z'
Exceptions.

.. versionadded:: 1.3b1

é    )Úabsolute_import)Údivision)Úprint_function)ÚGreenletExitÚLoopExitc                   @   s,   e Zd ZdZedd„ ƒZdd„ Zdd„ ZdS )	r   a†  
    Exception thrown when the hub finishes running (`gevent.hub.Hub.run`
    would return).

    In a normal application, this is never thrown or caught
    explicitly. The internal implementation of functions like
    :meth:`gevent.hub.Hub.join` and :func:`gevent.joinall` may catch it, but user code
    generally should not.

    .. caution::
       Errors in application programming can also lead to this exception being
       raised. Some examples include (but are not limited too):

       - greenlets deadlocking on a lock;
       - using a socket or other gevent object with native thread
         affinity from a different thread

    c                 C   s   t | jƒdkr| jd S dS )z^
        The (optional) hub that raised the error.

        .. versionadded:: 20.12.0
        é   é   N)ÚlenÚargs©Úself© r   ú[/var/www/html/backend_erp/backend_erp_env/lib/python3.10/site-packages/gevent/exceptions.pyÚhub(   s   
ÿzLoopExit.hubc                 C   sF   t | jƒdkrdd l}d| jd | jd | | jd ¡f S t | ¡S )Nr   r   z%s
	Hub: %s
	Handles:
%sr   é   )r	   r
   ÚpprintÚpformatÚ	ExceptionÚ__repr__)r   r   r   r   r   r   3   s   ýü
	zLoopExit.__repr__c                 C   s   t | ƒS ©N)Úreprr   r   r   r   Ú__str__B   s   zLoopExit.__str__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr   r   r   r   r   r   r   r      s    

c                   @   ó   e Zd ZdZdS )ÚBlockingSwitchOutErrorz‘
    Raised when a gevent synchronous function is called from a
    low-level event loop callback.

    This is usually a programming error.
    N©r   r   r   r   r   r   r   r   r   E   ó    r   c                   @   r   )ÚInvalidSwitchErrorzŸ
    Raised when the event loop returns control to a greenlet in an
    unexpected way.

    This is usually a bug in gevent, greenlet, or the event loop.
    Nr   r   r   r   r   r!   N   r    r!   c                   @   r   )ÚConcurrentObjectUseErrora-  
    Raised when an object is used (waited on) by two greenlets
    independently, meaning the object was entered into a blocking
    state by one greenlet and then another while still blocking in the
    first one.

    This is usually a programming error.

    .. seealso:: `gevent.socket.wait`
    Nr   r   r   r   r   r"   V   r    r"   c                   @   r   )ÚInvalidThreadUseErrora—  
    Raised when an object is used from a different thread than
    the one it is bound to.

    Some objects, such as gevent sockets, semaphores, and threadpools,
    are tightly bound to their hub and its loop. The hub and loop
    are not thread safe, with a few exceptions. Attempting to use
    such objects from a different thread is an error, and may cause
    problems ranging from incorrect results to memory corruption
    and a crashed process.

    In some cases, gevent catches this "accidentally", and the result is
    a `LoopExit`. In some cases, gevent doesn't catch this at all.

    In other cases (typically when the consequences are suspected to
    be more on the more severe end of the scale, and when the operation in
    question is already relatively heavyweight), gevent explicitly checks
    for this usage and will raise this exception when it is detected.

    .. versionadded:: 1.5a3
    Nr   r   r   r   r   r#   b   r    r#   c                   @   s   e Zd ZdZdd„ ZdS )ÚHubDestroyeda   
    Internal exception, raised when we're trying to destroy the
    hub and we want the loop to stop running callbacks now.

    This must not be subclassed; the type is tested by identity.

    Clients outside of gevent must not raise this exception.

    .. versionadded:: 20.12.0
    c                 C   s   t  | |¡ || _d S r   )r   Ú__init__Údestroy_loop)r   r&   r   r   r   r%   †   s   
zHubDestroyed.__init__N)r   r   r   r   r%   r   r   r   r   r$   z   s    r$   N)r   Ú
__future__r   r   r   Úgreenletr   Ú__all__r   r   ÚAssertionErrorr   r!   r"   ÚRuntimeErrorr#   r$   r   r   r   r   Ú<module>   s   ÿ1	