a
    [g+                     @  s   d dl m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deddZed	ed
ZededdZeded
Zeddd
Zeddd
ZddddddZdd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 )!    )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BaseExceptionztuple[type[BaseException]]bool)excparentsreturnc                 C  s*   t | jd d D ]}||v r dS qdS )NTF)r   	__class__)r   r   cls r    h/var/www/html/cobodadashboardai.evdpl.com/venv/lib/python3.9/site-packages/exceptiongroup/_exceptions.pycheck_direct_subclass   s    r"   `type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...] | Callable[[_BaseExceptionT_co], bool]z$Callable[[_BaseExceptionT_co], bool])	conditionr   c                 C  sr   t | r*tttt | tr*tt| fdS t| trTt	dd | D rftt| dS nt
| rftd| S tdd S )N)r   c                 s  s    | ]}t |ot|tV  qd S N)r   
issubclassr   ).0xr    r    r!   	<genexpr>%       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    


r0   c                 C  s<   |  |}| j|_| j|_| j|_t| dr8t| j|_|S )N	__notes__)derive	__cause____context____traceback__hasattrlistr1   )selfZexcsegr    r    r!   _derive_and_copy_attributes-   s    

r:   c                      sL  e Zd ZdZddddd fddZdd	d
ddZeddddZeddddZe	dddddZ
e	dddddZ
e	dddddZ
dddddZ
e	dd dd!d"Ze	dd#dd$d"Ze	dd%dd&d"Zd'd(dd)d"Ze	d*d+d,d-d.Ze	d/d0d,d1d.Zd/d0d,d2d.Zddd3d4Zddd5d6Z  ZS )7r   z/A combination of multiple unrelated exceptions.ztype[_BaseExceptionGroupSelf]strzSequence[_BaseExceptionT_co]r   )r   _BaseExceptionGroup__message_BaseExceptionGroup__exceptionsr   c                   s   t |tstdt| t |ts.td|s:tdt|D ]"\}}t |tsBtd| dqB| tu rt	dd |D rt
} t| tr|D ]0}t |ts| t
u rtdqtd	| jqt | ||}||_||_|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)   P   r*   z-BaseExceptionGroup.__new__.<locals>.<genexpr>z/Cannot nest BaseExceptions in an ExceptionGroupzCannot nest BaseExceptions in )r+   r;   r/   typer   
ValueError	enumerater   r   r-   r   r&   r>   __name__super__new___message_exceptions)r   r<   r=   ir   instancer   r    r!   rD   ;   s<    






zBaseExceptionGroup.__new__None)noter   c                 C  sF   t |ts&td|dt|j dt| ds6g | _| j| d S )NzExpected a string, got note=z (type )r1   )r+   r;   r/   r?   rB   r6   r1   append)r8   rK   r    r    r!   add_noted   s    

zBaseExceptionGroup.add_noter   c                 C  s   | j S r%   )rE   r8   r    r    r!   messageo   s    zBaseExceptionGroup.messagezGtuple[_BaseExceptionT_co | BaseExceptionGroup[_BaseExceptionT_co], ...]c                 C  s
   t | jS r%   )r,   rF   rP   r    r    r!   
exceptionss   s    zBaseExceptionGroup.exceptions1type[_ExceptionT] | tuple[type[_ExceptionT], ...]"ExceptionGroup[_ExceptionT] | None)_BaseExceptionGroup__conditionr   c                 C  s   d S r%   r    r8   rU   r    r    r!   subgroupy   s    zBaseExceptionGroup.subgroupz9type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...]z*BaseExceptionGroup[_BaseExceptionT] | Nonec                 C  s   d S r%   r    rV   r    r    r!   rW   ~   s    z>Callable[[_BaseExceptionT_co | _BaseExceptionGroupSelf], bool]z-BaseExceptionGroup[_BaseExceptionT_co] | Nonec                 C  s   d S r%   r    rV   r    r    r!   rW      s    zztype[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...] | Callable[[_BaseExceptionT_co | _BaseExceptionGroupSelf], bool]c                 C  s   t |}d}|| r| S g }| jD ]P}t|trZ||}|d urL|| ||urrd}q"||rn|| q"d}q"|s|| S |rt| |}|S d S d S )NFT)r0   rR   r+   r   rW   rM   r:   )r8   rU   r$   modifiedrR   r   rW   groupr    r    r!   rW      s*    




zXtuple[ExceptionGroup[_ExceptionT] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]c                 C  s   d S r%   r    rV   r    r    r!   split   s    zBaseExceptionGroup.splitz`tuple[BaseExceptionGroup[_BaseExceptionT] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]c                 C  s   d S r%   r    rV   r    r    r!   rZ      s    zctuple[BaseExceptionGroup[_BaseExceptionT_co] | None, BaseExceptionGroup[_BaseExceptionT_co] | None]c                 C  s   d S r%   r    rV   r    r    r!   rZ      s    r#   a!  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 ]`}t|trh||\}}|d urT|| |d ur|| q&||r||| q&|| q&d }|rt| |}d }	|rt| |}	||	fS r%   )r0   rR   r+   r   rZ   rM   r:   )
r8   rU   r$   Zmatching_exceptionsZnonmatching_exceptionsr   ZmatchingZnonmatchingZmatching_groupZnonmatching_groupr    r    r!   rZ      s0    



zSequence[_ExceptionT]zExceptionGroup[_ExceptionT])_BaseExceptionGroup__excsr   c                 C  s   d S r%   r    r8   r[   r    r    r!   r2      s    zBaseExceptionGroup.derivezSequence[_BaseExceptionT]z#BaseExceptionGroup[_BaseExceptionT]c                 C  s   d S r%   r    r\   r    r    r!   r2      s    c                 C  s   t | j|S r%   )r   rQ   r\   r    r    r!   r2      s    c                 C  s4   t | jdkrdnd}| j dt | j d| dS )N    sz (z sub-exceptionrL   )lenrF   rQ   )r8   suffixr    r    r!   __str__  s    zBaseExceptionGroup.__str__c                 C  s   | j j d| jd| jdS )N(z, rL   )r   rB   rQ   rF   rP   r    r    r!   __repr__  s    zBaseExceptionGroup.__repr__)rB   
__module____qualname____doc__rD   rN   propertyrQ   rR   r   rW   rZ   r2   rb   rd   __classcell__r    r    rI   r!   r   8   s8   )!2c                      s   e Zd Zddddd fddZeredd	d
dZedddddZedddddZddd fddZedddddZ	edddddZ	dddd fddZ	  Z
S )r   ztype[_ExceptionGroupSelf]r;   zSequence[_ExceptionT_co]r   )r   _ExceptionGroup__message_ExceptionGroup__exceptionsr   c                   s   t  | ||S r%   )rC   rD   )r   rj   rk   rI   r    r!   rD     s    zExceptionGroup.__new__z;tuple[_ExceptionT_co | ExceptionGroup[_ExceptionT_co], ...]rO   c                 C  s   d S r%   r    rP   r    r    r!   rR     s    zExceptionGroup.exceptionsrS   rT   )_ExceptionGroup__conditionr   c                 C  s   d S r%   r    r8   rl   r    r    r!   rW     s    zExceptionGroup.subgroupz6Callable[[_ExceptionT_co | _ExceptionGroupSelf], bool]z%ExceptionGroup[_ExceptionT_co] | Nonec                 C  s   d S r%   r    rm   r    r    r!   rW     s    zTtype[_ExceptionT] | tuple[type[_ExceptionT], ...] | Callable[[_ExceptionT_co], bool]c                   s   t  |S r%   )rC   rW   rm   rI   r    r!   rW   #  s    zPtuple[ExceptionGroup[_ExceptionT] | None, ExceptionGroup[_ExceptionT_co] | None]c                 C  s   d S r%   r    rm   r    r    r!   rZ   +  s    zExceptionGroup.splitzStuple[ExceptionGroup[_ExceptionT_co] | None, ExceptionGroup[_ExceptionT_co] | None]c                 C  s   d S r%   r    rm   r    r    r!   rZ   2  s    )r8   rl   r   c                   s   t  |S r%   )rC   rZ   rm   rI   r    r!   rZ   9  s    )rB   re   rf   rD   r   rh   rR   r   rW   rZ   ri   r    r    rI   r!   r   
  s   N)
__future__r   collections.abcr   r   	functoolsr   inspectr   r   typingr   r	   r
   r   r   r   r   r   r   r>   r   r   r   r   r"   r0   r:   r   r   r    r    r    r!   <module>   s     
 S