Ë
    ñ%9j,  ã                   óÆ  — 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y)zŠCommon 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 )ÚInvalidResponsez÷Error 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   •— t        t        | �
  |Ž  || _        y ©N)Úsuperr   Ú__init__Úresponse©Úselfr	   ÚargsÚ	__class__s      €úY/var/www/html/truck-me/venv/lib/python3.12/site-packages/google/resumable_media/common.pyr   zInvalidResponse.__init__\   s   ø€ ÜŒo˜tÑ-¨tÑ4Ø ˆŒØGó    ©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__classcell__©r   s   @r   r   r   S   ó   ø„ ñ÷Hð Hr   r   c                   ó"   ‡ — e Zd ZdZˆ fd„Zˆ xZS )ÚDataCorruptionzâError 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   •— t        t        | �
  |Ž  || _        y r   )r   r   r   r	   r
   s      €r   r   zDataCorruption.__init__k   s   ø€ ÜŒn˜dÑ,¨dÑ3Ø ˆŒØ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y)Ú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        }|| _        || _        || _        || _        || _        y 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__�   sR   € ð  Ð+°Ð0GÜÔ3Ó4Ð4ØÐ'¨KÐ,?Ü#7Ð à"ˆŒØ$8ˆÔ!Ø&ˆÔØ*ˆÔØ$ˆ�r   c                 óV   — | 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¢   s2   € ð ×$Ñ$Ð,Ø $×"2Ñ"2Ñ2Ð2à $×";Ñ";Ñ;Ð;r   )r   r   r   r   Ú	MAX_SLEEPr   r)   © r   r   r   r   q   s"   „ ñð> Ø!ØØØó%ó&<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:      sð   ðñó
 ð Pð ð Ð Ø Ià—[‘[×3Ñ3Ð ðð —K‘K×1Ñ1Ð ðð €	ðð Ð ðð 	‡K�K×!Ñ!Ø‡K�K×ÑØ‡K�K×%Ñ%Ø‡K�K×ÑØ‡K�K×#Ñ#Ø‡K�K×Ñð€	ðôH�iô HôH�Yô HôB<�Fõ B<r   