+
    in9                     b   ^ RI t ^ RIt^ RIt^ RIHt ^ RIHtHtHtH	t	H
t
 ]P                  ! ]4      tR]]]
]	./tR tR tRR ltRR ltRR	 ltR
 tR tR t ! R R4      t ! R R4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      tR# )    N)crc32)ChecksumErrorConnectionClosedErrorConnectionErrorEndpointConnectionErrorReadTimeoutErrorGENERAL_CONNECTION_ERRORc                    V R8X  d   \         P                   ! 4       p MV ^ 8:  d   \        RV  24      hWV^,
          ,          ,          pV# )a  Calculate time to sleep based on exponential function.

The format is::

    base * growth_factor ^ (attempts - 1)

If ``base`` is set to 'rand' then a random number between
0 and 1 will be used as the base.
Base must be greater than 0, otherwise a ValueError will be
raised.

randz.The 'base' param must be greater than 0, got: )random
ValueError)basegrowth_factorattemptstime_to_sleeps   &&& 7/usr/lib/python3/dist-packages/botocore/retryhandler.pydelay_exponentialr   +   sM     v~}}	<TFC
 	
 hl;<M    c                :    \         P                  ! \        WR7      # )zCreate an exponential delay function based on the attempts.

This is used so that you only have to pass it the attempts
parameter to calculate the delay.

r   r   )	functoolspartialr   r   s   &&r   !create_exponential_delay_functionr   B   s      r   c                 J    \        WR 7      p\        WR 7      p\        W#R7      # ))operation_name)checkeraction) create_checker_from_retry_configcreate_retry_action_from_configRetryHandler)configr   r   r   s   &&  r   create_retry_handlerr"   N   s+    .G -F 77r   c                 x    V R ,          R,          pVR,          R8X  d   \        VR,          VR,          R7      # R# )__default__delaytypeexponentialr   r   r   N)r   )r!   r   delay_configs   && r   r   r   X   sB    
 -(1LF},0f%&7
 	
 -r   c                    . pR p. pRV 9   dw   V R,          P                  R. 4      pV R,          R,          pV FG  pWV,          pVP                  \        V4      4       \        V4      pVf   K6  VP	                  V4       KI  	  Vet   V P                  V4      ea   W,          R,          p	V	 FK  pVP                  \        W,          4      4       \        W,          4      pVf   K:  VP	                  V4       KM  	  \        V4      ^8X  d   \        V^ ,          VR7      # \        V4      p
\        V
V\        V4      R7      # )Nr$   policiesmax_attempts)r+   )r+   retryable_exceptions)	getappend_create_single_checker_extract_retryable_exceptionextendlenMaxAttemptsDecoratorMultiCheckertuple)r!   r   checkersr+   r,   r*   keycurrent_configretry_exceptionoperation_policiesmulti_checkers   &&         r   r   r   e   s0   HL-(,,Z<m,^<C%]NOO2>BC:>JO*$++O<  !fjj&@&L#3J?%COO23E3JKL:"'O *$++O< & 8}#HQKlKK$X.#%!&';!<
 	
r   c                     R V R,          9   d   \        V R,          R ,          4      # RV R,          9   d   \        4       # R# )responseapplies_whensocket_errorsN)_create_single_response_checkerExceptionRaiser)r!   s   &r   r/   r/      sF    VN++.>":.
 	
 
F>2	2   
3r   c                     R V 9   d   \        V R,          V R ,          R7      pV# RV 9   d   \        V R,          R7      pV# RV 9   d   \        V R,          R7      pV# \        R4      h)service_error_codehttp_status_code)status_code
error_code)rE   	crc32body)headerzUnknown retry policy)ServiceErrorCodeCheckerHTTPStatusCodeCheckerCRC32Checkerr   )r=   r   s   & r   r@   r@      s    x') !34 45
 N 
x	'' !34
 N 
	 h{&;< N /00r   c                     V R ,          pRVP                  R/ 4      9   d   \        .# RV9   d1   . pVR,           F  pVP                  \        V,          4       K!  	  V# R# )r>   rG   r=   r?   N)r-   r   r1   EXCEPTION_MAP)r!   r>   
exceptionsnames   &   r   r0   r0      sf    .)Ll&&z266	L	(
 11DmD12 2	 
)r   c                   0   a  ] tR t^t o RtR tR tRtV tR# )r    a  Retry handler.

The retry handler takes two params, ``checker`` object
and an ``action`` object.

The ``checker`` object must be a callable object and based on a response
and an attempt number, determines whether or not sufficient criteria for
a retry has been met.  If this is the case then the ``action`` object
(which also is a callable) determines what needs to happen in the event
of a retry.

c                    Wn         W n        R # N)_checker_action)selfr   r   s   &&&r   __init__RetryHandler.__init__   s    r   c                h   RVRVRV/p\        V P                  \        4      '       d3   VR,          R,          P                  R4      pVP	                  RV/4       V P                  ! R/ VB '       d+   V P                  VR7      p\        P                  R	V4       V# \        P                  R
4       R# )zHandler for a retry.

Intended to be hooked up to an event handler (hence the **kwargs),
this will process retries appropriately.

attempt_numberr=   caught_exceptionrequest_dictcontextretriesretries_context)r   zRetry needed, action of: %szNo retry needed.N )
isinstancerS   r3   r-   updaterT   loggerdebug)rU   r   r=   rZ   kwargschecker_kwargsr^   results   &&&&,   r   __call__RetryHandler.__call__   s     h 0

 dmm%9::$^4Y?CCINO!!#4o"FG==*>**\\8\4FLL6?M'(r   )rT   rS   N)	__name__
__module____qualname____firstlineno____doc__rV   rg   __static_attributes____classdictcell____classdict__s   @r   r    r       s     ) )r   r    c                   6   a  ] tR t^t o RtR tR tR tRtV t	R# )BaseCheckerzBase class for retry checkers.

Each class is responsible for checking a single criteria that determines
whether or not a retry should not happen.

c                l    Ve   V P                  W4      # Ve   V P                  W4      # \        R4      h)ad  Determine if retry criteria matches.

Note that either ``response`` is not None and ``caught_exception`` is
None or ``response`` is None and ``caught_exception`` is not None.

:type attempt_number: int
:param attempt_number: The total number of times we've attempted
    to send the request.

:param response: The HTTP response (if one was received).

:type caught_exception: Exception
:param caught_exception: Any exception that was caught while trying to
    send the HTTP response.

:return: True, if the retry criteria matches (and therefore a retry
    should occur.  False if the criteria does not match.

z,Both response and caught_exception are None.)_check_response_check_caught_exceptionr   )rU   rY   r=   rZ   s   &&&&r   rg   BaseChecker.__call__   sE    , ''AA)//  KLLr   c                    R # rR   r_   rU   rY   r=   s   &&&r   ru   BaseChecker._check_response       r   c                    R # rR   r_   rU   rY   rZ   s   &&&r   rv   #BaseChecker._check_caught_exception   r{   r   r_   N)
ri   rj   rk   rl   rm   rg   ru   rv   rn   ro   rp   s   @r   rs   rs      s     M> r   rs   c                   :   a  ] tR tRt o RtRR ltR tR tRtV t	R# )	r3   i  a{  Allow retries up to a maximum number of attempts.

This will pass through calls to the decorated retry checker, provided
that the number of attempts does not exceed max_attempts.  It will
also catch any retryable_exceptions passed in.  Once max_attempts has
been exceeded, then False will be returned or the retryable_exceptions
that was previously being caught will be raised.

Nc                *    Wn         W n        W0n        R # rR   rS   _max_attempts_retryable_exceptions)rU   r   r+   r,   s   &&&&r   rV   MaxAttemptsDecorator.__init__  s    )%9"r   c                :   V'       d*   \        VP                  R ^ 4      V P                  4      VR &   V P                  WV4      pV'       dP   WP                  8  d>   Ve"   RV^,          9   d   RV^,          R,          R&   \        P                  RV4       R# V# R# )maxResponseMetadataTMaxAttemptsReachedz0Reached the maximum number of retry attempts: %sF)r   r-   r   _should_retryrb   rc   )rU   rY   r=   rZ   r^   should_retrys   &&&&& r   rg   MaxAttemptsDecorator.__call__  s     %(##E1-t/A/A&OE" ))&6
 !3!33',>(1+,M QK 234HI F" ##r   c                    V P                   '       d$   WP                  8  d    V P                  WV4      # V P                  WV4      #   T P                    d$   p\        P	                  R TRR7        Rp?R# Rp?ii ; i)z,retry needed, retryable exception caught: %sT)exc_infoN)r   r   rS   rb   rc   )rU   rY   r=   rZ   es   &&&& r   r   "MaxAttemptsDecorator._should_retry0  s    %%%.;M;M*M
}}".>  ==;KLL -- B!  
 s   A A<A77A<r   rR   )
ri   rj   rk   rl   rm   rV   rg   r   rn   ro   rp   s   @r   r3   r3     s      :
8M Mr   r3   c                   ,   a  ] tR tRt o R tR tRtV tR# )rJ   iC  c                    Wn         R # rR   _status_code)rU   rE   s   &&r   rV   HTTPStatusCodeChecker.__init__D  s    'r   c                    V^ ,          P                   V P                  8X  d#   \        P                  RV P                  4       R# R# )r   z5retry needed: retryable HTTP status code received: %sTF)rE   r   rb   rc   ry   s   &&&r   ru   %HTTPStatusCodeChecker._check_responseG  s:    A;""d&7&77LLG!! r   r   Nri   rj   rk   rl   rV   ru   rn   ro   rp   s   @r   rJ   rJ   C  s     ( r   rJ   c                   ,   a  ] tR tRt o R tR tRtV tR# )rI   iR  c                    Wn         W n        R # rR   )r   _error_code)rU   rE   rF   s   &&&r   rV    ServiceErrorCodeChecker.__init__S  s    '%r   c                   V^ ,          P                   V P                  8X  df   V^,          P                  R/ 4      P                  R4      pW0P                  8X  d.   \        P                  RV P                  V P                  4       R# R# )r   ErrorCodez>retry needed: matching HTTP status and error code seen: %s, %sTF)rE   r   r-   r   rb   rc   )rU   rY   r=   actual_error_codes   &&& r   ru   'ServiceErrorCodeChecker._check_responseW  sq    A;""d&7&77 ( < @ @ H $4$44%%$$	 r   )r   r   Nr   rp   s   @r   rI   rI   R  s     & r   rI   c                   ,   a  ] tR tRt o R tR tRtV tR# )r4   ie  c                    Wn         R # rR   	_checkers)rU   r6   s   &&r   rV   MultiChecker.__init__f  s    !r   c                V    V P                    F  pV! WV4      pV'       g   K  Vu # 	  R # )Fr   )rU   rY   r=   rZ   r   checker_responses   &&&&  r   rg   MultiChecker.__call__i  s4    ~~G&*:   '' & r   r   N)ri   rj   rk   rl   rV   rg   rn   ro   rp   s   @r   r4   r4   e  s     " r   r4   c                   ,   a  ] tR tRt o R tR tRtV tR# )rK   is  c                    Wn         R # rR   _header_name)rU   rH   s   &&r   rV   CRC32Checker.__init__t  s    "r   c                   V^ ,          pVP                   P                  V P                  4      pVf#   \        P	                  RV P                  4       R# \        V^ ,          P                  4      R,          pV\        V4      8X  g8   \        P	                  R\        V4      V4       \        R\        V4      VR7      hR# )r   Nz?crc32 check skipped, the %s header is not in the http response.l    z>retry needed: crc32 check failed, expected != actual: %s != %sr   )checksum_typeexpected_checksumactual_checksum)	headersr-   r   rb   rc   r   contentintr   )rU   rY   r=   http_responseexpected_crcactual_crc32s   &&&   r   ru   CRC32Checker._check_responsex  s     $,,001B1BCLL(!! !!!4!45
BL3|#44% 	 $")&),&7$0  5r   r   Nr   rp   s   @r   rK   rK   s  s     # r   rK   c                   *   a  ] tR tRt o RtR tRtV tR# )rA   i  zXRaise any caught exceptions.

This class will raise any non None ``caught_exception``.

c                    VhrR   r_   r}   s   &&&r   rv   'ExceptionRaiser._check_caught_exception  s
     r   r_   N)ri   rj   rk   rl   rm   rv   rn   ro   rp   s   @r   rA   rA     s      r   rA   rR   )r   loggingr   binasciir   botocore.exceptionsr   r   r   r   r   	getLoggerri   rb   rM   r   r   r"   r   r   r/   r@   r0   r    rs   r3   rJ   rI   r4   rK   rA   r_   r   r   <module>r      s         
		8	$ 	!.	8


D!$&) &)R+ +\<M; <M~K k &; ; <k r   