Ë
    õ%9j™]  ã                   ó&  — d dl Z d dlmZ d dlZd dlZd dlmZmZmZm	Z	 d dl
mZ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Zerd dlZd d	lmZ n	 d dlZd d	lmZ 	 d d
lmZ dZed„ «       Z G d„ d«      Z y# eef$ r dZY Œ'w xY w# e$ r dZY Œ+w xY w)é    N)Úasynccontextmanager)ÚMappingÚOptionalÚTYPE_CHECKINGÚUnion)Ú_exponential_backoffÚ
exceptions)Ú	transport)ÚCredentials)Úmtls)ÚTimeoutError)ÚClientTimeout)ÚRequestTFc                óˆ   ‡‡‡K  — t        j                  «       Š| Šˆˆfd„Šˆˆfd„}	 |­–—  ‰«        y#  ‰«        w xY w­w)a·  
    timeout_guard is an asynchronous context manager to apply a timeout to an asynchronous block of code.

    Args:
        timeout (float): The time in seconds before the context manager times out.

    Raises:
        google.auth.exceptions.TimeoutError: If the code within the context exceeds the provided timeout.

    Usage:
        async with timeout_guard(10) as with_timeout:
            await with_timeout(async_function())
    c                  óh   •— t        j                  «       ‰z
  } ‰| z
  }|dk  rt        d‰› d�«      ‚|S )Nr   z3Context manager exceeded the configured timeout of ús.)ÚtimeÚ	monotonicr   )ÚelapsedÚ	remainingÚstartÚtotal_timeouts     €€ú^/var/www/html/truck-me/venv/lib/python3.12/site-packages/google/auth/aio/transport/sessions.pyÚ_remaining_timez&timeout_guard.<locals>._remaining_timeB   sG   ø€ Ü—.‘.Ó" UÑ*ˆØ! GÑ+ˆ	Ø˜Š>ÜØEÀmÀ_ÐTVÐWóð ð Ðó    c              “   óÈ   •K  — 	  ‰«       }t        j                  | |«      ƒ d {  –—† }|S 7 Œ# t         j                  t        f$ r}t        d| › d‰› d�«      |‚d }~ww xY w­w)NzThe operation z$ exceeded the configured timeout of r   )ÚasyncioÚwait_forr   )Úcoror   ÚresponseÚer   r   s       €€r   Úwith_timeoutz#timeout_guard.<locals>.with_timeoutK   sq   øè ø€ ð	Ù'Ó)ˆIÜ$×-Ñ-¨d°IÓ>×>ˆHØˆOð ?ùä×$Ñ$¤lÐ3ò 	ÜØ   Ð&JÈ=È/ÐY[Ð\óàðûð	üs1   ƒA"… . ¥,¦. «A"¬. ®AÁAÁAÁA"N)r   r   )Útimeoutr"   r   r   r   s     @@@r   Útimeout_guardr$   0   s=   úè ø€ ô �N‰NÓ€EØ€MõõðØÓñ 	Õø‰Õüs   …#A©6 ®A¶	?¿Ac                   ó  — e Zd ZdZ	 ddedeej                     fd„Zdd„Z	ddej                  ej                  ej                  fdeded	ee   d
eeeef      dedeeef   dee   dej&                  fd„Z ej,                  e«      ddej                  ej                  ej                  fded	ee   d
eeeef      dedeeef   dee   dej&                  fd„«       Z ej,                  e«      ddej                  ej                  ej                  fded	ee   d
eeeef      dedeeef   dee   dej&                  fd„«       Z ej,                  e«      ddej                  ej                  ej                  fded	ee   d
eeeef      dedeeef   dee   dej&                  fd„«       Z ej,                  e«      ddej                  ej                  ej                  fded	ee   d
eeeef      dedeeef   dee   dej&                  fd„«       Z ej,                  e«      ddej                  ej                  ej                  fded	ee   d
eeeef      dedeeef   dee   dej&                  fd„«       Zed„ «       Zdd„Zy)ÚAsyncAuthorizedSessiona«  This is an asynchronous implementation of :class:`google.auth.requests.AuthorizedSession` class.
    We utilize an instance of a class that implements :class:`google.auth.aio.transport.Request` configured
    by the caller or otherwise default to `google.auth.aio.transport.aiohttp.Request` if the external aiohttp
    package is installed.

    A Requests Session class with credentials.

    This class is used to perform asynchronous requests to API endpoints that require
    authorization::

        import aiohttp
        from google.auth.aio.transport import sessions

        async with sessions.AsyncAuthorizedSession(credentials) as authed_session:
            response = await authed_session.request(
                'GET', 'https://www.googleapis.com/storage/v1/b')

    The underlying :meth:`request` implementation handles adding the
    credentials' headers to the request and refreshing credentials as needed.

    Args:
        credentials (google.auth.aio.credentials.Credentials):
            The credentials to add to the request.
        auth_request (Optional[google.auth.aio.transport.Request]):
            An instance of a class that implements
            :class:`~google.auth.aio.transport.Request` used to make requests
            and refresh credentials. If not passed,
            an instance of :class:`~google.auth.aio.transport.aiohttp.Request`
            is created.

    Raises:
        - google.auth.exceptions.TransportError: If `auth_request` is `None`
            and the external package `aiohttp` is not installed.
        - google.auth.exceptions.InvalidType: If the provided credentials are
            not of type `google.auth.aio.credentials.Credentials`.
    NÚcredentialsÚauth_requestc                 ó  — t        |t        «      s"t        j                  dt	        |«      › d�«      ‚|| _        |}|st        r
t        «       }d| _        d | _	        d | _
        |€t        j                  d«      ‚|| _        y )Nz#The configured credentials of type zJ are invalid and must be of type `google.auth.aio.credentials.Credentials`Fzv`auth_request` must either be configured or the external package `aiohttp` must be installed to use the default value.)Ú
isinstancer   r	   ÚInvalidTypeÚtypeÚ_credentialsÚAIOHTTP_INSTALLEDÚAiohttpRequestÚ_is_mtlsÚ_mtls_init_taskÚ_cached_certÚTransportErrorÚ_auth_request)Úselfr'   r(   r4   s       r   Ú__init__zAsyncAuthorizedSession.__init__‚   s˜   € ô ˜+¤{Ô3Ü×(Ñ(Ø5´d¸;Ó6GÐ5Hð  ISð  Tóð ð (ˆÔØ$ˆÙÕ!2Ü*Ó,ˆMØˆŒØ#ˆÔØ ˆÔØÐ Ü×+Ñ+ð Ióð ð +ˆÕr   c              ƒ   óœ   ‡ ‡K  — ‰ j                   €%ˆˆ fd„}t        j                   |«       «      ‰ _         ‰ j                   ƒ d{  –—† S 7 Œ­w)a±  Configure the client certificate and key for SSL connection.

        The function does nothing unless `GOOGLE_API_USE_CLIENT_CERTIFICATE` is
        explicitly set to `true`. In this case if client certificate and key are
        successfully obtained (from the given client_cert_callback or from application
        default SSL credentials), the underlying transport will be reconfigured
        to use mTLS.
        Note: This function does nothing if the `aiohttp` library is not
        installed.
        Important: Calling this method will close any ongoing API requests associated
        with the current session. To ensure a smooth transition, it is recommended
        to call this during session initialization.

        Args:
            client_cert_callback (Optional[Callable[[], (bytes, bytes)]]):
                The optional callback returns the client certificate and private
                key bytes both in PEM format.
                If the callback is None, application default SSL credentials
                will be used.

        Raises:
            google.auth.exceptions.MutualTLSChannelError: If mutual TLS channel
                creation failed for any reason.
        Nc               “   ó  •K  — t        j                  t        j                  j                  j
                  j                  «      ƒ d {  –—† } | sd‰
_        y 	 t        j                  ‰	«      ƒ d {  –—† \  ‰
_        }}‰
j                  r¸|‰
_	        t        j                  t         j                  ||«      ƒ d {  –—† }t        r}t        ‰
j                  t        «      rbt        j                   |¬«      }t        j"                  |¬«      }‰
j                  }t        |¬«      ‰
_        |j%                  «       ƒ d {  –—†  y y y y 7 Œú7 ŒÔ7 Œ�7 Œ# t&        j(                  t*        t,        f$ r}t'        j.                  |«      }||‚d }~ww xY w­w)NF)Ússl)Ú	connector)Úsession)r   Ú_run_in_executorÚgoogleÚauthr
   Ú_mtls_helperÚcheck_use_client_certr0   Úget_client_cert_and_keyr2   Úmake_client_cert_ssl_contextr.   r*   r4   r/   ÚaiohttpÚTCPConnectorÚClientSessionÚcloser	   ÚClientCertErrorÚImportErrorÚOSErrorÚMutualTLSChannelError)Úuse_client_certÚcertÚkeyÚssl_contextr:   Únew_sessionÚold_auth_requestÚ
caught_excÚnew_excÚclient_cert_callbackr5   s            €€r   Ú_do_configurezDAsyncAuthorizedSession.configure_mtls_channel.<locals>._do_configure±   se  øè ø€ ä(,×(=Ñ(=Ü—K‘K×)Ñ)×6Ñ6×LÑLó)÷ #�ñ 'Ø$)�D”MØð2ô
 #×:Ñ:Ð;OÓP×Pñ	ØœØØð —}’}Ø,0˜Ô)Ü,0×,AÑ,AÜ ×=Ñ=¸tÀSó-÷ '˜õ
 -´Ø ×.Ñ.´ô2ô )0×(<Ñ(<ÀÔ(M˜IÜ*1×*?Ñ*?È)Ô*T˜Kà/3×/AÑ/AÐ,Ü1?ÈÔ1T˜DÔ.à"2×"8Ñ"8Ó":×:Ñ:ð2Ð,ð %ð#øð Qøð'øð ;ùô ×.Ñ.ÜÜðò 2ô
 )×>Ñ>¸zÓJ�GØ! zÐ1ûð2üsn   ƒAF	ÁEÁ	F	ÁE Á0EÁ1AE Â9EÂ:B E Ä:E	Ä;E Ä?F	ÅE ÅE Å	E ÅFÅ)FÆFÆF	)r1   r   Úcreate_task)r5   rS   rT   s   `` r   Úconfigure_mtls_channelz-AsyncAuthorizedSession.configure_mtls_channel–   sD   ùè ø€ ð2 ×ÑÐ'õ(2ôT $+×#6Ñ#6±}³Ó#GˆDÔ à×)Ñ)×)Ð)Ð)ús   „AAÁA
ÁAÚmethodÚurlÚdataÚheadersÚmax_allowed_timer#   Útotal_attemptsÚreturnc              ‹   óè  K  — | j                   r	 | j                   ƒ d{  –—†  t        j                  |¬«      }	|€i }t	        |«      4 ƒd{  –—† }
 |
| j
                  j                  | j                  |||«      «      ƒ d{  –—†  d}t        �+t        |t        «      r|j                  �|j                  nd}n!t        |t        t        f«      rt        |«      }|	2 3 d{  –—† } |
 | j                  |||||fi |¤Ž«      ƒ d{  –—† }|j                  t        j                  vsŒK ddd«      ƒd{  –—†  S 7 �Œ# t        $ r Y �Œ'w xY w7 �Œ7 ŒÎ7 Œq7 ŒN6 Œ07 Œ$# 1 ƒd{  –—†7  sw Y   S xY w­w)aY  
        Args:
                method (str): The http method used to make the request.
                url (str): The URI to be requested.
                data (Optional[bytes]): The payload or body in HTTP request.
                headers (Optional[Mapping[str, str]]): Request headers.
                timeout (float, aiohttp.ClientTimeout):
                The amount of time in seconds to wait for the server response
                with each individual request.
                max_allowed_time (float):
                If the method runs longer than this, a ``Timeout`` exception is
                automatically raised. Unlike the ``timeout`` parameter, this
                value applies to the total method execution time, even if
                multiple requests are made under the hood.
                total_attempts (int):
                The total number of retry attempts.

                Mind that it is not guaranteed that the timeout error is raised
                at ``max_allowed_time``. It might take longer, for example, if
                an underlying request takes a lot of time, but the request
                itself does not timeout, e.g. if a large file is being
                transmitted. The timeout error will be raised after such
                request completes.

        Returns:
                google.auth.aio.transport.Response: The HTTP response.

        Raises:
                google.auth.exceptions.TimeoutError: If the method does not complete within
                the configured `max_allowed_time` or the request exceeds the configured
                `timeout`.
        N)r\   g        )r1   Ú	Exceptionr   ÚAsyncExponentialBackoffr$   r-   Úbefore_requestr4   r   r*   ÚtotalÚintÚfloatÚstatus_coder
   ÚDEFAULT_RETRYABLE_STATUS_CODES)r5   rW   rX   rY   rZ   r[   r#   r\   ÚkwargsÚretriesr"   Úactual_timeoutÚ_r    s                 r   ÚrequestzAsyncAuthorizedSession.requestß   s”  è ø€ ðV ×ÒðØ×*Ñ*×*Ð*ô
 '×>Ñ>Ø)ô
ˆð ˆ?ØˆGÜ Ð!1Ó2÷ 	ð 	°lÙà×!Ñ!×0Ñ0Ø×&Ñ&¨°°Wóó÷ ð ð %(ˆNÜÐ(¬Z¸ÄÔ-OØ29·-±-Ð2K §¢ÐQT‘Ü˜G¤c¬5 \Ô2Ü!& w£�ð #÷ ð �aÙ!-Ø&�D×&Ñ&Ø˜V T¨7°NñØFLñó"÷ �ð
 ×'Ñ'¬y×/WÑ/WÒWØ÷+	÷ 	ð, ˆðA +úÜò ò ðúð	ùðøðøðøð #øð	ø÷ 	÷ 	ð 	ð, ˆüsÈ   ‚E2�D? ŸD< D? ¤)E2ÁEÁE2Á2EÂEÂAEÃEÃ"EÃ#EÃ&!EÄEÄ EÄ)EÄ*E2Ä5EÄ6E2Ä<D? Ä?	EÅE2ÅEÅE2ÅEÅEÅEÅEÅE2ÅE/Å"E%Å#E/Å*E2c           	   ‹   óP   K  —  | j                   d||||||fi |¤Žƒ d{  –—† S 7 Œ­w)á  
        Args:
                url (str): The URI to be requested.
                data (Optional[bytes]): The payload or body in HTTP request.
                headers (Optional[Mapping[str, str]]): Request headers.
                max_allowed_time (float):
                If the method runs longer than this, a ``Timeout`` exception is
                automatically raised. Unlike the ``timeout`` parameter, this
                value applies to the total method execution time, even if
                multiple requests are made under the hood.
                timeout (float, aiohttp.ClientTimeout):
                The amount of time in seconds to wait for the server response
                with each individual request.
                total_attempts (int):
                The total number of retry attempts.

                Mind that it is not guaranteed that the timeout error is raised
                at ``max_allowed_time``. It might take longer, for example, if
                an underlying request takes a lot of time, but the request
                itself does not timeout, e.g. if a large file is being
                transmitted. The timeout error will be raised after such
                request completes.

        Returns:
                google.auth.aio.transport.Response: The HTTP response.

        Raises:
                google.auth.exceptions.TimeoutError: If the method does not complete within
                the configured `max_allowed_time` or the request exceeds the configured
                `timeout`.
        ÚGETN©rk   ©r5   rX   rY   rZ   r[   r#   r\   rg   s           r   ÚgetzAsyncAuthorizedSession.get.  óE   è ø€ ðT "�T—\‘\ØØØØØØØñ	
ð ñ	
÷ 	
ð 		
ð 	
úó   ‚&Ÿ$ &c           	   ‹   óP   K  —  | j                   d||||||fi |¤Žƒ d{  –—† S 7 Œ­w)rm   ÚPOSTNro   rp   s           r   ÚpostzAsyncAuthorizedSession.postc  sE   è ø€ ðT "�T—\‘\ØØØØØØØñ	
ð ñ	
÷ 	
ð 		
ð 	
úrs   c           	   ‹   óP   K  —  | j                   d||||||fi |¤Žƒ d{  –—† S 7 Œ­w)rm   ÚPUTNro   rp   s           r   ÚputzAsyncAuthorizedSession.put˜  rr   rs   c           	   ‹   óP   K  —  | j                   d||||||fi |¤Žƒ d{  –—† S 7 Œ­w)rm   ÚPATCHNro   rp   s           r   ÚpatchzAsyncAuthorizedSession.patchÍ  sE   è ø€ ðT "�T—\‘\ØØØØØØØñ	
ð ñ	
÷ 	
ð 		
ð 	
úrs   c           	   ‹   óP   K  —  | j                   d||||||fi |¤Žƒ d{  –—† S 7 Œ­w)rm   ÚDELETENro   rp   s           r   ÚdeletezAsyncAuthorizedSession.delete  sE   è ø€ ðT "�T—\‘\ØØØØØØØñ	
ð ñ	
÷ 	
ð 		
ð 	
úrs   c                 ó   — | j                   S )z#Indicates if mutual TLS is enabled.)r0   ©r5   s    r   Úis_mtlszAsyncAuthorizedSession.is_mtls7  s   € ð �}‰}Ðr   c              ƒ   óT   K  — | j                   j                  «       ƒ d{  –—†  y7 Œ­w)z<
        Close the underlying auth request session.
        N)r4   rF   r�   s    r   rF   zAsyncAuthorizedSession.close<  s    è ø€ ð × Ñ ×&Ñ&Ó(×(Ò(ús   ‚( &¡()N)r]   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r
   r   r6   rV   Ú_DEFAULT_TIMEOUT_SECONDSÚDEFAULT_MAX_RETRY_ATTEMPTSÚstrÚbytesr   rd   r   r   rc   ÚResponserk   Ú	functoolsÚwrapsrq   rv   ry   r|   r   Úpropertyr‚   rF   © r   r   r&   r&   \   sV  „ ñ#ðL UYñ+Ø&ð+Ø6>¸y×?PÑ?PÑ6Qó+ó(G*ðZ !%Ø/3Ø"+×"DÑ"DØ/8×/QÑ/QØ(1×(LÑ(LñMàðMð ðMð �u‰oð	Mð
 ˜' # s (Ñ+Ñ,ðMð  ðMð �u˜mÐ+Ñ,ðMð ! ™ðMð 
×	Ñ	óMð^ €Y‡_�_�WÓð !%Ø/3Ø"+×"DÑ"DØ/8×/QÑ/QØ(1×(LÑ(Lñ2
àð2
ð �u‰oð2
ð ˜' # s (Ñ+Ñ,ð	2
ð
  ð2
ð �u˜mÐ+Ñ,ð2
ð ! ™ð2
ð 
×	Ñ	ò2
ó ð2
ðh €Y‡_�_�WÓð !%Ø/3Ø"+×"DÑ"DØ/8×/QÑ/QØ(1×(LÑ(Lñ2
àð2
ð �u‰oð2
ð ˜' # s (Ñ+Ñ,ð	2
ð
  ð2
ð �u˜mÐ+Ñ,ð2
ð ! ™ð2
ð 
×	Ñ	ò2
ó ð2
ðh €Y‡_�_�WÓð !%Ø/3Ø"+×"DÑ"DØ/8×/QÑ/QØ(1×(LÑ(Lñ2
àð2
ð �u‰oð2
ð ˜' # s (Ñ+Ñ,ð	2
ð
  ð2
ð �u˜mÐ+Ñ,ð2
ð ! ™ð2
ð 
×	Ñ	ò2
ó ð2
ðh €Y‡_�_�WÓð !%Ø/3Ø"+×"DÑ"DØ/8×/QÑ/QØ(1×(LÑ(Lñ2
àð2
ð �u‰oð2
ð ˜' # s (Ñ+Ñ,ð	2
ð
  ð2
ð �u˜mÐ+Ñ,ð2
ð ! ™ð2
ð 
×	Ñ	ò2
ó ð2
ðh €Y‡_�_�WÓð !%Ø/3Ø"+×"DÑ"DØ/8×/QÑ/QØ(1×(LÑ(Lñ2
àð2
ð �u‰oð2
ð ˜' # s (Ñ+Ñ,ð	2
ð
  ð2
ð �u˜mÐ+Ñ,ð2
ð ! ™ð2
ð 
×	Ñ	ò2
ó ð2
ðh ñó ðô)r   r&   )!r   Ú
contextlibr   r�   r   Útypingr   r   r   r   Úgoogle.authr   r	   Úgoogle.auth.aior
   Úgoogle.auth.aio.credentialsr   Úgoogle.auth.aio.transportr   Úgoogle.auth.exceptionsr   Ú"google.auth.transport._mtls_helperr=   rC   r   rH   ÚAttributeErrorÚ!google.auth.aio.transport.aiohttpr   r/   r.   r$   r&   r�   r   r   ú<module>r›      s    ðó Ý *Û Û ß :Ó :ç 8Ý %Ý 3Ý *Ý /Û )áÛÞ%ðÛÝ)ð
ÝKàÐð
 ñ(ó ð(÷Vd)ò d)øðq ˜Ð(ò ØŠðûð ò ØÒðús$   Á
A7 ÁB Á7	BÂBÂBÂB