
    YHh,                    t   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      Z ede      Z eded
e      Z ede      Z edd      Z edd      Z	 	 	 	 	 	 ddZ	 	 	 	 ddZd Z G d deee         Z G d dee   e      Z y)    )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BaseExceptionGroupc                J    t        | j                        d d D ]  }||v s y y)NTF)r   	__class__)excparentsclss      S/var/www/html/planif/env/lib/python3.12/site-packages/exceptiongroup/_exceptions.pycheck_direct_subclassr#      s2     cmm$Sb) '>     c                0   t        |       r7t        t        t        t           |       t              rt        t        | f      S t        | t              r#t        d | D              r(t        t        |       S t        |       rt        d|       S t        d      )N)r    c              3  V   K   | ]!  }t        |      xr t        |t               # y wN)r   
issubclassBaseException).0xs     r"   	<genexpr>z'get_condition_filter.<locals>.<genexpr>-   s#     Nqwqz:jM::Ns   ')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)	conditions    r"   get_condition_filterr3   #   s~    
 yjT- ),m ,ylCC	Iu	%NINN0)DD	)	5yAA
U
VVr$   c                    | j                  |      }| j                  |_        | j                  |_        | j                  |_        t	        | d      rt        | j                        |_        |S )N	__notes__)derive	__cause____context____traceback__hasattrlistr5   )selfexcsegs      r"   _derive_and_copy_attributesr?   5   sU    	T	B>>BL%%BN))Bt[!DNN+Ir$   c                      e Zd ZdZ	 	 	 	 	 	 	 	 d fdZ	 	 	 	 	 	 	 	 ddZddZedd       Ze	 	 dd       Z	e
	 	 	 	 dd       Ze
	 	 	 	 dd       Ze
	 	 	 	 dd	       Z	 	 	 	 dd
Ze
	 	 	 	 dd       Ze
	 	 	 	 dd       Ze
	 	 	 	 dd       Z	 	 	 	 d dZe
d!d       Ze
	 	 	 	 d"d       Z	 	 	 	 d"dZddZddZ xZS )#r   z/A combination of multiple unrelated exceptions.c                0   t        |t              st        dt        |             t        |t              st        d      |st        d      t        |      D ]$  \  }}t        |t              rt        d| d       | t        u rt        d |D              rt        } t        | t              rB|D ]=  }t        |t              r| t        u rt        d      t        d| j                         t        | =  | ||      }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              3  <   K   | ]  }t        |t                y wr'   )r-   	Exception)r*   r   s     r"   r,   z-BaseExceptionGroup.__new__.<locals>.<genexpr>X   s     F#:c9-Fs   z/Cannot nest BaseExceptions in an ExceptionGroupzCannot nest BaseExceptions in )r-   strr1   typer   
ValueError	enumerater)   r   r/   r   r(   rC   __name__super__new__r.   _exceptions)r!   _BaseExceptionGroup__message_BaseExceptionGroup__exceptionsir   instancer   s         r"   rJ   zBaseExceptionGroup.__new__C   s+   
 )S):4	?:KLMM,1MNNK   - 	FAsc=1 A3RS 	 $$FFF$c9%# 	!#y1n,'M  (<S\\<LM 	 7?3	<@$\2r$   c                4    t        j                  | ||g|  y r'   )r)   __init__)r<   rL   rM   argss       r"   rQ   zBaseExceptionGroup.__init__k   s     	tYDtDr$   c                    t        |t              s%t        d|dt        |      j                   d      t        | d      sg | _        | j                  j                  |       y )NzExpected a string, got note=z (type )r5   )r-   rD   r1   rE   rH   r:   r5   append)r<   notes     r"   add_notezBaseExceptionGroup.add_notes   s\    $$.thgd4j>Q>Q=RRST  t[)(*DNd#r$   c                     | j                   d   S )Nr   )rR   r<   s    r"   messagezBaseExceptionGroup.message~   s    yy|r$   c                ,    t        | j                        S r'   )r.   rK   rY   s    r"   
exceptionszBaseExceptionGroup.exceptions   s     T%%&&r$   c                     y r'    r<   _BaseExceptionGroup__conditions     r"   subgroupzBaseExceptionGroup.subgroup   s     .1r$   c                     y r'   r^   r_   s     r"   ra   zBaseExceptionGroup.subgroup   s     69r$   c                     y r'   r^   r_   s     r"   ra   zBaseExceptionGroup.subgroup   s     9<r$   c                0   t        |      }d} ||       r| S g }| j                  D ]Z  }t        |t              r,|j	                  |      }||j                  |       ||us<d}? ||      r|j                  |       Yd}\ |s| S |rt        | |      }|S y )NFT)r3   r\   r-   r   ra   rU   r?   )r<   r`   r2   modifiedr\   r   ra   groups           r"   ra   zBaseExceptionGroup.subgroup   s     )5	T?K*,
?? 	 C#12<<4'%%h/3&#H3!!#&	  K/jAELr$   c                     y r'   r^   r_   s     r"   splitzBaseExceptionGroup.split        r$   c                     y r'   r^   r_   s     r"   rh   zBaseExceptionGroup.split   ri   r$   c                     y r'   r^   r_   s     r"   rh   zBaseExceptionGroup.split   s     r$   c                   t        |      } ||       r| d fS g }g }| j                  D ]y  }t        |t              r<|j	                  |      \  }}||j                  |       |=|j                  |       O ||      r|j                  |       i|j                  |       { d }|rt        | |      }d }	|rt        | |      }	||	fS r'   )r3   r\   r-   r   rh   rU   r?   )
r<   r`   r2   matching_exceptionsnonmatching_exceptionsr   matchingnonmatchingmatching_groupnonmatching_groups
             r"   rh   zBaseExceptionGroup.split   s    & )5	T?:3568?? 	3C#12(+		)(<%+''..x8**11+>3#**3/&--c2	3 :>8?RSN<@! ;,! 000r$   c                     y r'   r^   r<   _BaseExceptionGroup__excss     r"   r6   zBaseExceptionGroup.derive  s    TWr$   c                     y r'   r^   rt   s     r"   r6   zBaseExceptionGroup.derive  s     /2r$   c                .    t        | j                  |      S r'   )r   rZ   rt   s     r"   r6   zBaseExceptionGroup.derive  s     "$,,77r$   c                    t        | j                        dk(  rdnd}| j                   dt        | j                         d| dS )N    sz (z sub-exceptionrT   )lenrK   rZ   )r<   suffixs     r"   __str__zBaseExceptionGroup.__str__  sD    4++,1s,,r#d&6&6"7!8vhaPPr$   c                t    | j                   j                   d| j                  d   d| j                  d   dS )N(r   z, ry   rT   )r   rH   rR   rY   s    r"   __repr__zBaseExceptionGroup.__repr__  s8    ..))*!DIIaL+;2diil=MQOOr$   )r!   ztype[_BaseExceptionGroupSelf]rL   rD   rM   Sequence[_BaseExceptionT_co]returnr   )rL   rD   rM   r   rR   objectr   None)rV   rD   r   r   )r   rD   )r   zGtuple[_BaseExceptionT_co | BaseExceptionGroup[_BaseExceptionT_co], ...])r`   1type[_ExceptionT] | tuple[type[_ExceptionT], ...]r   "ExceptionGroup[_ExceptionT] | None)r`   9type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...]r   *BaseExceptionGroup[_BaseExceptionT] | None)r`   >Callable[[_BaseExceptionT_co | _BaseExceptionGroupSelf], bool]r   z-BaseExceptionGroup[_BaseExceptionT_co] | None)r`   zztype[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...] | Callable[[_BaseExceptionT_co | _BaseExceptionGroupSelf], bool]r   r   )r`   r   r   zXtuple[ExceptionGroup[_ExceptionT] | None, BaseExceptionGroup[_BaseExceptionT_co] | None])r`   r   r   z`tuple[BaseExceptionGroup[_BaseExceptionT] | None, BaseExceptionGroup[_BaseExceptionT_co] | None])r`   r   r   zctuple[BaseExceptionGroup[_BaseExceptionT_co] | None, BaseExceptionGroup[_BaseExceptionT_co] | None])r`   `type[_BaseExceptionT] | tuple[type[_BaseExceptionT], ...] | Callable[[_BaseExceptionT_co], bool]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])ru   zSequence[_ExceptionT]r   zExceptionGroup[_ExceptionT])ru   zSequence[_BaseExceptionT]r   z#BaseExceptionGroup[_BaseExceptionT])rH   
__module____qualname____doc__rJ   rQ   rW   propertyrZ   r\   r   ra   rh   r6   r~   r   __classcell__r   s   @r"   r   r   @   s   9&*&& 3& 
!	&PEE 3E 	E
 
E	$   '	P' '
 1L1	+1 1 9T9	39 9 <S< 
7< <
I
 
4B L
  T
  S
 01/01	
01d W W2/2	,2 28/8	,8
QPr$   c                       e Zd Z	 	 	 	 	 	 	 	 d	 fdZerYe	 	 d
d       Ze	 	 	 	 dd       Ze	 	 	 	 dd       Z	 	 	 	 d fdZe	 	 	 	 dd       Z	e	 	 	 	 dd       Z		 	 	 	 	 	 d fdZ	 xZ
S  xZ
S )r   c                &    t         |   | ||      S r'   )rI   rJ   )r!   _ExceptionGroup__message_ExceptionGroup__exceptionsr   s      r"   rJ   zExceptionGroup.__new__  s    
 wsI|<<r$   c                     y r'   r^   rY   s    r"   r\   zExceptionGroup.exceptions#  s	     KNr$   c                     y r'   r^   r<   _ExceptionGroup__conditions     r"   ra   zExceptionGroup.subgroup(  s     25r$   c                     y r'   r^   r   s     r"   ra   zExceptionGroup.subgroup-  s     58r$   c                "    t         |   |      S r'   )rI   ra   r<   r   r   s     r"   ra   zExceptionGroup.subgroup2  s     7#K00r$   c                     y r'   r^   r   s     r"   rh   zExceptionGroup.split:      
 r$   c                     y r'   r^   r   s     r"   rh   zExceptionGroup.splitA  r   r$   c                "    t         |   |      S r'   )rI   rh   r   s     r"   rh   zExceptionGroup.splitH  s     7=--r$   )r!   ztype[_ExceptionGroupSelf]r   rD   r   zSequence[_ExceptionT_co]r   r   )r   z;tuple[_ExceptionT_co | ExceptionGroup[_ExceptionT_co], ...])r   r   r   r   )r   6Callable[[_ExceptionT_co | _ExceptionGroupSelf], bool]r   z%ExceptionGroup[_ExceptionT_co] | None)r   Ttype[_ExceptionT] | tuple[type[_ExceptionT], ...] | Callable[[_ExceptionT_co], bool]r   r   )r   r   r   zPtuple[ExceptionGroup[_ExceptionT] | None, ExceptionGroup[_ExceptionT_co] | None])r   r   r   Stuple[ExceptionGroup[_ExceptionT_co] | None, ExceptionGroup[_ExceptionT_co] | None])r<   r   r   r   r   r   )rH   r   r   rJ   r	   r   r\   r   ra   rh   r   r   s   @r"   r   r     s'   =&== /= 
	= 		NH	N 
	N 
	5P	5/	5 
	5 
	8U	82	8 
	8	1/	1
 0	1 
	P	
	 
	 
	U	
	 
		.%	./	.

	. 	.O r$   )r   r)   r    ztuple[type[BaseException]]r   bool)r2   r   r   z$Callable[[_BaseExceptionT_co], bool])!
__future__r   syscollections.abcr   r   	functoolsr   inspectr   r   typingr	   r
   r   r   r   r   version_infotyping_extensionsr)   r   r   rC   r   r   r   r   r#   r3   r?   r   r   r^   r$   r"   <module>r      s    " 
 .  # H Hg)}  +=AIy m953;KL !";CWX 	!;	W+W *	W$VP0B(C VPr7.'7 7.r$   