
    iP                        d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZm	Z	 d dl
mZ d dlmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z! ddl m"Z" ddl m#Z# ddl m$Z$ ddl m%Z% ddl m&Z& ddl'm(Z( ddl'm)Z) ddl'm*Z* ddl'm+Z+ dd l'm,Z, dd!l'm-Z- dd"l'm.Z. dd#l'm/Z/ dd#l'm/Z0 dd$l'm1Z1 dd%l2m3Z3 dd&l2m4Z4 dd'l5m6Z6 dd(l5m7Z7 dd)l8m9Z9 dd*l8m:Z: dZ;ej<        rd dl=Z=dd+lm>Z> dd,l m?Z? dd-l'm@Z@  ejA        d.          ZB ejA        d/ejC        d0ejD        f         1          ZE G d2 d3eF          ZG eH            ZI G d4 d5          ZJ G d6 d7eK          ZL G d8 d9          ZM G d: d;eM          ZN eH            ZOd<ejP        ejD        eHf         d=ejD        d>ejD        fd?ZQ G d@ dAeF          ZR G dB dC          ZS G dD dEe          ZT G dF dGeT          ZUejV        d         dHk    rejW        ejD                 ZXnejW        ZX G dI dJeX          ZW G dK dL          ZYejZ        dMeEd>eEfdN            ZejZ        ee% e-             e            e4e7ddOeRdf
dPejC        ejP        e[eKf         gdf         dQdRdSdTdUdVdWejC        dLgdf         dXejC        dLgdf         dYej\        ejC        dLgdf                  dZe]d[ej^        dA         d\ej\        ejC        dLgejD        f                  d>ejC        eEgeEf         fd]            Zd^ejD        d_ejD        d>ejD        fd`Zd dal_m`Z` e;rd dblambZb g dcZcdS )d    N)ABCabstractmethod)futures)iscoroutinefunction   )
retry_base)	retry_all)retry_always)	retry_any)retry_if_exception)retry_if_exception_type)retry_if_exception_cause_type)retry_if_not_exception_type)retry_if_not_result)retry_if_result)retry_never)retry_unless_exception_type)retry_if_exception_message)retry_if_not_exception_messagesleep)sleep_using_event)stop_after_attempt)stop_after_delay)stop_all)stop_any)
stop_never)stop_when_event_set)
wait_chain)wait_combine)wait_exponential)
wait_fixed)wait_incrementing)	wait_none)wait_random)wait_random_exponential)wait_exponential_jitter)
before_log)before_nothing)	after_log)after_nothing)before_sleep_log)before_sleep_nothing)
RetryBaseT)	StopBaseT)	WaitBaseTWrappedFnReturnT	WrappedFn.)boundc                       e Zd ZdZdS )TryAgainz/Always retry the executed function when raised.N)__name__
__module____qualname____doc__     bC:\Users\betacode\Desktop\descargarYoutube\venv\Lib\site-packages\pip/_vendor/tenacity/__init__.pyr5   r5   e   s        9999r;   r5   c                       e Zd ZdS )	DoAttemptNr6   r7   r8   r:   r;   r<   r>   r>   l           Dr;   r>   c                       e Zd ZdS )DoSleepNr?   r:   r;   r<   rB   rB   p   r@   r;   rB   c                   t    e Zd ZU dZdZej        e         ed<   dZ	ej
        e         ed<   defdZdefdZdS )	
BaseActiona5  Base class for representing actions to take by retry object.

    Concrete implementations must define:
    - __init__: to initialize all necessary fields
    - REPR_FIELDS: class variable specifying attributes to include in repr(self)
    - NAME: for identification in retry object methods and callbacks
    r:   REPR_FIELDSNNAMEreturnc                 t     d                      fd j        D                       } j        j         d| dS )Nz, c              3   B   K   | ]}| d t          |          V  dS )=N)getattr).0fieldselfs     r<   	<genexpr>z&BaseAction.__repr__.<locals>.<genexpr>   s;      ``eAAu)=)=AA``````r;   ())joinrE   	__class__r6   )rN   	state_strs   ` r<   __repr__zBaseAction.__repr__   sH    II````tO_`````	.)88I8888r;   c                      t          |           S N)reprrN   s    r<   __str__zBaseAction.__str__   s    Dzzr;   )r6   r7   r8   r9   rE   tSequencestr__annotations__rF   OptionalrU   rZ   r:   r;   r<   rD   rD   t   s           $&KC%%% D!*S/   9# 9 9 9 9      r;   rD   c                   0    e Zd ZdZdZdej        ddfdZdS )RetryActionr   retryr   rG   Nc                 .    t          |          | _        d S rW   )floatr   )rN   r   s     r<   __init__zRetryAction.__init__   s    5\\


r;   )r6   r7   r8   rE   rF   r[   SupportsFloatre   r:   r;   r<   ra   ra      sB        KD"ao "$ " " " " " "r;   ra   firstsecondrG   c                     | t           u r|n| S rW   )_unset)rg   rh   s     r<   
_first_setrk      s    f__66%/r;   c                   8     e Zd ZdZd
 fdZddZdefd	Z xZS )
RetryErrorz>Encapsulates the last attempt instance right before giving up.last_attemptFuturerG   Nc                 X    || _         t                                          |           d S rW   )rn   superre   )rN   rn   rS   s     r<   re   zRetryError.__init__   s)    (&&&&&r;   
t.NoReturnc                 P    | j         j        r| j                                         | rW   )rn   failedresultrY   s    r<   reraisezRetryError.reraise   s*    # 	-#**,,,
r;   c                 0    | j         j         d| j         dS )N[])rS   r6   rn   rY   s    r<   rZ   zRetryError.__str__   s!    .)@@D,=@@@@r;   )rn   ro   rG   N)rG   rr   )	r6   r7   r8   r9   re   rv   r]   rZ   __classcell__rS   s   @r<   rm   rm      s{        HH' ' ' ' ' '   
A A A A A A A A Ar;   rm   c            	           e Zd ZdZddZddZdej        ej        e	                  d	ej        e	         d
ej        d         dej        e
         fdZdS )AttemptManagerzManage attempt context.retry_stateRetryCallStatec                     || _         d S rW   r~   )rN   r~   s     r<   re   zAttemptManager.__init__   s    &r;   rG   Nc                     d S rW   r:   rY   s    r<   	__enter__zAttemptManager.__enter__   s    r;   exc_type	exc_value	tracebackztypes.TracebackTypec                     |!|| j                             |||f           dS | j                             d            d S )NT)r~   set_exception
set_result)rN   r   r   r   s       r<   __exit__zAttemptManager.__exit__   sP     I$9**Hi+KLLL4 ''---4r;   )r~   r   rG   N)r6   r7   r8   r9   re   r   r[   r_   TypeBaseExceptionboolr   r:   r;   r<   r}   r}      s        !!' ' ' '   *QVM23 :m, :34	
 
D	     r;   r}   c                      e Zd Zee e             e            eedde	df
de
j        e
j        eef         gdf         dddddd	d
e
j        dgdf         de
j        dgdf         de
j        e
j        dgdf                  dede
j        e	         de
j        e
j        dge
j        f                  fdZeeeeeeeeeef
de
j        e
j        e
j        eef         gdf         ef         de
j        def         de
j        def         de
j        eef         d
e
j        e
j        dgdf         ef         de
j        e
j        dgdf         ef         de
j        e
j        e
j        dgdf                  ef         de
j        eef         de
j        e
j        e	         ef         de
j        e
j        e
j        dge
j        f                  ef         dd fdZdefdZede
j        ee
j        f         fd            ZdedefdZd!dZddde
j        e e!e
j        f         fdZ"de
j#        e$ddf         fdZ%e&de
j        de'f         de
j        de
j        de'fd             Z(dS )"BaseRetryingNFr   stopr/   waitr0   rb   r.   beforer   afterbefore_sleeprv   retry_error_clsretry_error_callbackc                     || _         || _        || _        || _        || _        || _        || _        || _        t          j	                    | _
        |	| _        |
| _        d S rW   )r   r   r   rb   r   r   r   rv   	threadinglocal_localr   r   rN   r   r   r   rb   r   r   r   rv   r   r   s              r<   re   zBaseRetrying.__init__   sb     
		

(o''.$8!!!r;   rG   c                    |                      t          || j                  t          || j                  t          || j                  t          || j                  t          || j                  t          || j                  t          || j                  t          || j	                  t          |	| j
                  t          |
| j                  
  
        S )z8Copy this object with some parameters changed if needed.
r   r   r   rb   r   r   r   rv   r   r   )rS   rk   r   r   r   rb   r   r   r   rv   r   r   r   s              r<   copyzBaseRetrying.copy   s     ~~UDJ//D$),,D$),,UDJ//fdk22UDJ//#L$2CDDw55&8LMM!+,@$B[!\!\  
 
 	
r;   c                     d| j         j         dt          |           dd| j         d| j         d| j         d| j         d| j         d	| j         d
S )N<z object at 0xxz (stop=z, wait=z, sleep=z, retry=z	, before=z, after=z)>)	rS   r6   idr   r   r   rb   r   r   rY   s    r<   rU   zBaseRetrying.__repr__   s    $' $ $bhhD $ $I$ $I$ $ Z$ $ Z	$ $
 k$ $ Z$ $ $	
r;   c                     	 | j         j        S # t          $ rO t          j        t          j        t          t          j        f         i           | j         _        | j         j        cY S w xY w)aS  Return a dictionary of runtime statistics.

        This dictionary will be empty when the controller has never been
        ran. When it is running or has ran previously it should have (but
        may not) have useful and/or informational keys and values when
        running is underway and/or completed.

        .. warning:: The keys in this dictionary **should** be some what
                     stable (not changing), but there existence **may**
                     change between major releases as new statistics are
                     gathered or removed so before accessing keys ensure that
                     they actually exist and handle when they do not.

        .. note:: The values in this dictionary are local to the thread
                  running call (so if multiple threads share the same retrying
                  object - either directly or indirectly) they will each have
                  there own view of statistics they have collected (in the
                  future we may provide a way to aggregate the various
                  statistics from each thread).
        )r   
statisticsAttributeErrorr[   castDictr]   AnyrY   s    r<   r   zBaseRetrying.statistics   sa    ,	*;)) 	* 	* 	*%&VAF3:,>%C%CDK";))))	*s    AA'&A'fc                      t          j                  dt          j        dt          j        dt          j        f fd            }dt          j        dt          j        dt          f fd} |_        ||_        |S )z[Wrap a function for retrying.

        :param f: A function to wraps for retrying.
        argskwrG   c                       g| R i |S rW   r:   )r   r   r   rN   s     r<   	wrapped_fz%BaseRetrying.wraps.<locals>.wrapped_f!  s#    4'D'''B'''r;   kwargsc                  D     j         | i |                              S rW   )r   wraps)r   r   r   rN   s     r<   
retry_withz&BaseRetrying.wraps.<locals>.retry_with%  s(    49d-f--33A666r;   )	functoolsr   r[   r   r2   rb   r   )rN   r   r   r   s   ``  r<   r   zBaseRetrying.wraps  s     
			(QU 	(!% 	(AE 	( 	( 	( 	( 	( 	( 
		(	7ae 	7qu 	7 	7 	7 	7 	7 	7 	7 	7 	)	r;   c                     | j                                          t          j                    | j         d<   d| j         d<   d| j         d<   d S )N
start_timer   attempt_numberr   idle_for)r   cleartime	monotonicrY   s    r<   beginzBaseRetrying.begin-  sI    (,(8(8%,-()&'
###r;   r~   c                    |j         }|*| j        |                     |           t                      S |j        o&t	          |                                t                    }|s)|                     |          s|                                S | j	        | 	                    |           |j
        | j        d<   |                     |          ra| j        r|                     |          S |                     |          }| j        r|                                ||                                | j        r|                     |          }nd}t#          |          |_        |xj        |z  c_        | j        dxx         |z  cc<   | j        dxx         dz  cc<   | j        |                     |           t+          |          S )Ndelay_since_first_attempt        r   r   r   )outcomer   r>   rt   
isinstance	exceptionr5   rb   ru   r   seconds_since_startr   r   r   r   rv   r   ra   next_actionr   r   rB   )rN   r~   futis_explicit_retry	retry_excr   s         r<   iterzBaseRetrying.iter3  s   !;{&K(((;;JP:cmmoox+P+P! 	 TZZ%<%< 	 ::<<:!JJ{###7B7V3499[!! 	1( >00===,,S11I| *'')))09 	IIk**EEE"-e"4"4%
###u,###()))Q.)))(k***u~~r;   c              #   V  K   |                                   t          | d di           }	 |                     |          }t          |t                    rt          |          V  nAt          |t                    r*|                                 |                     |           nd S )Nr:   )fnr   r   Tr   )	r   r   r   r   r>   r}   rB   prepare_for_next_attemptr   )rN   r~   dos      r<   __iter__zBaseRetrying.__iter__X  s      

$TdBGGG	{33B"i(( $=======B(( 44666

2	r;   r   .r   r   c                     d S rW   r:   )rN   r   r   r   s       r<   __call__zBaseRetrying.__call__f  s	     	r;   r   ))r6   r7   r8   r   r   r$   r   r)   r+   rm   r[   CallableUnionintrd   r_   r   r   r   re   rj   objectr   r   r]   rU   propertyr   r   r2   r   r   r>   rB   r   	Generatorr}   r   r   r1   r   r:   r;   r<   r   r      s        :?&%IKK55777E6CIM.8RV9 9z173:./569 9 	9
 9 
,-t349 z+,d239 j-=,>,D!EF9 9 
+9  j5E4F4M)NO9 9 9 96 KQ-3-3-3HNGMZ`)/?Eci
 
wqz173:#6"7"=>FG
 gk6)*
 gk6)*	

 wz6)*
 
$4#5t#;<fDE
 wqz#3"4d":;VCD
 gaj5E4F4L)MNPVVW
 v&
 
!3V!;<
  gaj=M<NPQPU<U1V&WY_&_`
 

 
 
 
6	
# 	
 	
 	
 	
 *AF3:. * * * X*6y Y    $( ( ( (# 0 #QWYQRQV=V5W # # # #J!+ndD&@A     Js,,- u %	
 
   ^  r;   r   c                   X    e Zd ZdZdej        def         dej        dej        defdZdS )	RetryingzRetrying controller.r   .r   r   rG   c                    |                                   t          | |||          }	 |                     |          }t          |t                    rU	  ||i |}|                    |           nw# t          $ r) |                    t          j	                               Y nEw xY wt          |t                    r*|                                 |                     |           n|S )N)retry_objectr   r   r   Tr   )r   r   r   r   r>   r   r   r   sysexc_inforB   r   r   )rN   r   r   r   r~   r   ru   s          r<   r   zRetrying.__call__s  s    	

$$2DQWXXX	{33B"i(( 3R000F  **62222 % > > >--clnn=====> B(( 44666

2		s   A3 30B&%B&N)	r6   r7   r8   r9   r[   r   r1   r   r   r:   r;   r<   r   r   p  se        Js,,- u %	
 
     r;   r   	   c            	       z     e Zd ZdZdeddf fdZedefd            Ze	dede
j        dedd fd	            Z xZS )
ro   zDEncapsulates a (future or past) attempted call to a target function.r   rG   Nc                 V    t                                                       || _        d S rW   )rq   re   r   )rN   r   rS   s     r<   re   zFuture.__init__  s'    ,r;   c                 .    |                                  duS )z8Return whether a exception is being held in this future.N)r   rY   s    r<   rt   zFuture.failed  s     ~~t++r;   valuehas_exceptionc                 v     | |          }|r|                     |           n|                    |           |S )zConstruct a new Future object.)r   r   )clsr   r   r   r   s        r<   	constructzFuture.construct  sI     c.!! 	"e$$$$NN5!!!
r;   )r6   r7   r8   r9   r   re   r   r   rt   classmethodr[   r   r   rz   r{   s   @r<   ro   ro     s        NN-s -t - - - - - - , , , , X, s 15  RZ    [    r;   ro   c            
           e Zd ZdZdedej        e         dej        dej        ddf
dZ	e
dej        e         fd	            Zdd
Zdej        ddfdZdej        ej        e         edf         ddfdZdefdZdS )r   z5State related to a single call wrapped with Retrying.r   r   r   r   rG   Nc                     t          j                    | _        || _        || _        || _        || _        d| _        d | _        d | _	        d| _
        d | _        d S )Nr   r   )r   r   r   r   r   r   r   r   r   outcome_timestampr   r   )rN   r   r   r   r   s        r<   re   zRetryCallState.__init__  s^     .**(	 $%+/48"48r;   c                 2    | j         d S | j         | j        z
  S rW   )r   r   rY   s    r<   r   z"RetryCallState.seconds_since_start  s     !)4%77r;   c                 P    d | _         d | _        | xj        dz  c_        d | _        d S Nr   )r   r   r   r   rY   s    r<   r   z'RetryCallState.prepare_for_next_attempt  s3    !%q r;   valc                     t          j                    }t          | j                  }|                    |           ||c| _        | _        d S rW   )r   r   ro   r   r   r   r   )rN   r   tsr   s       r<   r   zRetryCallState.set_result  sH    ^T())s/2B,d,,,r;   r   ztypes.TracebackType| Nonec                     t          j                    }t          | j                  }|                    |d                    ||c| _        | _        d S r   )r   r   ro   r   r   r   r   )rN   r   r   r   s       r<   r   zRetryCallState.set_exception  sP     ^T())(1+&&&/2B,d,,,r;   c                 d   | j         d}nU| j         j        r-| j                                         }d|j        j         d| d}nd| j                                          }t          t          | j        d                    }| j        j        }d| dt          |            d| j
         d	| d
| dS )Nznone yetzfailed ( rQ   z	returned    r   z: attempt #z; slept for z; last result: >)r   rt   r   rS   r6   ru   rd   roundr   r   r   )rN   ru   r   sleptclsnames        r<   rU   zRetryCallState.__repr__  s    <FF\  	9..00IK	 3 <KKyKKKFF8!4!4!6!688FeDM1--...)r7rrRXXrr$2ErrSXrriorrrrr;   r   )r6   r7   r8   r9   r   r[   r_   r2   r   re   r   rd   r   r   r   Tupler   r   r   r]   rU   r:   r;   r<   r   r     s+       ??9"9 Jy!9 e	9
 9 
9 9 9 9: 8QZ%6 8 8 8 X8
       7ae 7 7 7 7 77} 5}Fa ab7	7 7 7 7s# s s s s s sr;   r   funcc                     d S rW   r:   )r   s    r<   rb   rb     s    Cr;   Fr   r   r/   r   r0   rb   r.   r   r   r   rv   r   r   c
                     d S rW   r:   r   s
             r<   rb   rb     s	     Cr;   dargsdkwc                       t                     dk    r2t           d                   r t                       d                   S dt          dt          f fd}|S )zWrap a function with a new `Retrying` object.

    :param dargs: positional arguments passed to Retrying object
    :param dkw: keyword arguments passed to the Retrying object
    r   r   r   rG   c                    t          | t                    r/t          j        d| j        j         d| j        j         d           t          |           rt          i }nYt          rFt          t          j
        d          r,t          j
                            |           rt          i }nt          i }|                    |           S )NzGot retry_base instance (zQ) as callable argument, this will probably hang indefinitely (did you mean retry=z(...)?)is_coroutine_function)r   r   warningswarnrS   r6   r   AsyncRetryingtornadohasattrgenr   TornadoRetryingr   r   )r   rr   r   s     r<   wrapzretry.<locals>.wrap  s    !Z(( n0D n nPQP[Pdn n n  
 #1%% ,!50C00 ,WW[2IJJ ,w{OpOpqrOsOs ,#U2c22e+s++771::r;   )lencallablerb   r2   )r   r   r  s   `` r<   rb   rb     su     5zzQ8E!H--uwwuQx   	I 	) 	 	 	 	 	 	 	  r;   )r  )r  )5r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   wait_full_jitterr'   r(   r)   r*   r+   r,   r-   rb   r2   r5   	NO_RESULTr>   rB   rD   ra   rm   r}   r   r   ro   r   r  )dr   r   r   r   typingr[   r   abcr   r   
concurrentr   inspectr   rb   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   napr   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r  r'   r   r(   r)   r   r*   r+   r   r,   r-   r  TYPE_CHECKINGtypesr.   r/   r0   TypeVarr1   r   r   r2   	Exceptionr5   r   r  r>   rd   rB   rD   ra   rj   r   rk   rm   r}   r   r   version_inforo   FutureGenericTr   overloadr   r_   r   r   pip._vendor.tenacity._asyncior  pip._vendor.tenacity.tornadowebr  __all__r:   r;   r<   <module>r     s  (     



           # # # # # # # #       ' ' ' ' ' '                         % % % % % % * * * * * * 0 0 0 0 0 0 . . . . . . & & & & & & " " " " " "       . . . . . . - - - - - - 1 1 1 1 1 1       " " " " " " % $ $ $ $ $ " " " " " "                   % % % % % %             " " " " " "       # # # # # #             ) ) ) ) ) ) = = = = = = ) ) ) ) ) )       " " " " " "                   + * * * * * . . . . . . ?  LLL!!!!!! 19/00 AIkCJ)?@@@	: : : : :y : : : FHH		 	 	 	 	 	 	 		 	 	 	 	e 	 	 	       (" " " " "* " " " 
0agaeVm, 0ae 0 0 0 0 0A A A A A A A A        0n n n n n3 n n nb    |   8 A!^AE*NN^N    ^   .Es Es Es Es Es Es Es EsP 	 i     5:"!	11333A2?EI,6NR :qwsEz*+T12
  	
 J()4/0 :'($./ *QZ)9(:D(@AB  VL) *QZ1A0BAE0I%JK ZY&'   !%  !%    < 8 7 7 7 7 7
 @??????6 6 6r;   