
    (ph/                        S r SSKrSrSr \R
                  R                  r \R
                  R                  r Sr Sr	 \R
                  R                  \R
                  R                  \R
                  R                  \R
                  R                  \R
                  R                  \R
                  R                  4r  " S S\5      r " S	 S
\5      r " S S\5      rg)zCommon utilities for Google Media Downloads and Resumable Uploads.

Includes custom exception types, useful constants and shared helpers.
    NzIAt most one of `max_cumulative_retry` and `max_retries` can be specified.i   g      P@g     @c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )InvalidResponseS   zError class for responses which are not in the correct state.

Args:
    response (object): The HTTP response which caused the failure.
    args (tuple): The positional arguments typically passed to an
        exception class.
c                 4   > [         [        U ]
  " U6   Xl        g N)superr   __init__responseselfr
   args	__class__s      P/var/www/html/venv/lib/python3.13/site-packages/google/resumable_media/common.pyr	   InvalidResponse.__init__\   s    ot-t4 G    r
   __name__
__module____qualname____firstlineno____doc__r	   __static_attributes____classcell__r   s   @r   r   r   S       H Hr   r   c                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )DataCorruptionb   zError class for corrupt media transfers.

Args:
    response (object): The HTTP response which caused the failure.
    args (tuple): The positional arguments typically passed to an
        exception class.
c                 4   > [         [        U ]
  " U6   Xl        g r   )r   r   r	   r
   r   s      r   r	   DataCorruption.__init__k   s    nd,d3 Gr   r   r   r   s   @r   r   r   b   r   r   r   c                   2    \ rS rSrSr\SSSS4S jrS rSrg)	RetryStrategyq   a  Configuration class for retrying failed requests.

At most one of ``max_cumulative_retry`` and ``max_retries`` can be
specified (they are both caps on the total number of retries). If
neither are specified, then ``max_cumulative_retry`` is set as
:data:`MAX_CUMULATIVE_RETRY`.

Args:
    max_sleep (Optional[float]): The maximum amount of time to sleep after
        a failed request. Default is :attr:`MAX_SLEEP`.
    max_cumulative_retry (Optional[float]): The maximum **total** amount of
        time to sleep during retry process.
    max_retries (Optional[int]): The number of retries to attempt.
    initial_delay (Optional[float]): The initial delay. Default 1.0 second.
    muiltiplier (Optional[float]): Exponent of the backoff. Default is 2.0.

Attributes:
    max_sleep (float): Maximum amount of time allowed between requests.
    max_cumulative_retry (Optional[float]): Maximum total sleep time
        allowed during retry process.
    max_retries (Optional[int]): The number retries to attempt.
    initial_delay (Optional[float]): The initial delay. Default 1.0 second.
    muiltiplier (Optional[float]): Exponent of the backoff. Default is 2.0.

Raises:
    ValueError: If both of ``max_cumulative_retry`` and ``max_retries``
        are passed.
Ng      ?g       @c                     Ub  Ub  [        [        5      eUc	  Uc  [        nXl        X l        X0l        X@l        XPl        g r   )
ValueError_SLEEP_RETRY_ERROR_MSGMAX_CUMULATIVE_RETRY	max_sleepmax_cumulative_retrymax_retriesinitial_delay
multiplier)r   r)   r*   r+   r,   r-   s         r   r	   RetryStrategy.__init__   sH      +0G344'K,?#7 "$8!&*$r   c                 T    U R                   c  X R                  :*  $ XR                   :*  $ )a  Check if another retry is allowed.

Args:
    total_sleep (float): With another retry, the amount of sleep that
        will be accumulated by the caller.
    num_retries (int): With another retry, the number of retries that
        will be attempted by the caller.

Returns:
    bool: Indicating if another retry is allowed (depending on either
    the cumulative sleep allowed or the maximum number of retries
    allowed.
)r*   r+   )r   total_sleepnum_retriess      r   retry_allowedRetryStrategy.retry_allowed   s.     $$,"2"222";";;;r   )r,   r*   r+   r)   r-   )	r   r   r   r   r   	MAX_SLEEPr	   r2   r    r   r   r#   r#   q   s"    > !%&<r   r#   )r   http.clienthttpr'   UPLOAD_CHUNK_SIZEclientPERMANENT_REDIRECTTOO_MANY_REQUESTSr4   r(   REQUEST_TIMEOUTINTERNAL_SERVER_ERRORBAD_GATEWAYSERVICE_UNAVAILABLEGATEWAY_TIMEOUT	RETRYABLE	Exceptionr   r   objectr#   r5   r   r   <module>rD      s   
  S    I[[33  KK11  	   	KK!!KKKK%%KKKK##KK	Hi HHY HB<F B<r   