
    XDiJ#                        S SK r S SKrS SKr\R                  (       a  S SKJr   " S S\ R                  5      r\R                  \\R                  S/\
4   4   r " S S\5      r\" 5       r " S S	\5      r\" 5       r " S
 S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      rg)     N)RetryCallStatec                   p    \ rS rSrSr\R                  SSS\4S j5       rSS jr	SS jr
SS	 jrSS
 jrSrg)
retry_base   z)Abstract base class for retry strategies.retry_stater   returnc                     g N selfr   s     V/var/www/html/Aiprofessor/professorTrac/lib/python3.13/site-packages/tenacity/retry.py__call__retry_base.__call__   s        c                 $    UR                  U 5      $ r
   )__rand__r   others     r   __and__retry_base.__and__    s    ~~d##r   c                     [        X5      $ r
   )	retry_allr   s     r   r   retry_base.__rand__#       %%r   c                 $    UR                  U 5      $ r
   )__ror__r   s     r   __or__retry_base.__or__&   s    }}T""r   c                     [        X5      $ r
   )	retry_anyr   s     r   r   retry_base.__ror__)   r   r   r   N)r   r   r   r   )r   r   r   r!   )__name__
__module____qualname____firstlineno____doc__abcabstractmethodboolr   r   r   r   r   __static_attributes__r   r   r   r   r      s@    3$4   $&#&r   r   r   c                   *    \ rS rSrSrSSS\4S jrSrg)	_retry_never0   z-Retry strategy that never rejects any result.r   r   r   c                     g)NFr   r   s     r   r   _retry_never.__call__3   s    r   r   Nr#   r$   r%   r&   r'   r*   r   r+   r   r   r   r-   r-   0   s    7$4  r   r-   c                   *    \ rS rSrSrSSS\4S jrSrg)	_retry_always:   z.Retry strategy that always rejects any result.r   r   r   c                     g)NTr   r   s     r   r   _retry_always.__call__=   s    r   r   Nr1   r   r   r   r3   r3   :   s    8$4  r   r3   c                   \    \ rS rSrSrS\R                  \/\4   SS4S jr	SSS\4S	 jr
S
rg)retry_if_exceptionD   zARetry strategy that retries if an exception verifies a predicate.	predicater   Nc                     Xl         g r
   r:   r   r:   s     r   __init__retry_if_exception.__init__G       "r   r   r   c                     UR                   c  [        S5      eUR                   R                  (       a9  UR                   R                  5       nUc  [        S5      eU R	                  U5      $ g)N(__call__() called before outcome was set(outcome failed but the exception is NoneFoutcomeRuntimeErrorfailed	exceptionr:   r   r   rH   s      r   r   retry_if_exception.__call__J   sa    &IJJ%%#++557I "#MNN>>),,r   r<   )r#   r$   r%   r&   r'   typingCallableBaseExceptionr*   r>   r   r+   r   r   r   r8   r8   D   s<    K#&//=/42G"H #T #
$4 
 
r   r8   c                      ^  \ rS rSrSr\4S\R                  \R                  \	   \R                  \R                  \	   S4   4   SS4U 4S jjjrSrU =r$ )	retry_if_exception_typeW   z=Retries if an exception has been raised of one or more types.exception_types.r   Nc                 <   >^ TU l         [        TU ]	  U4S j5        g )Nc                    > [        U T5      $ r
   
isinstanceerQ   s    r   <lambda>2retry_if_exception_type.__init__.<locals>.<lambda>b   s    :a#Ar   rQ   superr>   r   rQ   	__class__s    `r   r>    retry_if_exception_type.__init__Z   s      /ABr   rQ   r#   r$   r%   r&   r'   	ExceptionrK   UnionTyperM   Tupler>   r+   __classcell__r]   s   @r   rO   rO   W   s_    G CKK&LL]3S89;
C 
C Cr   rO   c                      ^  \ rS rSrSr\4S\R                  \R                  \	   \R                  \R                  \	   S4   4   SS4U 4S jjjrSrU =r$ )	retry_if_not_exception_typee   zARetries except an exception has been raised of one or more types.rQ   .r   Nc                 <   >^ TU l         [        TU ]	  U4S j5        g )Nc                 &   > [        U T5      (       + $ r
   rT   rV   s    r   rX   6retry_if_not_exception_type.__init__.<locals>.<lambda>p       z!_'E#Er   rZ   r\   s    `r   r>   $retry_if_not_exception_type.__init__h         /EFr   r_   r`   rf   s   @r   rh   rh   e   s_    K GKK&LL]3S89;
G 
G Gr   rh   c                      ^  \ rS rSrSr\4S\R                  \R                  \	   \R                  \R                  \	   S4   4   SS4U 4S jjjrSS	S\4S
 jrSrU =r$ )retry_unless_exception_types   z:Retries until an exception is raised of one or more types.rQ   .r   Nc                 <   >^ TU l         [        TU ]	  U4S j5        g )Nc                 &   > [        U T5      (       + $ r
   rT   rV   s    r   rX   6retry_unless_exception_type.__init__.<locals>.<lambda>~   rm   r   rZ   r\   s    `r   r>   $retry_unless_exception_type.__init__v   ro   r   r   r   c                     UR                   c  [        S5      eUR                   R                  (       d  gUR                   R                  5       nUc  [        S5      eU R	                  U5      $ NrB   TrC   rD   rI   s      r   r   $retry_unless_exception_type.__call__   sc    &IJJ ""))''113	IJJ~~i((r   r_   )r#   r$   r%   r&   r'   ra   rK   rb   rc   rM   rd   r>   r*   r   r+   re   rf   s   @r   rq   rq   s   sx    D GKK&LL]3S89;
G 
G G)$4 ) ) )r   rq   c                       \ rS rSrSr\4S\R                  \R                  \	   \R                  \R                  \	   S4   4   SS4S jjrSS	S\4S
 jrSrg)retry_if_exception_cause_type   zRetries 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__`)
rQ   .r   Nc                     Xl         g r
   exception_cause_types)r   rQ   s     r   r>   &retry_if_exception_cause_type.__init__   s
     &5"r   r   r   c                    UR                   c  [        S5      eUR                   R                  (       aT  UR                   R                  5       nUb7  [	        UR
                  U R                  5      (       a  gUR
                  nUb  M7  g)Nz&__call__ called before outcome was setTF)rE   rF   rG   rH   rU   	__cause__r   )r   r   excs      r   r   &retry_if_exception_cause_type.__call__   sq    &GHH%%%%//1C/cmmT-G-GHHmm /
 r   r~   )r#   r$   r%   r&   r'   ra   rK   rb   rc   rM   rd   r>   r*   r   r+   r   r   r   r{   r{      sk     5KK&LL]3S89;
5 
5$4  r   r{   c                   p    \ rS rSrSrS\R                  \R                  /\4   SS4S jr	SSS\4S	 jr
S
rg)retry_if_result   z+Retries if the result verifies a predicate.r:   r   Nc                     Xl         g r
   r<   r=   s     r   r>   retry_if_result.__init__   r@   r   r   r   c                     UR                   c  [        S5      eUR                   R                  (       d)  U R                  UR                   R	                  5       5      $ gNrB   FrE   rF   rG   r:   resultr   s     r   r   retry_if_result.__call__   sJ    &IJJ""))>>+"5"5"<"<">??r   r<   r#   r$   r%   r&   r'   rK   rL   Anyr*   r>   r   r+   r   r   r   r   r      s@    5#&//6::,2D"E #$ #$4  r   r   c                   p    \ rS rSrSrS\R                  \R                  /\4   SS4S jr	SSS\4S	 jr
S
rg)retry_if_not_result   z*Retries if the result refutes a predicate.r:   r   Nc                     Xl         g r
   r<   r=   s     r   r>   retry_if_not_result.__init__   r@   r   r   r   c                     UR                   c  [        S5      eUR                   R                  (       d.  U R                  UR                   R	                  5       5      (       + $ gr   r   r   s     r   r   retry_if_not_result.__call__   sM    &IJJ""))~~k&9&9&@&@&BCCCr   r<   r   r   r   r   r   r      s@    4#&//6::,2D"E #$ #$4  r   r   c            	          ^  \ rS rSrSr  S	S\R                  \   S\R                  S\\R                  \   4   SS4U 4S jjjr
SrU =r$ )
retry_if_exception_message   z2Retries if an exception message equals or matches.Nmessagematchr   c                 p  >^^ T(       a)  U(       a"  [        U R                  R                   S35      eT(       a  S[        S[        4U4S jjnUnOVU(       a-  [
        R                  " U5      mS[        S[        4U4S jjnUnO"[        U R                  R                   S35      e[        TU ]!  U5        g )Nz.() takes either 'message' or 'match', not bothrH   r   c                     > T[        U 5      :H  $ r
   )str)rH   r   s    r   message_fnc8retry_if_exception_message.__init__.<locals>.message_fnc   s    #i.00r   c                 J   > [        TR                  [        U 5      5      5      $ r
   )r*   r   r   )rH   progs    r   	match_fnc6retry_if_exception_message.__init__.<locals>.match_fnc   s    DJJs9~677r   z3() missing 1 required argument 'message' or 'match')		TypeErrorr]   r#   rM   r*   recompiler[   r>   )r   r   r   r   r:   r   r   r]   s    `    @r   r>   #retry_if_exception_message.__init__   s    
 u>>**++YZ 
 1} 1 1 $I::e$D8] 8t 8 "I>>**++^_  	#r   r   NN)r#   r$   r%   r&   r'   rK   Optionalr   rb   Patternr>   r+   re   rf   s   @r   r   r      sV    < )->B$%$ ||D#v~~c'::;$ 
	$ $r   r   c            	          ^  \ rS rSrSr  SS\R                  \   S\R                  S\\R                  \   4   SS4U 4S jjjr
SS	S\4S
 jrSrU =r$ )retry_if_not_exception_message   z5Retries until an exception message equals or matches.Nr   r   r   c                 T   >^ [         TU ]  X5        U R                  mU4S jU l        g )Nc                     > T" U 0 UD6(       + $ r
   r   )args_kwargs_if_predicates     r   rX   9retry_if_not_exception_message.__init__.<locals>.<lambda>   s    |U7Vg7V3Vr   )r[   r>   r:   )r   r   r   r   r]   s      @r   r>   'retry_if_not_exception_message.__init__   s"    
 	(~~Vr   r   r   c                     UR                   c  [        S5      eUR                   R                  (       d  gUR                   R                  5       nUc  [        S5      eU R	                  U5      $ rx   rD   rI   s      r   r   'retry_if_not_exception_message.__call__   sa    &IJJ""))''113	IJJ~~i((r   r<   r   )r#   r$   r%   r&   r'   rK   r   r   rb   r   r>   r*   r   r+   re   rf   s   @r   r   r      st    ? )->BW%W ||D#v~~c'::;W 
	W W
)$4 
) 
) 
)r   r   c                   <    \ rS rSrSrS\SS4S jrSSS\4S	 jrS
r	g)r!   i	  z1Retries if any of the retries condition is valid.retriesr   Nc                     Xl         g r
   r   r   r   s     r   r>   retry_any.__init__      r   r   r   c                 B   ^ [        U4S jU R                   5       5      $ )Nc              3   2   >#    U  H  o" T5      v   M     g 7fr
   r   .0rr   s     r   	<genexpr>%retry_any.__call__.<locals>.<genexpr>       8<a1[>><   )anyr   r   s    `r   r   retry_any.__call__      84<<888r   r   
r#   r$   r%   r&   r'   r   r>   r*   r   r+   r   r   r   r!   r!   	  s,    ;  9$4 9 9r   r!   c                   <    \ rS rSrSrS\SS4S jrSSS\4S	 jrS
r	g)r   i  z/Retries if all the retries condition are valid.r   r   Nc                     Xl         g r
   r   r   s     r   r>   retry_all.__init__  r   r   r   r   c                 B   ^ [        U4S jU R                   5       5      $ )Nc              3   2   >#    U  H  o" T5      v   M     g 7fr
   r   r   s     r   r   %retry_all.__call__.<locals>.<genexpr>  r   r   )allr   r   s    `r   r   retry_all.__call__  r   r   r   r   r   r   r   r   r     s,    9  9$4 9 9r   r   )r(   r   rK   TYPE_CHECKINGtenacityr   ABCr   rb   rL   r*   
RetryBaseTr-   retry_neverr3   retry_alwaysr8   rO   rh   rq   r{   r   r   r   r   r!   r   r   r   r   <module>r      s  "  	 	'& &( \\*foo7G6H$6N&OOP
:  nJ   &C0 CG"4 G)"4 )6J <j  *   $!3  $F)%? )49
 99
 9r   