+
     Iin9  c                   sb   ^ 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ReadTimeoutErrorZGENERAL_CONNECTION_ERRORc                s    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.

Zrandz.The 'base' param must be greater than 0, got: )random
ValueError)basegrowth_factorattemptsZtime_to_sleep   &&& :/usr/lib/python3.14/site-packages/botocore/retryhandler.pydelay_exponentialr   +   sM     v~}}	<TFC
 	
 hl;<M    c                s:    \         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
   )	functoolsZpartialr   r      &&r   !create_exponential_delay_functionr   B   s      r   c                 sJ    \        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                 sx    V R ,          R,          pVR,          R8X  d   \        VR,          VR,          R7      # R# )__default__ZdelayZtypeZexponentialr	   r
   r   N)r   )r   r   Zdelay_configs   && r   r   r   X   sB    
 -(1LF},0f%&7
 	
 -r   c                 s   . 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)	getZappend_create_single_checker_extract_retryable_exceptionextendZlenMaxAttemptsDecoratorMultiCheckerZtuple)r   r   checkersr   r   r   ZkeyZcurrent_configZretry_exceptionZoperation_policiesZ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                 s    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                 s    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)Zservice_error_codeZhttp_status_code)status_code
error_code)r,   	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                 s    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(   r.   r'   r)   N)r    r   r#   EXCEPTION_MAP)r   r(   Z
exceptionsZnames   &   r   r"   r"      sf    .)Ll&&z266	L	(
 11DmD12 2	 
)r   c                   s0   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      &&&r   __init__ZRetryHandler.__init__   s    r   c                sh   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_exceptionZrequest_dictZcontextZretriesretries_context)r   zRetry needed, action of: %szNo retry needed.N )Z
isinstancer6   r$   r    Zupdater7   loggerdebug)r8   r   r'   r<   ZkwargsZchecker_kwargsr=   Zresults   &&&&,   r   __call__ZRetryHandler.__call__   s     h 0

 dmm%9::$^4Y?CCINO!!#4o"FG==*>**\\8\4FLL6?M'(r   )r7   r6   N)	__name__
__module____qualname____firstlineno____doc__r:   rA   __static_attributes____classdictcell__Z__classdict__   @r   r   r      s     ) )r   r   c                   s6   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                sl    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   )r8   r;   r'   r<      &&&&r   rA   ZBaseChecker.__call__   sE    , ''AA)//  KLLr   c                    R # r5   r>   r8   r;   r'   r9   r   rL   ZBaseChecker._check_response       r   c                rO   r5   r>   r8   r;   r<   r9   r   rM   Z#BaseChecker._check_caught_exception   rQ   r   r>   N)
rB   rC   rD   rE   rF   rA   rL   rM   rG   rH   rI   rJ   r   rK   rK      s     M> r   rK   c                   s:   a  ] tR tRt o RtRR ltR tR tRtV t	R# )	r$   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                s*    Wn         W n        W0n        R # r5   r6   _max_attempts_retryable_exceptions)r8   r   r   r   rN   r   r:   ZMaxAttemptsDecorator.__init__  s    )%9"r   c                s:   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# )maxZResponseMetadataTZMaxAttemptsReachedz0Reached the maximum number of retry attempts: %sF)rV   r    rT   _should_retryr?   r@   )r8   r;   r'   r<   r=   Zshould_retrys   &&&&& r   rA   ZMaxAttemptsDecorator.__call__  s     %(##E1-t/A/A&OE" ))&6
 !3!33',>(1+,M QK 234HI F" ##r   c                s    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)Zexc_infoN)rU   rT   r6   r?   r@   )r8   r;   r'   r<   Zes   &&&& r   rW   Z"MaxAttemptsDecorator._should_retry0  s    %%%.;M;M*M
}}".>  ==;KLL -- B!  
 s   A A<A77A<rS   r5   )
rB   rC   rD   rE   rF   r:   rA   rW   rG   rH   rI   rJ   r   r$   r$     s      :
8M Mr   r$   c                   ,   a  ] tR tRt o R tR tRtV tR# )r1   iC  c                    Wn         R # r5   _status_code)r8   r,   r   r   r:   ZHTTPStatusCodeChecker.__init__D  s    'r   c                s    V^ ,          P                   V P                  8X  d#   \        P                  RV P                  4       R# R# )r    z5retry needed: retryable HTTP status code received: %sTF)r,   r[   r?   r@   rP   r9   r   rL   Z%HTTPStatusCodeChecker._check_responseG  s:    A;""d&7&77LLG!! r   rZ   NrB   rC   rD   rE   r:   rL   rG   rH   rI   rJ   r   r1   r1   C  s     ( r   r1   c                   rX   )r0   iR  c                r4   r5   )r[   _error_code)r8   r,   r-   r9   r   r:   Z ServiceErrorCodeChecker.__init__S  s    '%r   c                s   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    ZErrorZCodez>retry needed: matching HTTP status and error code seen: %s, %sTF)r,   r[   r    r]   r?   r@   )r8   r;   r'   Zactual_error_coder   r   rL   Z'ServiceErrorCodeChecker._check_responseW  sq    A;""d&7&77 ( < @ @ H $4$44%%$$	 r   )r]   r[   Nr\   rI   rJ   r   r0   r0   R  s     & r   r0   c                   rX   )r%   ie  c                rY   r5   Z	_checkers)r8   r&   r   r   r:   ZMultiChecker.__init__f  s    !r   c                sV    V P                    F  pV! WV4      pV'       g   K  Vu # 	  R # )Fr^   )r8   r;   r'   r<   r   Zchecker_responses   &&&&  r   rA   ZMultiChecker.__call__i  s4    ~~G&*:   '' & r   r^   N)rB   rC   rD   rE   r:   rA   rG   rH   rI   rJ   r   r%   r%   e  s     " r   r%   c                   rX   )r2   is  c                rY   r5   _header_name)r8   r/   r   r   r:   ZCRC32Checker.__init__t  s    "r   c                s   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   )Zchecksum_typeZexpected_checksumZactual_checksum)	Zheadersr    r`   r?   r@   r   ZcontentZintr   )r8   r;   r'   Zhttp_responseZexpected_crcZactual_crc32s   &&&   r   rL   ZCRC32Checker._check_responsex  s     $,,001B1BCLL(!! !!!4!45
BL3|#44% 	 $")&),&7$0  5r   r_   Nr\   rI   rJ   r   r2   r2   s  s     # r   r2   c                   s*   a  ] tR tRt o RtR tRtV tR# )r+   i  zXRaise any caught exceptions.

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

c                s    Vhr5   r>   rR   r9   r   rM   Z'ExceptionRaiser._check_caught_exception  s
     r   r>   N)rB   rC   rD   rE   rF   rM   rG   rH   rI   rJ   r   r+   r+     s      r   r+   r5   )r   Zloggingr   Zbinasciir   Zbotocore.exceptionsr   r   r   r   r   Z	getLoggerrB   r?   r3   r   r   r   r   r   r!   r*   r"   r   rK   r$   r1   r0   r%   r2   r+   r>   r   r   <module>ra      s         
		8	$ 	!.	8


D!$&) &)R+ +\<M; <M~K k &; ; <k r   