Ë
    ³Œjâa  ã                   ó.  — 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
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     €€úl/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/google/auth/aio/transport/sessions.pyÚ_remaining_timez&timeout_guard.<locals>._remaining_timeD   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_timeoutM   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$   2   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.

        This method configures mTLS if client certificates are explicitly enabled
        (via GOOGLE_API_USE_CLIENT_CERTIFICATE=true) or auto-enabled (when the env
        variable is unset and workload certificates are discovered). In these cases,
        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               “   ó8  •K  — t        j                  t        j                  j                  j
                  j                  «      ƒ d {  –—† } | sy 	 t        j                  ‰
«      ƒ d {  –—† \  }}}|rÌt        rªt        ‰j                  t        «      r�t        j                  t         j                  ||«      ƒ d {  –—† }t        j                  |¬«      }t        j                  |¬«      }‰j                  }t        |¬«      ‰_
        	 |j!                  «       ƒ d {  –—†  nd}t%        j&                  dt(        «       |‰_        |r|‰_        y d ‰_        y 7 �Œ7 Œò7 Œ¡7 ŒA# t"        $ r Y Œ-w xY w# t"        $ r}t/        j0                  |«      }	|	|‚d }~ww xY w­w)N)Ússl)Ú	connector)ÚsessionFa9  Attempted to establish mTLS, but a custom async transport was provided. google-auth cannot automatically configure custom transports for mTLS. Falling back to standard TLS. If your custom transport is not manually configured for mTLS, you may encounter 401 Unauthorized errors when using Certificate-Bound Tokens.)r   Ú_run_in_executorÚgoogleÚauthr
   Ú_mtls_helperÚcheck_use_client_certÚget_client_cert_and_keyr.   r*   r4   r/   Úmake_client_cert_ssl_contextÚaiohttpÚTCPConnectorÚClientSessionÚcloseÚ	ExceptionÚwarningsÚwarnÚUserWarningr0   r2   r	   ÚMutualTLSChannelError)Úuse_client_certÚis_mtlsÚ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³   s�  øè ø€ ä(,×(=Ñ(=Ü—K‘K×)Ñ)×6Ñ6×LÑLó)÷ #�ñ 'Øð-2ô
 #×:Ñ:Ð;OÓP×Pñ	ØØØñ å,´Ø ×.Ñ.´ô2ô 15×0EÑ0EÜ $× AÑ AÀ4Èó1÷ +˜Kô )0×(<Ñ(<ÀÔ(M˜IÜ*1×*?Ñ*?È)Ô*T˜Kà/3×/AÑ/AÐ,Ü1?ÈÔ1T˜DÔ.ð%Ø&6×&<Ñ&<Ó&>× >Ñ >ð
 ',˜GÜ$ŸM™Mð!Bô
 !,ôð %,�D”MÙØ,0˜Õ)à,0˜Õ)ð_#ùð Qøð+øð !?ùÜ#,ò %á $ð%ûô( !ò 2Ü(×>Ñ>¸zÓJ�GØ! zÐ1ûð2üsž   ƒAFÁEÁ	FÁE1 Á)EÁ*AE1 Â<EÂ=AE1 ÄE" ÄE ÄE" Ä#-E1 ÅFÅE1 ÅFÅE1 ÅE1 Å E" Å"	E.Å+E1 Å-E.Å.E1 Å1	FÅ:FÆFÆF)r1   r   Úcreate_task)r5   rU   rV   s   `` r   Úconfigure_mtls_channelz-AsyncAuthorizedSession.configure_mtls_channel˜   sD   ùè ø€ ð2 ×ÑÐ'õ52ôn $+×#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   rG   r   ÚAsyncExponentialBackoffr$   r-   Úbefore_requestr4   r   r*   ÚtotalÚintÚfloatÚstatus_coder
   ÚDEFAULT_RETRYABLE_STATUS_CODES)r5   rY   rZ   r[   r\   r]   r#   r^   ÚkwargsÚretriesr"   Úactual_timeoutÚ_r    s                 r   ÚrequestzAsyncAuthorizedSession.requestî   s€  è ø€ ðV ×ÒðØ×*Ñ*×*Ð*ô
 '×>Ñ>Ø)ô
ˆð ˆ?ØˆGÜ Ð!1×2Ô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Ø÷+ 3×2ð, ˆðA +úÜò ò ðúð 3ùðøðøðøð #øð 3ø×2×2Ð2ð, ˆü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©rl   ©r5   rZ   r[   r\   r]   r#   r^   rh   s           r   ÚgetzAsyncAuthorizedSession.get=  óE   è ø€ ðT "�T—\‘\ØØØØØØØñ	
ð ñ	
÷ 	
ð 		
ð 	
úó   ‚&Ÿ$ &c           	   ‹   óP   K  —  | j                   d||||||fi |¤Žƒ d{  –—† S 7 Œ­w)rn   ÚPOSTNrp   rq   s           r   ÚpostzAsyncAuthorizedSession.postr  sE   è ø€ ðT "�T—\‘\ØØØØØØØñ	
ð ñ	
÷ 	
ð 		
ð 	
úrt   c           	   ‹   óP   K  —  | j                   d||||||fi |¤Žƒ d{  –—† S 7 Œ­w)rn   ÚPUTNrp   rq   s           r   ÚputzAsyncAuthorizedSession.put§  rs   rt   c           	   ‹   óP   K  —  | j                   d||||||fi |¤Žƒ d{  –—† S 7 Œ­w)rn   ÚPATCHNrp   rq   s           r   ÚpatchzAsyncAuthorizedSession.patchÜ  sE   è ø€ ðT "�T—\‘\ØØØØØØØñ	
ð ñ	
÷ 	
ð 		
ð 	
úrt   c           	   ‹   óP   K  —  | j                   d||||||fi |¤Žƒ d{  –—† S 7 Œ­w)rn   ÚDELETENrp   rq   s           r   ÚdeletezAsyncAuthorizedSession.delete  sE   è ø€ ðT "�T—\‘\ØØØØØØØñ	
ð ñ	
÷ 	
ð 		
ð 	
úrt   c                 ó   — | j                   S )z#Indicates if mutual TLS is enabled.)r0   ©r5   s    r   rM   zAsyncAuthorizedSession.is_mtlsF  s   € ð �}‰}Ðr   c              ƒ   ó4  K  — | j                   rI| j                   j                  «       s/| j                   j                  «        	 | j                   ƒ d{  –—†  | j
                  j                  «       ƒ d{  –—†  y7 Œ'# t        j                  $ r Y Œ:w xY w7 Œ ­w)z<
        Close the underlying auth request session.
        N)r1   ÚdoneÚcancelr   ÚCancelledErrorr4   rF   r‚   s    r   rF   zAsyncAuthorizedSession.closeK  s‚   è ø€ ð ×Ò¨×(<Ñ(<×(AÑ(AÔ(CØ× Ñ ×'Ñ'Ô)ðØ×*Ñ*×*Ð*ð × Ñ ×&Ñ&Ó(×(Ñ(ð +ùÜ×)Ñ)ò Ùðúà(úsH   ‚ABÁA= ÁA;ÁA= ÁBÁ5BÁ6BÁ;A= Á=BÂBÂBÂB)N)r_   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r
   r   r6   rX   Ú_DEFAULT_TIMEOUT_SECONDSÚDEFAULT_MAX_RETRY_ATTEMPTSÚstrÚbytesr   re   r   r   rd   ÚResponserl   Ú	functoolsÚwrapsrr   rw   rz   r}   r€   ÚpropertyrM   rF   © r   r   r&   r&   ^   sV  „ ñ#ðL UYñ+Ø&ð+Ø6>¸y×?PÑ?PÑ6Qó+ó(T*ðt !%Ø/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   rH   Úgoogle.authr   r	   Úgoogle.auth.aior
   Úgoogle.auth.aio.credentialsr   Úgoogle.auth.aio.transportr   Úgoogle.auth.exceptionsr   Ú"google.auth.transport._mtls_helperr=   rC   r   ÚImportErrorÚAttributeErrorÚ!google.auth.aio.transport.aiohttpr   r/   r.   r$   r&   r“   r   r   Ú<module>rŸ      s£   ðó Ý *Û Û ß :Ó :Û ç 8Ý %Ý 3Ý *Ý /Û )áÛÞ%ðÛÝ)ðÝKàÐð
 ñ(ó ð(÷Vw)ò w)øðs ˜Ð(ò ØŠðûð ò ØÒðús$   Á
A; Á B
 Á;	BÂBÂ
BÂB