
    'ja
                         d Z ddl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  e            Z G d	 d
          Zg dZdS )zasyncio compatible RetryHandler interface.
You can pass an array of handlers to customize retry logics in supported API clients.
    N)Optional)
RetryState)HttpRequest)HttpResponse)RetryIntervalCalculator)BackoffRetryIntervalCalculatorc                       e Zd ZU dZeed<   eed<   defdedefdZdddde	d	e
d
ee         dee         def
dZdddde	d	e
d
ee         dee         def
dZdddde	d	e
d
ee         dee         ddf
dZdS )AsyncRetryHandlerzasyncio compatible RetryHandler interface.
    You can pass an array of handlers to customize retry logics in supported API clients.
    max_retry_countinterval_calculator   c                 "    || _         || _        dS )zRetryHandler interface.

        Args:
            max_retry_count: The maximum times to do retries
            interval_calculator: Pass an interval calculator for customizing the logic
        N)r   r   )selfr   r   s      c/usr/local/lib/hermes-agent/venv/lib/python3.11/site-packages/slack_sdk/http_retry/async_handler.py__init__zAsyncRetryHandler.__init__   s      /#6       N)responseerrorstaterequestr   r   returnc                h   K   |j         | j        k    rdS |                     ||||           d {V S )NF)r   r   r   r   )current_attemptr   _can_retry_asyncr   r   r   r   r   s        r   can_retry_asyncz!AsyncRetryHandler.can_retry_async)   se        D$8885**	 + 
 
 
 
 
 
 
 
 	
r   c                "   K   t                      )N)NotImplementedErrorr   s        r   r   z"AsyncRetryHandler._can_retry_async:   s       "###r   c                   K   d|_         | j                            |j                  }t	          j        |           d {V  |                                 d S )NT)next_attempt_requestedr   calculate_sleep_durationr   asynciosleepincrement_current_attempt)r   r   r   r   r   durations         r   prepare_for_next_attempt_asyncz0AsyncRetryHandler.prepare_for_next_attempt_asyncD   sc       (,$+DDUEZ[[mH%%%%%%%%%'')))))r   )__name__
__module____qualname____doc__int__annotations__r   default_interval_calculatorr   r   r   r   r   	Exceptionboolr   r   r&    r   r   r
   r
      s          0000  !7R7 77 57 7 7 7& ,0%)
 
 
 
 	

 <(
 	"
 

 
 
 
, ,0%)$ $ $ $ 	$
 <($ 	"$ 
$ $ $ $ ,0%)* * * * 	*
 <(* 	"* 
* * * * * *r   r
   )r   r   r   r   r   r-   )r*   r"   typingr   slack_sdk.http_retry.stater   slack_sdk.http_retry.requestr   slack_sdk.http_retry.responser   (slack_sdk.http_retry.interval_calculatorr   1slack_sdk.http_retry.builtin_interval_calculatorsr   r-   r
   __all__r0   r   r   <module>r8      s            1 1 1 1 1 1 4 4 4 4 4 4 6 6 6 6 6 6 L L L L L L      =<>> <* <* <* <* <* <* <* <*~  r   