HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/exceptiongroup/__pycache__/_exceptions.cpython-310.pyc
o

���g�+�@s�ddlmZddlmZmZddlmZddlmZm	Z	ddl
mZmZm
Z
mZmZmZededd�Zed	ed
�Zededd�Zeded
�Zed
dd
�Zeddd
�Zd#dd�Zd$dd�Zdd�ZGd d�deee�ZGd!d�deee�Zd"S)%�)�annotations)�Callable�Sequence)�partial)�getmro�isclass)�
TYPE_CHECKING�Generic�Type�TypeVar�cast�overload�_BaseExceptionT_coT)�bound�	covariant�_BaseExceptionT)r�_ExceptionT_co�_ExceptionT�_ExceptionGroupSelf�ExceptionGroup�_BaseExceptionGroupSelf�BaseExceptionGroup�exc�
BaseException�parents�tuple[type[BaseException]]�return�boolcCs*t|j�dd�D]	}||vrdSq	dS)N���TF)r�	__class__)rr�cls�r!�E/usr/local/lib/python3.10/dist-packages/exceptiongroup/_exceptions.py�check_direct_subclasss
�r#�	condition�`type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...] | Callable[[_BaseExceptionT_co], bool]�$Callable[[_BaseExceptionT_co], bool]cCstt|�rtttt|�t�rtt|fd�St|t�r-t	dd�|D��r)tt|d�Std��t
|�r6td|�Std��)N)rcss"�|]}t|�ot|t�VqdS�N)r�
issubclassr)�.0�xr!r!r"�	<genexpr>%s� z'get_condition_filter.<locals>.<genexpr>zCallable[[BaseException], bool]z?expected a function, exception type or tuple of exception types)rr(rr
rrr#�
isinstance�tuple�all�callable�	TypeError)r$r!r!r"�get_condition_filters
�
�
r1cCs<|�|�}|j|_|j|_|j|_t|d�rt|j�|_|S)N�	__notes__)�derive�	__cause__�__context__�
__traceback__�hasattr�listr2)�self�excs�egr!r!r"�_derive_and_copy_attributes-s

r<cs�eZdZdZd9�fd
d�Zd:dd�Zed;dd��Zed<dd��Ze	d=dd��Z
e	d>dd��Z
e	d?dd��Z
d@d!d�Z
e	dAd#d$��Ze	dBd&d$��Ze	dCd(d$��ZdDd+d$�Ze	dEd/d0��Ze	dFd3d0��ZdFd4d0�Zd;d5d6�Z
d;d7d8�Z�ZS)Grz/A combination of multiple unrelated exceptions.r �type[_BaseExceptionGroupSelf]�_BaseExceptionGroup__message�str�_BaseExceptionGroup__exceptions�Sequence[_BaseExceptionT_co]rrcs�t|t�stdt|�����t|t�std��|std��t|�D]\}}t|t�s2td|�d���q!|turBt	dd�|D��rBt
}t|t�ra|D]}t|t�s`|t
urXtd��td	|j
����qIt��|||�}||_||_|S)
Nzargument 1 must be str, not z/second argument (exceptions) must be a sequencez9second argument (exceptions) must be a non-empty sequencezItem z4 of second argument (exceptions) is not an exceptioncss�|]}t|t�VqdSr')r,�	Exception)r)rr!r!r"r+Ps�z-BaseExceptionGroup.__new__.<locals>.<genexpr>z/Cannot nest BaseExceptions in an ExceptionGroupzCannot nest BaseExceptions in )r,r?r0�typer�
ValueError�	enumeraterrr.rr(rB�__name__�super�__new__�_message�_exceptions)r r>r@�ir�instance�rr!r"rH;s@

�

��

�
��
zBaseExceptionGroup.__new__�note�NonecCsFt|t�std|�dt|�j�d���t|d�sg|_|j�|�dS)NzExpected a string, got note=z (type �)r2)r,r?r0rCrFr7r2�append)r9rNr!r!r"�add_noteds
�
zBaseExceptionGroup.add_notecCs|jSr')rI�r9r!r!r"�messageoszBaseExceptionGroup.message�Gtuple[_BaseExceptionT_co | BaseExceptionGroup[_BaseExceptionT_co], ...]cCs
t|j�Sr')r-rJrSr!r!r"�
exceptionsss
zBaseExceptionGroup.exceptions�_BaseExceptionGroup__condition�1type[_ExceptionT] | tuple[type[_ExceptionT], ...]�"ExceptionGroup[_ExceptionT] | NonecC�dSr'r!�r9rWr!r!r"�subgroupy�zBaseExceptionGroup.subgroup�9type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...]�*BaseExceptionGroup[_BaseExceptionT] | NonecCrZr'r!r[r!r!r"r\~r]�>Callable[[_BaseExceptionT_co | _BaseExceptionGroupSelf], bool]�-BaseExceptionGroup[_BaseExceptionT_co] | NonecCrZr'r!r[r!r!r"r\�s�ztype[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...] | Callable[[_BaseExceptionT_co | _BaseExceptionGroupSelf], bool]cCs�t|�}d}||�r|Sg}|jD](}t|t�r-|�|�}|dur&|�|�||ur,d}q||�r7|�|�qd}q|s>|S|rGt||�}|SdS)NFT)r1rVr,rr\rQr<)r9rWr$�modifiedrVrr\�groupr!r!r"r\�s,



�
�Xtuple[ExceptionGroup[_ExceptionT] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]cCrZr'r!r[r!r!r"�split��zBaseExceptionGroup.split�`tuple[BaseExceptionGroup[_BaseExceptionT] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]cCrZr'r!r[r!r!r"rf�rg�ctuple[BaseExceptionGroup[_BaseExceptionT_co] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]cCrZr'r!r[r!r!r"rf�sr%�!tuple[ExceptionGroup[_ExceptionT] | None, BaseExceptionGroup[_BaseExceptionT_co] | None] | tuple[BaseExceptionGroup[_BaseExceptionT] | None, BaseExceptionGroup[_BaseExceptionT_co] | None] | tuple[BaseExceptionGroup[_BaseExceptionT_co] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]c
Cs�t|�}||�r|dfSg}g}|jD]0}t|t�r4|�|�\}}|dur*|�|�|dur3|�|�q||�r>|�|�q|�|�qd}|rMt||�}d}	|rVt||�}	||	fSr')r1rVr,rrfrQr<)
r9rWr$�matching_exceptions�nonmatching_exceptionsr�matching�nonmatching�matching_group�nonmatching_groupr!r!r"rf�s2



�
��_BaseExceptionGroup__excs�Sequence[_ExceptionT]�ExceptionGroup[_ExceptionT]cCrZr'r!�r9rqr!r!r"r3�szBaseExceptionGroup.derive�Sequence[_BaseExceptionT]�#BaseExceptionGroup[_BaseExceptionT]cCrZr'r!rtr!r!r"r3�r]cCst|j|�Sr')rrTrtr!r!r"r3�scCs4t|j�dkr	dnd}|j�dt|j��d|�d�S)N���sz (z sub-exceptionrP)�lenrJrT)r9�suffixr!r!r"�__str__szBaseExceptionGroup.__str__cCs|jj�d|j�d|j�d�S)N�(z, rP)rrFrTrJrSr!r!r"�__repr__szBaseExceptionGroup.__repr__)r r=r>r?r@rArr)rNr?rrO)rr?)rrU)rWrXrrY)rWr^rr_)rWr`rra)rWrbrr_)rWrXrre)rWr^rrh)rWr`rri)rWr%rrj)rqrrrrs)rqrurrv)rF�
__module__�__qualname__�__doc__rHrR�propertyrTrVr
r\rfr3r|r~�
__classcell__r!r!rMr"r8s:
)
!
2

cs�eZdZd�fd	d
�ZerBed dd
��Zed!dd��Zed"dd��Zd#�fdd�Zed$dd��Z	ed%dd��Z	d&�fdd�Z	�Z
S�Z
S)'rr �type[_ExceptionGroupSelf]�_ExceptionGroup__messager?�_ExceptionGroup__exceptions�Sequence[_ExceptionT_co]rrcst��|||�Sr')rGrH)r r�r�rMr!r"rHszExceptionGroup.__new__�;tuple[_ExceptionT_co | ExceptionGroup[_ExceptionT_co], ...]cCrZr'r!rSr!r!r"rVr]zExceptionGroup.exceptions�_ExceptionGroup__conditionrXrYcCrZr'r!�r9r�r!r!r"r\r]zExceptionGroup.subgroup�6Callable[[_ExceptionT_co | _ExceptionGroupSelf], bool]�%ExceptionGroup[_ExceptionT_co] | NonecCrZr'r!r�r!r!r"r\r]�Ttype[_ExceptionT] | tuple[type[_ExceptionT], ...] | Callable[[_ExceptionT_co], bool]c�t��|�Sr')rGr\r�rMr!r"r\#s�Ptuple[ExceptionGroup[_ExceptionT] | None, ExceptionGroup[_ExceptionT_co] | None]cCrZr'r!r�r!r!r"rf+�zExceptionGroup.split�Stuple[ExceptionGroup[_ExceptionT_co] | None, ExceptionGroup[_ExceptionT_co] | None]cCrZr'r!r�r!r!r"rf2r�r9cr�r')rGrfr�rMr!r"rf9s)r r�r�r?r�r�rr)rr�)r�rXrrY)r�r�rr�)r�r�rrY)r�rXrr�)r�r�rr�)r9rr�r�rr�)rFrr�rHrr�rVr
r\rfr�r!r!rMr"r
s �N)rrrrrr)r$r%rr&)�
__future__r�collections.abcrr�	functoolsr�inspectrr�typingrr	r
rrr
rrrrBrrrrr#r1r<rrr!r!r!r"�<module>s" 


S