abc@sddlZddlmZddlZddlZddlZdZdZdefdYZ defdYZ d e fd YZ dS( iN(tsixi?csStdkr9tdr9d}|dSfd}|SdS(s Decorator function that instantiates the Retrying object @param *dargs: positional arguments passed to Retrying object @param **dkw: keyword arguments passed to the Retrying object iics"tjfd}|S(Ncstj||S(N(tRetryingtcall(targstkw(tf(s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyt wrapped_f$s(Rtwraps(RR((Rs8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyt wrap_simple"scs(tjfd}|S(Ncstj||S(N(RR(RR(tdargstdkwR(s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyR/s(RR(RR(R R (Rs8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pytwrap-s$N(tlentcallable(R R RR ((R R s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pytretrys " RcBseZd d d d d d d d d d d d d ed d d dZdZdZdZdZdZ dZ dZ dZ d Z d Zd ZRS( cs|dkrdn||_|dkr-dn||_|dkrHdn||_|dkrcdn||_|dkr~dn||_|dkrdn||_| dkrdn| |_| dkrdn| |_| dkrt n| |_ |dkrdn||_ g|dk r3j |j n|dk rRj |jn|dk rj||_n3|dkrfd|_nt|||_dg|dk rj |jn|dk s|dk rj |jn|dk s | dk rj |jn| dk s6| dk rIj |jn|dk ra||_n3|dkrfd|_nt|||_| dkr|j|_n | |_| dkr|j|_n | |_||_dS( NiidiiicstfdDS(Nc3s|]}|VqdS(N((t.0R(tattemptstdelay(s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pys as(tany(RR(t stop_funcs(RRs8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pytatc_sdS(Ni((Rtkwargs((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyRhRcstfdDS(Nc3s|]}|VqdS(N((RR(RR(s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pys ys(tmax(RR(t wait_funcs(RRs8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyRyR(tNonet_stop_max_attempt_numbert_stop_max_delayt _wait_fixedt_wait_random_mint_wait_random_maxt_wait_incrementing_startt_wait_incrementing_incrementt_wait_exponential_multipliertMAX_WAITt_wait_exponential_maxt_wait_jitter_maxtappendtstop_after_attempttstop_after_delaytstoptgetattrt fixed_sleept random_sleeptincrementing_sleeptexponential_sleeptwaitt always_rejectt_retry_on_exceptiont never_rejectt_retry_on_resultt_wrap_exception(tselfR(R.tstop_max_attempt_numbertstop_max_delayt wait_fixedtwait_random_mintwait_random_maxtwait_incrementing_starttwait_incrementing_incrementtwait_exponential_multipliertwait_exponential_maxtretry_on_exceptiontretry_on_resulttwrap_exceptiont stop_funct wait_functwait_jitter_max((RRs8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyt__init__:sR              cCs ||jkS(s;Stop after the previous attempt >= stop_max_attempt_number.(R(R4tprevious_attempt_numbertdelay_since_first_attempt_ms((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyR&scCs ||jkS(s=Stop after the time from the first attempt >= stop_max_delay.(R(R4RERF((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyR'scCsdS(s#Don't sleep at all before retrying.i((R4RERF((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pytno_sleepscCs|jS(s0Sleep a fixed amount of time between each retry.(R(R4RERF((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyR*scCstj|j|jS(sISleep a random amount of time between wait_random_min and wait_random_max(trandomtrandintRR(R4RERF((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyR+scCs1|j|j|d}|dkr-d}n|S(s Sleep an incremental amount of time after each attempt, starting at wait_incrementing_start and incrementing by wait_incrementing_increment ii(RR (R4RERFtresult((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyR,s  cCsKd|}|j|}||jkr2|j}n|dkrGd}n|S(Nii(R!R#(R4RERFtexpRJ((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyR-s     cCstS(N(tFalse(R4RJ((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyR1scCstS(N(tTrue(R4RJ((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyR/scCsFt}|jr,||j|jdO}n||j|jO}|S(Ni(RLt has_exceptionR0tvalueR2(R4tattempttreject((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyt should_rejects  c Os[tttjd}d}x2trVyt||||t}Wn%tj}t||t}nX|j|s|j |j Stttjd|}|j ||r|j r|j r|j qIt |nU|j||} |jr8tj|j} | td| } ntj| d|d7}q%WdS(Niiig@@(tinttroundttimeRMtAttemptRLtsystexc_infoRRtgetR3R(RNt RetryErrorR.R$RHRtsleep( R4tfnRRt start_timetattempt_numberRPttbRFR[tjitter((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyRs*    N(t__name__t __module__RRLRDR&R'RGR*R+R,R-R1R/RRR(((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyR8s0 F        RVcBs,eZdZdZedZdZRS(s An Attempt encapsulates a call to a target function that may end as a normal return value from the function or an Exception depending on what occurred during the execution. cCs||_||_||_dS(N(ROR^RN(R4ROR^RN((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyRDs  cCsT|jrI|rt|qPtj|jd|jd|jdn|jSdS(s Return the return value of this Attempt instance or raise an Exception. If wrap_exception is true, this Attempt is wrapped inside of a RetryError before being raised. iiiN(RNRZRtreraiseRO(R4R@((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyRYs  +cCsO|jr5dj|jdjtj|jdSdj|j|jSdS(NsAttempts: {0}, Error: {1}RisAttempts: {0}, Value: {1}(RNtformatR^tjoint tracebackt format_tbRO(R4((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyt__repr__s ,(RaRbt__doc__RDRLRYRh(((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyRVs  RZcBs eZdZdZdZRS(sU A RetryError encapsulates the last Attempt instance right before giving up. cCs ||_dS(N(t last_attempt(R4Rj((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyRDscCsdj|jS(NsRetryError[{0}](RdRj(R4((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyt__str__ s(RaRbRiRDRk(((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyRZs ( RHt pip._vendorRRWRURfR"RtobjectRRVt ExceptionRZ(((s8/usr/lib/python2.7/site-packages/pip/_vendor/retrying.pyts     !