
    h                       d dl mZ d dlZd dlmZ d dlmZ d dlmZ ej                  dk  rd dl
mZ  G d d	e      Z G d
 de      Z G d de      Z G d de      Z G d de      Z G d de      Z	 	 	 	 d#dZ G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d d e      Z G d! d"e      Zy)$    )annotationsN)	Generator)dedent)Any)      )BaseExceptionGroupc                      e Zd ZdZy)BrokenResourceErrorz
    Raised when trying to use a resource that has been rendered unusable due to external
    causes (e.g. a send stream whose peer has disconnected).
    N__name__
__module____qualname____doc__     <D:\jyotish\venv\Lib\site-packages\anyio/_core/_exceptions.pyr   r          r   r   c                      e Zd ZdZy)BrokenWorkerProcessz}
    Raised by :meth:`~anyio.to_process.run_sync` if the worker process terminates abruptly or
    otherwise misbehaves.
    Nr   r   r   r   r   r      r   r   r   c                  0     e Zd ZdZd fdZd fdZ xZS )BrokenWorkerInterpreterzz
    Raised by :meth:`~anyio.to_interpreter.run_sync` if an unexpected exception is
    raised in the subinterpreter.
    c                   |j                   }|sb|j                  r2|j                  r&|j                  j                   d|j                   }n$|j                  j                  xs |j                  }t        |   |       || _        y )Nz: )	formattedtypemsgr   super__init__excinfo)selfr   r   	__class__s      r   r   z BrokenWorkerInterpreter.__init__    si    || ../r'++?ll++:w{{r   c                    	 | j                   j                  }t        dt        |           d| dj                               S # t        $ r t        |          cY S w xY w)Nz
                z@

                Uncaught in the interpreter:

                )r   
errdisplayr   r   __str__strip	Exception)r    r   r!   s     r   r$   zBrokenWorkerInterpreter.__str__,   su    	//I "# $   EG   	%7?$$	%s   A AA)r   r   )returnstr)r   r   r   r   r   r$   __classcell__r!   s   @r   r   r      s    

 r   r   c                  $     e Zd ZdZd fdZ xZS )BusyResourceErrorzg
    Raised when two tasks are trying to read from or write to the same resource
    concurrently.
    c                ,    t         |   d| d       y )NzAnother task is already z this resourcer   r   )r    actionr!   s     r   r   zBusyResourceError.__init__C   s    3F8>JKr   )r/   r(   r   r   r   r   r   r)   r*   s   @r   r,   r,   =   s    
L Lr   r,   c                      e Zd ZdZy)ClosedResourceErrorz:Raised when trying to use a resource that has been closed.Nr   r   r   r   r2   r2   G   s    Dr   r2   c                      e Zd ZdZy)ConnectionFailedz
    Raised when a connection attempt fails.

    .. note:: This class inherits from :exc:`OSError` for backwards compatibility.
    Nr   r   r   r   r4   r4   K   s    r   r4   c              #     K   t        | t              r%| j                  D ]  }t        |      E d {     y |  y 7 w)N)
isinstancer	   
exceptionsiterate_exceptions)	exceptionexcs     r   r8   r8   S   s=      )/0''C)#... (  /s   .?=?c                  $     e Zd ZdZd fdZ xZS )DelimiterNotFoundz
    Raised during
    :meth:`~anyio.streams.buffered.BufferedByteReceiveStream.receive_until` if the
    maximum number of bytes has been read without the delimiter being found.
    c                ,    t         |   d| d       y )Nz,The delimiter was not found among the first z bytesr.   )r    	max_bytesr!   s     r   r   zDelimiterNotFound.__init__d   s    :9+VL	
r   )r>   intr'   Noner0   r*   s   @r   r<   r<   ]   s    
 
r   r<   c                      e Zd ZdZy)EndOfStreamz[
    Raised when trying to read from a stream that has been closed from the other end.
    Nr   r   r   r   rB   rB   j   s    r   rB   c                  $     e Zd ZdZd fdZ xZS )IncompleteReada  
    Raised during
    :meth:`~anyio.streams.buffered.BufferedByteReceiveStream.receive_exactly` or
    :meth:`~anyio.streams.buffered.BufferedByteReceiveStream.receive_until` if the
    connection is closed before the requested amount of bytes has been read.
    c                $    t         |   d       y )NzBThe stream was closed before the read operation could be completedr.   r    r!   s    r   r   zIncompleteRead.__init__x   s    P	
r   r'   r@   r0   r*   s   @r   rD   rD   p   s    
 
r   rD   c                      e Zd ZdZy)TypedAttributeLookupErrorz
    Raised by :meth:`~anyio.TypedAttributeProvider.extra` when the given typed attribute
    is not found and no default value has been given.
    Nr   r   r   r   rI   rI   ~   r   r   rI   c                      e Zd ZdZy)
WouldBlockz8Raised by ``X_nowait`` functions if ``X()`` would block.Nr   r   r   r   rK   rK      s    Br   rK   c                      e Zd ZdZy)NoEventLoopErrorz
    Raised by :func:`.from_thread.run` and :func:`.from_thread.run_sync` if
    not calling from an AnyIO worker thread, and no ``token`` was passed.
    Nr   r   r   r   rM   rM      r   r   rM   c                  $     e Zd ZdZd fdZ xZS )RunFinishedErrorz
    Raised by :func:`.from_thread.run` and :func:`.from_thread.run_sync` if the event
    loop associated with the explicitly passed token has already finished.
    c                $    t         |   d       y )NzCThe event loop associated with the given token has already finishedr.   rF   s    r   r   zRunFinishedError.__init__   s    Q	
r   rG   r0   r*   s   @r   rO   rO      s    

 
r   rO   )r9   BaseExceptionr'   z$Generator[BaseException, None, None])
__future__r   syscollections.abcr   textwrapr   typingr   version_infoexceptiongroupr	   r&   r   r   r   r,   r2   OSErrorr4   r8   r<   rB   rD   LookupErrorrI   rK   RuntimeErrorrM   rO   r   r   r   <module>r\      s    " 
 %  g1) )  i  FL	 LE) Ew )

	 

) 
Y 
 C C| 	
| 	
r   