o
    Vhf	                     @   sl   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
 d
ZdS )znRetryHandler interface.
You can pass an array of handlers to customize retry logics in supported API clients.
    N)Optional)
RetryState)HttpRequest)HttpResponse)RetryIntervalCalculator)BackoffRetryIntervalCalculatorc                   @   s   e Zd ZU dZeed< eed< defdedefddZdddd	e	d
e
dee dee def
ddZdddd	e	d
e
dee dee def
ddZdddd	e	d
e
dee dee ddf
ddZdS )RetryHandlerzvRetryHandler interface.
    You can pass an array of handlers to customize retry logics in supported API clients.
    max_retry_countinterval_calculator   c                 C   s   || _ || _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
    r   a/var/www/html/status_management/venv/lib/python3.10/site-packages/slack_sdk/http_retry/handler.py__init__   s   
zRetryHandler.__init__N)responseerrorstaterequestr   r   returnc                C   s"   |j | jkrdS | j||||dS )NF)r   r   r   r   )current_attemptr	   
_can_retryr   r   r   r   r   r   r   r   	can_retry*   s   zRetryHandler.can_retryc                C   s   t  )N)NotImplementedErrorr   r   r   r   r   ;   s   zRetryHandler._can_retryc                C   s*   d|_ | j|j}t| |  d S )NT)next_attempt_requestedr
   calculate_sleep_durationr   timesleepincrement_current_attempt)r   r   r   r   r   durationr   r   r   prepare_for_next_attemptE   s   
z%RetryHandler.prepare_for_next_attempt)__name__
__module____qualname____doc__int__annotations__r   default_interval_calculatorr   r   r   r   r   	Exceptionboolr   r   r    r   r   r   r   r      sd   
 


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   r   r   r   r   <module>   s    