
    if*"                     ,   d dl Z d dlZd dlZej        rd dlmZ  G d de j                  Zej        eej	        dge
f         f         Z G d de          Z e            Z G d d	e          Z e            Z G d
 de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          Z G d de          ZdS )     N)RetryCallStatec                   L    e Zd ZdZej        dddefd            ZddZdd
Z	dS )
retry_basez)Abstract base class for retry strategies.retry_stater   returnc                     d S N selfr   s     L/var/www/html/env/lib/python3.11/site-packages/pip/_vendor/tenacity/retry.py__call__zretry_base.__call__   s        other	retry_allc                 "    t          | |          S r	   )r   r   r   s     r   __and__zretry_base.__and__        u%%%r   	retry_anyc                 "    t          | |          S r	   )r   r   s     r   __or__zretry_base.__or__#   r   r   N)r   r   r   r   )r   r   r   r   )
__name__
__module____qualname____doc__abcabstractmethodboolr   r   r   r
   r   r   r   r      ss        33$4     & & & && & & & & &r   r   r   c                   "    e Zd ZdZdddefdZdS )_retry_neverz-Retry strategy that never rejects any result.r   r   r   c                     dS )NFr
   r   s     r   r   z_retry_never.__call__-   s    ur   Nr   r   r   r   r   r   r
   r   r   r!   r!   *   s=        77$4       r   r!   c                   "    e Zd ZdZdddefdZdS )_retry_alwaysz.Retry strategy that always rejects any result.r   r   r   c                     dS )NTr
   r   s     r   r   z_retry_always.__call__7   s    tr   Nr#   r
   r   r   r%   r%   4   s=        88$4       r   r%   c                   N    e Zd ZdZdej        egef         ddfdZdddefdZ	dS )	retry_if_exceptionzARetry strategy that retries if an exception verifies a predicate.	predicater   Nc                     || _         d S r	   r)   r   r)   s     r   __init__zretry_if_exception.__init__A       "r   r   r   c                     |j         t          d          |j         j        r?|j                                         }|t          d          |                     |          S dS )N(__call__() called before outcome was set(outcome failed but the exception is NoneFoutcomeRuntimeErrorfailed	exceptionr)   r   r   r6   s      r   r   zretry_if_exception.__call__D   sh    &IJJJ% 	#+5577I "#MNNN>>),,,5r   )
r   r   r   r   typingCallableBaseExceptionr   r-   r   r
   r   r   r(   r(   >   sm        KK#&/=/42G"H #T # # # #
$4 
 
 
 
 
 
 
r   r(   c                        e Zd ZdZefdej        ej        e         ej	        ej        e         df         f         ddf fdZ
 xZS )retry_if_exception_typez=Retries if an exception has been raised of one or more types.exception_types.r   Nc                 `    | _         t                                          fd           d S )Nc                 $    t          |           S r	   
isinstanceer=   s    r   <lambda>z2retry_if_exception_type.__init__.<locals>.<lambda>\   s    :a#A#A r   r=   superr-   r   r=   	__class__s    `r   r-   z retry_if_exception_type.__init__T   s6      /AAAABBBBBr   r   r   r   r   	Exceptionr8   UnionTyper:   Tupler-   __classcell__rH   s   @r   r<   r<   Q   s        GG C CK&L]3S89;
C 
C C C C C C C C C Cr   r<   c                        e Zd ZdZefdej        ej        e         ej	        ej        e         df         f         ddf fdZ
 xZS )retry_if_not_exception_typezARetries except an exception has been raised of one or more types.r=   .r   Nc                 `    | _         t                                          fd           d S )Nc                 &    t          |            S r	   r@   rB   s    r   rD   z6retry_if_not_exception_type.__init__.<locals>.<lambda>j       z!_'E'E#E r   rE   rG   s    `r   r-   z$retry_if_not_exception_type.__init__b   6      /EEEEFFFFFr   rI   rO   s   @r   rQ   rQ   _   s        KK G GK&L]3S89;
G 
G G G G G G G G G Gr   rQ   c                        e Zd ZdZefdej        ej        e         ej	        ej        e         df         f         ddf fdZ
dddefd	Z xZS )
retry_unless_exception_typez:Retries until an exception is raised of one or more types.r=   .r   Nc                 `    | _         t                                          fd           d S )Nc                 &    t          |            S r	   r@   rB   s    r   rD   z6retry_unless_exception_type.__init__.<locals>.<lambda>x   rT   r   rE   rG   s    `r   r-   z$retry_unless_exception_type.__init__p   rU   r   r   r   c                     |j         t          d          |j         j        sdS |j                                         }|t          d          |                     |          S Nr0   Tr1   r2   r7   s      r   r   z$retry_unless_exception_type.__call__z   sj    &IJJJ ") 	4'1133	IJJJ~~i(((r   )r   r   r   r   rJ   r8   rK   rL   r:   rM   r-   r   r   rN   rO   s   @r   rW   rW   m   s        DD G GK&L]3S89;
G 
G G G G G G)$4 ) ) ) ) ) ) ) ) )r   rW   c                       e Zd ZdZefdej        ej        e         ej	        ej        e         df         f         ddfdZ
dddefd	ZdS )
retry_if_exception_cause_typezRetries if any of the causes of the raised exception is of one or more types.

    The check on the type of the cause of the exception is done recursively (until finding
    an exception in the chain that has no `__cause__`)
    r=   .r   Nc                     || _         d S r	   )exception_cause_types)r   r=   s     r   r-   z&retry_if_exception_cause_type.__init__   s     &5"""r   r   r   c                     |j         t          d          |j         j        r@|j                                         }|%t	          |j        | j                  rdS |j        }|%dS )Nz&__call__ called before outcome was setTF)r3   r4   r5   r6   rA   	__cause__r_   )r   r   excs      r   r   z&retry_if_exception_cause_type.__call__   sr    &GHHH% 	$%//11C/cmT-GHH  4m /
 ur   )r   r   r   r   rJ   r8   rK   rL   r:   rM   r-   r   r   r
   r   r   r]   r]      s          5 5K&L]3S89;
5 
5 5 5 5$4       r   r]   c                   X    e Zd ZdZdej        ej        gef         ddfdZdddefdZ	dS )	retry_if_resultz+Retries if the result verifies a predicate.r)   r   Nc                     || _         d S r	   r+   r,   s     r   r-   zretry_if_result.__init__   r.   r   r   r   c                     |j         t          d          |j         j        s,|                     |j                                                   S dS Nr0   Fr3   r4   r5   r)   resultr   s     r   r   zretry_if_result.__call__   sN    &IJJJ") 	>>+"5"<"<">">???5r   
r   r   r   r   r8   r9   Anyr   r-   r   r
   r   r   rd   rd      so        55#&/6:,2D"E #$ # # # #$4       r   rd   c                   X    e Zd ZdZdej        ej        gef         ddfdZdddefdZ	dS )	retry_if_not_resultz*Retries if the result refutes a predicate.r)   r   Nc                     || _         d S r	   r+   r,   s     r   r-   zretry_if_not_result.__init__   r.   r   r   r   c                     |j         t          d          |j         j        s-|                     |j                                                    S dS rg   rh   r   s     r   r   zretry_if_not_result.__call__   sQ    &IJJJ") 	~~k&9&@&@&B&BCCCC5r   rj   r
   r   r   rm   rm      so        44#&/6:,2D"E #$ # # # #$4       r   rm   c                   b     e Zd ZdZ	 	 ddej        e         dej        e         ddf fdZ xZS )retry_if_exception_messagez2Retries if an exception message equals or matches.Nmessagematchr   c                 R   r|rt          | j        j         d          rdt          dt          ffd}|}nI|r+t          j        |          dt          dt          ffd}|}nt          | j        j         d          t                                          |           d S )Nz.() takes either 'message' or 'match', not bothr6   r   c                 *    t          |           k    S r	   )str)r6   rr   s    r   message_fncz8retry_if_exception_message.__init__.<locals>.message_fnc   s    #i..00r   c                 b    t                              t          |                               S r	   )r   rs   rv   )r6   progs    r   	match_fncz6retry_if_exception_message.__init__.<locals>.match_fnc   s#    DJJs9~~66777r   z3() missing 1 required argument 'message' or 'match')		TypeErrorrH   r   r:   r   recompilerF   r-   )r   rr   rs   rw   r)   rz   ry   rH   s    `    @r   r-   z#retry_if_exception_message.__init__   s    
  	hu 	ht~6fffggg  	m1} 1 1 1 1 1 1 1 $II 	m:e$$D8] 8t 8 8 8 8 8 8 "IIt~6kkklll#####r   NN)	r   r   r   r   r8   Optionalrv   r-   rN   rO   s   @r   rq   rq      sz        << )-&*$ $%$ s#$ 
	$ $ $ $ $ $ $ $ $ $r   rq   c                   r     e Zd ZdZ	 	 d
dej        e         dej        e         ddf fdZdddefd	Z	 xZ
S )retry_if_not_exception_messagez5Retries until an exception message equals or matches.Nrr   rs   r   c                 p    t                                          ||           | j        fd| _        d S )Nc                       | i | S r	   r
   )args_kwargs_if_predicates     r   rD   z9retry_if_not_exception_message.__init__.<locals>.<lambda>   s    ||U7Vg7V7V3V r   )rF   r-   r)   )r   rr   rs   r   rH   s      @r   r-   z'retry_if_not_exception_message.__init__   s;    
 	%(((~VVVVr   r   r   c                     |j         t          d          |j         j        sdS |j                                         }|t          d          |                     |          S r[   r2   r7   s      r   r   z'retry_if_not_exception_message.__call__   sh    &IJJJ") 	4'1133	IJJJ~~i(((r   r~   )r   r   r   r   r8   r   rv   r-   r   r   rN   rO   s   @r   r   r      s        ?? )-&*W W%W s#W 
	W W W W W W
)$4 
) 
) 
) 
) 
) 
) 
) 
) 
)r   r   c                   2    e Zd ZdZdeddfdZdddefdZdS )	r   z1Retries if any of the retries condition is valid.retriesr   Nc                     || _         d S r	   r   r   r   s     r   r-   zretry_any.__init__      r   r   r   c                 D    t          fd| j        D                       S )Nc              3   .   K   | ]} |          V  d S r	   r
   .0rr   s     r   	<genexpr>z%retry_any.__call__.<locals>.<genexpr>  +      88a11[>>888888r   )anyr   r   s    `r   r   zretry_any.__call__  (    88884<888888r   r   r   r   r   r   r-   r   r   r
   r   r   r   r      s_        ;;     9$4 9 9 9 9 9 9 9r   r   c                   2    e Zd ZdZdeddfdZdddefdZdS )	r   z/Retries if all the retries condition are valid.r   r   Nc                     || _         d S r	   r   r   s     r   r-   zretry_all.__init__  r   r   r   r   c                 D    t          fd| j        D                       S )Nc              3   .   K   | ]} |          V  d S r	   r
   r   s     r   r   z%retry_all.__call__.<locals>.<genexpr>  r   r   )allr   r   s    `r   r   zretry_all.__call__  r   r   r   r
   r   r   r   r   	  s_        99     9$4 9 9 9 9 9 9 9r   r   )r   r|   r8   TYPE_CHECKINGpip._vendor.tenacityr   ABCr   rK   r9   r   
RetryBaseTr!   retry_neverr%   retry_alwaysr(   r<   rQ   rW   r]   rd   rm   rq   r   r   r   r
   r   r   <module>r      s  " 


 				 	 4333333& & & & & & & & \*fo7G6H$6N&OOP
    :    lnn    J    }       &C C C C C0 C C CG G G G G"4 G G G) ) ) ) )"4 ) ) )6    J   <    j        *    $ $ $ $ $!3 $ $ $>) ) ) ) )%? ) ) )49 9 9 9 9
 9 9 99 9 9 9 9
 9 9 9 9 9r   