
    <6h*"                        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y)     N)RetryCallStatec                   N    e Zd ZdZej
                  dddefd       Zd	dZd
dZ	y)
retry_basez)Abstract base class for retry strategies.retry_stater   returnc                      y N selfr   s     _/var/www/panel.atabookie.online/venv/lib/python3.12/site-packages/pip/_vendor/tenacity/retry.py__call__zretry_base.__call__   s        c                     t        | |      S r	   )	retry_allr   others     r   __and__zretry_base.__and__        u%%r   c                     t        | |      S r	   )	retry_anyr   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      s6    3$4   &&r   r   r   c                        e Zd ZdZdddefdZy)_retry_neverz-Retry strategy that never rejects any result.r   r   r   c                      y)NFr
   r   s     r   r   z_retry_never.__call__-   s    r   Nr   r   r   r   r   r   r
   r   r   r!   r!   *   s    7$4  r   r!   c                        e Zd ZdZdddefdZy)_retry_alwaysz.Retry strategy that always rejects any result.r   r   r   c                      y)NTr
   r   s     r   r   z_retry_always.__call__7   s    r   Nr#   r
   r   r   r%   r%   4   s    8$4  r   r%   c                   P    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	y)	retry_if_exceptionzARetry strategy that retries if an exception verifies a predicate.	predicater   Nc                     || _         y r	   r)   r   r)   s     r   __init__zretry_if_exception.__init__A   	    "r   r   r   c                     |j                   t        d      |j                   j                  r8|j                   j                         }|t        d      | j	                  |      S y)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   sa    &IJJ%%#++557I "#MNN>>),,r   )
r   r   r   r   typingCallableBaseExceptionr   r-   r   r
   r   r   r(   r(   >   s<    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       y )Nc                     t        |       S r	   
isinstanceer=   s    r   <lambda>z2retry_if_exception_type.__init__.<locals>.<lambda>\   s    :a#A r   r=   superr-   r   r=   	__class__s    `r   r-   z retry_if_exception_type.__init__T   s      /ABr   r   r   r   r   	Exceptionr8   UnionTyper:   Tupler-   __classcell__rH   s   @r   r<   r<   Q   s_    G CKK&LL]3S89;
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       y )Nc                     t        |        S r	   r@   rB   s    r   rD   z6retry_if_not_exception_type.__init__.<locals>.<lambda>j       z!_'E#E r   rE   rG   s    `r   r-   z$retry_if_not_exception_type.__init__b         /EFr   rI   rO   s   @r   rQ   rQ   _   s_    K GKK&LL]3S89;
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       y )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y|j                   j                         }|t        d      | j	                  |      S Nr0   Tr1   r2   r7   s      r   r   z$retry_unless_exception_type.__call__z   sc    &IJJ ""))''113	IJJ~~i((r   )r   r   r   r   rJ   r8   rK   rL   r:   rM   r-   r   r   rN   rO   s   @r   rW   rW   m   sm    D GKK&LL]3S89;
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y)
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                     || _         y 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                  rL|j                   j                         }|0t	        |j
                  | j                        ry|j
                  }|0y)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__   sn    &GHH%%%%//1C/cmmT-G-GHmm /
 r   )r   r   r   r   rJ   r8   rK   rL   r:   rM   r-   r   r   r
   r   r   r]   r]      sk     5KK&LL]3S89;
5 
5$4  r   r]   c                   d    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	y)	retry_if_resultz+Retries if the result verifies a predicate.r)   r   Nc                     || _         y r	   r+   r,   s     r   r-   zretry_if_result.__init__   r.   r   r   r   c                     |j                   t        d      |j                   j                  s)| j                  |j                   j	                               S yNr0   Fr3   r4   r5   r)   resultr   s     r   r   zretry_if_result.__call__   sJ    &IJJ""))>>+"5"5"<"<">??r   
r   r   r   r   r8   r9   Anyr   r-   r   r
   r   r   rd   rd      s@    5#&//6::,2D"E #$ #$4  r   rd   c                   d    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	y)	retry_if_not_resultz*Retries if the result refutes a predicate.r)   r   Nc                     || _         y r	   r+   r,   s     r   r-   zretry_if_not_result.__init__   r.   r   r   r   c                     |j                   t        d      |j                   j                  s*| j                  |j                   j	                                S yrg   rh   r   s     r   r   zretry_if_not_result.__call__   sM    &IJJ""))~~k&9&9&@&@&BCCCr   rj   r
   r   r   rm   rm      s@    4#&//6::,2D"E #$ #$4  r   rm   c                   j     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"t        | j                  j                   d      rdt        dt        ffd}|}nN|r*t        j                  |      dt        dt        ffd}|}n"t        | j                  j                   d      t        | !  |       y )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                 J    t        j                  t        |                   S r	   )r   rs   rv   )r6   progs    r   	match_fncz6retry_if_exception_message.__init__.<locals>.match_fnc   s    DJJs9~6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    
 ut~~6677efgg 1} 1 1 $I::e$D8] 8t 8 "It~~6677jkll#r   NN)	r   r   r   r   r8   Optionalrv   r-   rN   rO   s   @r   rq   rq      sF    < )-&*$%$ s#$ 
	$ $r   rq   c                   z     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                 T    t         |   ||       | j                  fd| _        y )Nc                       | i | S r	   r
   )args_kwargs_if_predicates     r   rD   z9retry_if_not_exception_message.__init__.<locals>.<lambda>   s    |U7Vg7V3V r   )rF   r-   r)   )r   rr   rs   r   rH   s      @r   r-   z'retry_if_not_exception_message.__init__   s$    
 	%(~~Vr   r   r   c                     |j                   t        d      |j                   j                  sy|j                   j                         }|t        d      | j	                  |      S r[   r2   r7   s      r   r   z'retry_if_not_exception_message.__call__   sa    &IJJ""))''113	IJJ~~i((r   r~   )r   r   r   r   r8   r   rv   r-   r   r   rN   rO   s   @r   r   r      sY    ? )-&*W%W s#W 
	W
)$4 
) 
)r   r   c                   0    e Zd ZdZdeddfdZdddefdZy)	r   z1Retries if any of the retries condition is valid.retriesr   Nc                     || _         y r	   r   r   r   s     r   r-   zretry_any.__init__  	    r   r   r   c                 @    t        fd| j                  D              S )Nc              3   .   K   | ]  } |        y wr	   r
   .0rr   s     r   	<genexpr>z%retry_any.__call__.<locals>.<genexpr>       8a1[>8   )anyr   r   s    `r   r   zretry_any.__call__      84<<888r   r   r   r   r   r   r-   r   r   r
   r   r   r   r      s,    ;  9$4 9 9r   r   c                   0    e Zd ZdZdeddfdZdddefdZy)	r   z/Retries if all the retries condition are valid.r   r   Nc                     || _         y r	   r   r   s     r   r-   zretry_all.__init__  r   r   r   r   c                 @    t        fd| j                  D              S )Nc              3   .   K   | ]  } |        y w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$4 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
  "  	 	3& & \\*foo7G6H$6N&OOP
:  nJ   &C0 CG"4 G)"4 )6J <j  *  $!3 $>)%? )49
 99
 9r   