
    h/                     :   d Z ddlZdZdZ	 ej        j        Z	 ej        j        Z	 dZ	 dZ		 ej        j        ej        j
        ej        j        ej        j        ej        j        ej        j        fZ	  G d de          Z G d	 d
e          Z G d de          ZdS )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                   "     e Zd ZdZ fdZ xZS )InvalidResponsezError 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                 P     t          t          |           j        |  || _        d S N)superr   __init__responseselfr	   args	__class__s      a/var/www/html/e360mart/e360mart_env/lib/python3.11/site-packages/google/resumable_media/common.pyr   zInvalidResponse.__init__\   s*    -ot$$-t44 GG    __name__
__module____qualname____doc__r   __classcell__r   s   @r   r   r   S   K         H H H H H H H H Hr   r   c                   "     e Zd ZdZ fdZ xZS )DataCorruptionzError 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                 P     t          t          |           j        |  || _        d S r   )r   r   r   r	   r
   s      r   r   zDataCorruption.__init__k   s*    ,nd##,d33 GGr   r   r   s   @r   r   r   b   r   r   r   c                   *    e Zd ZdZeddddfdZd ZdS )RetryStrategyaK  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                     ||t          t                    |	|t          }|| _        || _        || _        || _        || _        d S 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   zRetryStrategy.__init__   sY      +0G3444'K,?#7 "$8!&*$r   c                 <    | j         || j        k    S || j         k    S )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_allowedzRetryStrategy.retry_allowed   s)     $,$"222$";;;r   )r   r   r   r   	MAX_SLEEPr   r)    r   r   r   r   q   sR         > !% % % %&< < < < <r   r   )r   http.clienthttpr   UPLOAD_CHUNK_SIZEclientPERMANENT_REDIRECTTOO_MANY_REQUESTSr*   r    REQUEST_TIMEOUTINTERNAL_SERVER_ERRORBAD_GATEWAYSERVICE_UNAVAILABLEGATEWAY_TIMEOUT	RETRYABLE	Exceptionr   r   objectr   r+   r   r   <module>r:      sN   
     S    I[3  K1  	   	K!KK%KK#K	H H H H Hi H H HH H H H HY H H HB< B< B< B< B<F B< B< B< B< B<r   