o
    :ήcX                     @   s   d dl mZ d dlm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
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 )    )format_exception)Listc                   @      e Zd ZdZdS )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__ r   r   >/tmp/pip-target-vg8gfxp4/lib/python/anyio/_core/_exceptions.pyr          r   c                   @   r   )BrokenWorkerProcesszv
    Raised by :func:`run_sync_in_process` if the worker process terminates abruptly or otherwise
    misbehaves.
    Nr   r   r   r   r   r      r   r   c                       s&   e Zd ZdZdef fddZ  ZS )BusyResourceErrorzYRaised when two tasks are trying to read from or write to the same resource concurrently.actionc                       t  d| d d S )NzAnother task is already z this resourcesuper__init__)selfr   	__class__r   r   r      s   zBusyResourceError.__init__)r   r   r	   r
   strr   __classcell__r   r   r   r   r      s    r   c                   @   r   )ClosedResourceErrorz:Raised when trying to use a resource that has been closed.Nr   r   r   r   r   r      r   r   c                       s*   e Zd ZdZdeddf fddZ  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.
    	max_bytesreturnNc                    r   )Nz,The delimiter was not found among the first z bytesr   )r   r   r   r   r   r   $   s   
zDelimiterNotFound.__init__)r   r   r	   r
   intr   r   r   r   r   r   r      s    r   c                   @   r   )EndOfStreamzQRaised when trying to read from a stream that has been closed from the other end.Nr   r   r   r   r   r   *   r   r   c                   @   s>   e Zd ZU dZdZee ed< defddZ	defddZ
d	S )
ExceptionGroupz
    Raised when multiple exceptions have been raised in a task group.

    :var ~typing.Sequence[BaseException] exceptions: the sequence of exceptions raised together
    z----------------------------

exceptionsr   c                 C   s2   dd | j D }t| j  d| j | j| S )Nc                 S   s$   g | ]}d  tt|||jqS ) )joinr   type__traceback__.0excr   r   r   
<listcomp>:   s    z*ExceptionGroup.__str__.<locals>.<listcomp>z+ exceptions were raised in the task group:
)r!   len	SEPARATORr#   )r   
tracebacksr   r   r   __str__9   s   
zExceptionGroup.__str__c                 C   s,   d dd | jD }d| jj d| dS )Nz, c                 s   s    | ]}t |V  qd S )N)reprr&   r   r   r   	<genexpr>D   s    z*ExceptionGroup.__repr__.<locals>.<genexpr><z: >)r#   r!   r   r   )r   exception_reprsr   r   r   __repr__C   s   zExceptionGroup.__repr__N)r   r   r	   r
   r+   r   BaseException__annotations__r   r-   r3   r   r   r   r   r    .   s   
 
r    c                       s"   e Zd ZdZd fddZ  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.
    r   Nc                    s   t  d d S )NzBThe stream was closed before the read operation could be completedr   )r   r   r   r   r   O   s   zIncompleteRead.__init__)r   N)r   r   r	   r
   r   r   r   r   r   r   r6   H   s    r6   c                   @   r   )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   r   r7   U   r   r7   c                   @   r   )
WouldBlockz8Raised by ``X_nowait`` functions if ``X()`` would block.Nr   r   r   r   r   r8   \   r   r8   N)	tracebackr   typingr   	Exceptionr   r   r   r   r   r   r4   r    r6   LookupErrorr7   r8   r   r   r   r   <module>   s    