o
    "“iÇ,  ã                   @  s  d dl mZ d dlZd dlmZmZ d dlmZ d dlm	Z	m
Z
 d dlmZmZmZmZmZmZ ejdk r;d dlmZ ed	ed
ed�Zeded�Zeded
ed�Zeded�Zeddd�Zeddd�Zd%dd„Zd&dd „Zd!d"„ ZG d#d„ deee ƒZG d$d„ dee eƒZ dS )'é    )ÚannotationsN)ÚCallableÚSequence)Úpartial)ÚgetmroÚisclass)ÚTYPE_CHECKINGÚGenericÚTypeÚTypeVarÚcastÚoverload)é   é   )r   Ú_BaseExceptionT_coT)ÚboundÚ	covariantÚdefaultÚ_BaseExceptionT)r   Ú_ExceptionT_coÚ_ExceptionTÚ_ExceptionGroupSelfÚExceptionGroupÚ_BaseExceptionGroupSelfÚBaseExceptionGroupÚexcÚBaseExceptionÚparentsútuple[type[BaseException]]ÚreturnÚboolc                 C  s*   t | jƒd d… D ]	}||v r dS q	dS )NéÿÿÿÿTF)r   Ú	__class__)r   r   Úcls© r$   úZ/var/www/html/premium_crap/venv/lib/python3.10/site-packages/exceptiongroup/_exceptions.pyÚcheck_direct_subclass   s
   ÿr&   Ú	conditionú`type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...] | Callable[[_BaseExceptionT_co], bool]ú$Callable[[_BaseExceptionT_co], bool]c                 C  st   t | ƒrtttt | ƒtƒrtt| fd�S t| tƒr-t	dd„ | D ƒƒr)tt| d�S tdƒ‚t
| ƒr6td| ƒS tdƒ‚)N)r   c                 s  s"   � | ]}t |ƒot|tƒV  qd S ©N)r   Ú
issubclassr   )Ú.0Úxr$   r$   r%   Ú	<genexpr>-   s   €  z'get_condition_filter.<locals>.<genexpr>zCallable[[BaseException], bool]z?expected a function, exception type or tuple of exception types)r   r+   r   r
   r   r   r&   Ú
isinstanceÚtupleÚallÚcallableÚ	TypeError)r'   r$   r$   r%   Úget_condition_filter#   s   
ÿ
ý
r4   c                 C  s<   |   |¡}| j|_| j|_| j|_t| dƒrt| jƒ|_|S )NÚ	__notes__)ÚderiveÚ	__cause__Ú__context__Ú__traceback__ÚhasattrÚlistr5   )ÚselfÚexcsÚegr$   r$   r%   Ú_derive_and_copy_attributes5   s   

r?   c                      sô   e Zd ZdZd=‡ fd
d„Zd>dd„Zd?dd„Zed@dd„ƒZedAdd„ƒZ	e
dBdd„ƒZe
dCd d„ƒZe
dDd#d„ƒZdEd%d„Ze
dFd'd(„ƒZe
dGd*d(„ƒZe
dHd,d(„ƒZdId/d(„Ze
dJd3d4„ƒZe
dKd7d4„ƒZdKd8d4„Zd@d9d:„Zd@d;d<„Z‡  ZS )Lr   z/A combination of multiple unrelated exceptions.r#   útype[_BaseExceptionGroupSelf]Ú_BaseExceptionGroup__messageÚstrÚ_BaseExceptionGroup__exceptionsúSequence[_BaseExceptionT_co]r   r   c                   sà   t |tƒstdt|ƒ› �ƒ‚t |tƒstdƒ‚|stdƒ‚t|ƒD ]\}}t |tƒs2td|› d�ƒ‚q!| tu rBt	dd„ |D ƒƒrBt
} t| tƒra|D ]}t |tƒs`| t
u rXtdƒ‚td	| j›�ƒ‚qItƒ  | ||¡}t|ƒ|_|S )
Nzargument 1 must be str, not z/second argument (exceptions) must be a sequencez9second argument (exceptions) must be a non-empty sequencezItem z4 of second argument (exceptions) is not an exceptionc                 s  s   � | ]}t |tƒV  qd S r*   )r/   Ú	Exception)r,   r   r$   r$   r%   r.   X   s   € z-BaseExceptionGroup.__new__.<locals>.<genexpr>z/Cannot nest BaseExceptions in an ExceptionGroupzCannot nest BaseExceptions in )r/   rB   r3   Útyper   Ú
ValueErrorÚ	enumerater   r   r1   r   r+   rE   Ú__name__ÚsuperÚ__new__r0   Ú_exceptions)r#   rA   rC   Úir   Úinstance©r"   r$   r%   rK   C   s>   

ÿ

ÿÿ

ÿ
ÿú

zBaseExceptionGroup.__new__ÚargsÚobjectÚNonec                 G  s   t j| ||g|¢R Ž  d S r*   )r   Ú__init__)r<   rA   rC   rP   r$   r$   r%   rS   k   s   zBaseExceptionGroup.__init__Únotec                 C  sF   t |tƒstd|›dt|ƒj› d�ƒ‚t| dƒsg | _| j |¡ d S )NzExpected a string, got note=z (type ú)r5   )r/   rB   r3   rF   rI   r:   r5   Úappend)r<   rT   r$   r$   r%   Úadd_notes   s   
ÿ
zBaseExceptionGroup.add_notec                 C  s
   | j d S )Nr   )rP   ©r<   r$   r$   r%   Úmessage~   s   
zBaseExceptionGroup.messageúGtuple[_BaseExceptionT_co | BaseExceptionGroup[_BaseExceptionT_co], ...]c                 C  s
   t | jƒS r*   )r0   rL   rX   r$   r$   r%   Ú
exceptions‚   s   
zBaseExceptionGroup.exceptionsÚ_BaseExceptionGroup__conditionú1type[_ExceptionT] | tuple[type[_ExceptionT], ...]ú"ExceptionGroup[_ExceptionT] | Nonec                 C  ó   d S r*   r$   ©r<   r\   r$   r$   r%   Úsubgroupˆ   ó   zBaseExceptionGroup.subgroupú9type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...]ú*BaseExceptionGroup[_BaseExceptionT] | Nonec                 C  r_   r*   r$   r`   r$   r$   r%   ra   �   rb   ú>Callable[[_BaseExceptionT_co | _BaseExceptionGroupSelf], bool]ú-BaseExceptionGroup[_BaseExceptionT_co] | Nonec                 C  r_   r*   r$   r`   r$   r$   r%   ra   ’   s   úztype[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...] | Callable[[_BaseExceptionT_co | _BaseExceptionGroupSelf], bool]c                 C  s’   t |ƒ}d}|| ƒr| S g }| jD ](}t|tƒr-| |¡}|d ur&| |¡ ||ur,d}q||ƒr7| |¡ qd}q|s>| S |rGt| |ƒ}|S d S )NFT)r4   r[   r/   r   ra   rV   r?   )r<   r\   r'   Úmodifiedr[   r   ra   Úgroupr$   r$   r%   ra   ˜   s,   



€
úXtuple[ExceptionGroup[_ExceptionT] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]c                 C  r_   r*   r$   r`   r$   r$   r%   Úsplit¹   ó   zBaseExceptionGroup.splitú`tuple[BaseExceptionGroup[_BaseExceptionT] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]c                 C  r_   r*   r$   r`   r$   r$   r%   rk   Á   rl   úctuple[BaseExceptionGroup[_BaseExceptionT_co] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]c                 C  r_   r*   r$   r`   r$   r$   r%   rk   É   s   r(   á!  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           
      C  s´   t |ƒ}|| ƒr| d fS g }g }| jD ]0}t|tƒr4| |¡\}}|d ur*| |¡ |d ur3| |¡ q||ƒr>| |¡ q| |¡ qd }|rMt| |ƒ}d }	|rVt| |ƒ}	||	fS r*   )r4   r[   r/   r   rk   rV   r?   )
r<   r\   r'   Úmatching_exceptionsÚnonmatching_exceptionsr   ÚmatchingÚnonmatchingÚmatching_groupÚnonmatching_groupr$   r$   r%   rk   Ò   s2   



€
ÿÚ_BaseExceptionGroup__excsúSequence[_ExceptionT]úExceptionGroup[_ExceptionT]c                 C  r_   r*   r$   ©r<   rv   r$   r$   r%   r6     s   zBaseExceptionGroup.deriveúSequence[_BaseExceptionT]ú#BaseExceptionGroup[_BaseExceptionT]c                 C  r_   r*   r$   ry   r$   r$   r%   r6     rb   c                 C  s   t | j|ƒS r*   )r   rY   ry   r$   r$   r%   r6     s   c                 C  s4   t | jƒdkr	dnd}| j› dt | jƒ› d|› d�S )Né   Ú Úsz (z sub-exceptionrU   )ÚlenrL   rY   )r<   Úsuffixr$   r$   r%   Ú__str__  s   zBaseExceptionGroup.__str__c                 C  s&   | j j› d| jd ›d| jd ›d�S )Nú(r   z, r|   rU   )r"   rI   rP   rX   r$   r$   r%   Ú__repr__  s   &zBaseExceptionGroup.__repr__)r#   r@   rA   rB   rC   rD   r   r   )rA   rB   rC   rD   rP   rQ   r   rR   )rT   rB   r   rR   )r   rB   )r   rZ   )r\   r]   r   r^   )r\   rc   r   rd   )r\   re   r   rf   )r\   rg   r   rd   )r\   r]   r   rj   )r\   rc   r   rm   )r\   re   r   rn   )r\   r(   r   ro   )rv   rw   r   rx   )rv   rz   r   r{   )rI   Ú
__module__Ú__qualname__Ú__doc__rK   rS   rW   ÚpropertyrY   r[   r   ra   rk   r6   r�   rƒ   Ú__classcell__r$   r$   rO   r%   r   @   s<    
(

!
2

c                      sŒ   e Zd Zd‡ fd	d
„ZerBed dd„ƒZed!dd„ƒZed"dd„ƒZd#‡ fdd„Zed$dd„ƒZ	ed%dd„ƒZ	d&‡ fdd„Z	‡  Z
S ‡  Z
S )'r   r#   útype[_ExceptionGroupSelf]Ú_ExceptionGroup__messagerB   Ú_ExceptionGroup__exceptionsúSequence[_ExceptionT_co]r   r   c                   s   t ƒ  | ||¡S r*   )rJ   rK   )r#   rŠ   r‹   rO   r$   r%   rK     s   zExceptionGroup.__new__ú;tuple[_ExceptionT_co | ExceptionGroup[_ExceptionT_co], ...]c                 C  r_   r*   r$   rX   r$   r$   r%   r[   #  rb   zExceptionGroup.exceptionsÚ_ExceptionGroup__conditionr]   r^   c                 C  r_   r*   r$   ©r<   rŽ   r$   r$   r%   ra   (  rb   zExceptionGroup.subgroupú6Callable[[_ExceptionT_co | _ExceptionGroupSelf], bool]ú%ExceptionGroup[_ExceptionT_co] | Nonec                 C  r_   r*   r$   r�   r$   r$   r%   ra   -  rb   úTtype[_ExceptionT] | tuple[type[_ExceptionT], ...] | Callable[[_ExceptionT_co], bool]c                   ó   t ƒ  |¡S r*   )rJ   ra   r�   rO   r$   r%   ra   2  s   úPtuple[ExceptionGroup[_ExceptionT] | None, ExceptionGroup[_ExceptionT_co] | None]c                 C  r_   r*   r$   r�   r$   r$   r%   rk   :  ó   zExceptionGroup.splitúStuple[ExceptionGroup[_ExceptionT_co] | None, ExceptionGroup[_ExceptionT_co] | None]c                 C  r_   r*   r$   r�   r$   r$   r%   rk   A  r•   r<   c                   r“   r*   )rJ   rk   r�   rO   r$   r%   rk   H  s   )r#   r‰   rŠ   rB   r‹   rŒ   r   r   )r   r�   )rŽ   r]   r   r^   )rŽ   r�   r   r‘   )rŽ   r’   r   r^   )rŽ   r]   r   r”   )rŽ   r�   r   r–   )r<   r   rŽ   r’   r   r–   )rI   r„   r…   rK   r   r‡   r[   r   ra   rk   rˆ   r$   r$   rO   r%   r     s     Ù)r   r   r   r   r   r    )r'   r(   r   r)   )!Ú
__future__r   ÚsysÚcollections.abcr   r   Ú	functoolsr   Úinspectr   r   Útypingr   r	   r
   r   r   r   Úversion_infoÚtyping_extensionsr   r   r   rE   r   r   r   r   r&   r4   r?   r   r   r$   r$   r$   r%   Ú<module>   s0     
ÿÿ


 Z