
    b\j                        % S r SSKJr  SSKrSSKrSSKJrJr  / SQr\R                  \4r
S\S'   \" 1 S	k5      rS
S.SS jjrSS jrSS jrg)a  Shared backoff / jitter / retry-classification helpers for the runner helpers.

Extracted so the control-plane poller, the session tool runner, and the worker
heartbeat all compute backoff and classify retryable failures the same way.
Consumed by the runner helpers only.
    )annotationsN   )APIErrorAPIStatusError)backoffjitteris_fatal_status_errorTRANSIENT_ERRORSztuple[type[Exception], ...]r
   >         g       @)basec                   [        XU -  5      $ )zCExponential backoff for ``attempt`` (1-indexed), capped at ``cap``.)min)attemptcapr   s      J/var/www/website/venv/lib/python3.13/site-packages/anthropic/lib/_retry.pyr   r       s    s'M""    c                .    [         R                  " X5      $ )uE   Uniform random delay in ``[low, high)`` — spreads out retry storms.)randomuniform)lowhighs     r   r   r   %   s    >>#$$r   c                    [        U [        5      =(       a9    SU R                  s=:*  =(       a    S:  Os  =(       a    U R                  [        ;  $ )zTrue for a 4xx that retrying will not fix (bad key, missing resource).

Aligns with the core client's ``_should_retry`` policy: 408 / 409 / 429 are
transient and worth retrying; every other 4xx is fatal.
i  i  )
isinstancer   status_code_RETRYABLE_4XX)errs    r   r	   r	   *   s9     c>*uscoo/K/K/KuPSP_P_guPuur   )r   intr   floatr   r    returnr    )r   r    r   r    r!   r    )r   	Exceptionr!   bool)__doc__
__future__r   r   httpx_exceptionsr   r   __all__	HTTPErrorr
   __annotations__	frozensetr   r   r   r	    r   r   <module>r-      sU    #   2
L 27(0K - K
 ?+ 8; #
%
vr   