Ë
    ´Œj53  ã                   ó  — d Z ddlZddlZddlZddlmZ ddlmZ ddlmZ ddl	Z
ddlZ
ddlZ
ddlmZ ddlZ
ddlZ
ddlmZ ddlmZ 	 ddlZ
d	ZdZdZ G d„ de«      Z G d„ de«      Z G d„ de«      Z G d„ dee«      Zy# e$ r d
ZY Œ;w xY w)z@Base classes for client used to interact with Google Cloud APIs.é    N)ÚPicklingError)ÚTuple)ÚUnion)Úenvironment_vars©Ú_determine_default_project)Úservice_accountTFz§This library only supports credentials from google-auth-library-python. See https://google-auth.readthedocs.io/en/latest/ for help on authentication with this library.i,  c                   ó4   — e Zd ZdZdZed„ «       Zed„ «       Zy)Ú_ClientFactoryMixinzeMixin to allow factories that create credentials.

    .. note::

        This class is virtual.
    Fc                 óÀ   — d|v rt        d«      ‚t        j                  j                  |«      }| j                  rd|vr|j                  d«      |d<   ||d<    | |i |¤ŽS )a¥  Factory to retrieve JSON credentials while creating client.

        :type info: dict
        :param info:
            The JSON object with a private key and other credentials
            information (downloaded from the Google APIs console).

        :type args: tuple
        :param args: Remaining positional arguments to pass to constructor.

        :param kwargs: Remaining keyword arguments to pass to constructor.

        :rtype: :class:`_ClientFactoryMixin`
        :returns: The client created with the retrieved JSON credentials.
        :raises TypeError: if there is a conflict with the kwargs
                 and the credentials created by the factory.
        Úcredentialsz,credentials must not be in keyword argumentsÚprojectÚ
project_id)Ú	TypeErrorr	   ÚCredentialsÚfrom_service_account_infoÚ_SET_PROJECTÚget)ÚclsÚinfoÚargsÚkwargsr   s        úf/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/google/cloud/client/__init__.pyr   z-_ClientFactoryMixin.from_service_account_info>   sl   € ð& ˜FÑ"ÜÐJÓKÐKä%×1Ñ1×KÑKÈDÓQˆØ×ÒØ Ñ&Ø$(§H¡H¨\Ó$:��yÑ!à +ˆˆ}ÑÙ�DÐ#˜FÑ#Ð#ó    c                 ó²   — t        j                  |dd¬«      5 }t        j                  |«      }ddd«        | j                  g|¢­i |¤ŽS # 1 sw Y   ŒxY w)aã  Factory to retrieve JSON credentials while creating client.

        :type json_credentials_path: str
        :param json_credentials_path: The path to a private key file (this file
                                      was given to you when you created the
                                      service account). This file must contain
                                      a JSON object with a private key and
                                      other credentials information (downloaded
                                      from the Google APIs console).

        :type args: tuple
        :param args: Remaining positional arguments to pass to constructor.

        :param kwargs: Remaining keyword arguments to pass to constructor.

        :rtype: :class:`_ClientFactoryMixin`
        :returns: The client created with the retrieved JSON credentials.
        :raises TypeError: if there is a conflict with the kwargs
                 and the credentials created by the factory.
        Úrúutf-8)ÚencodingN)ÚioÚopenÚjsonÚloadr   )r   Újson_credentials_pathr   r   Újson_fiÚcredentials_infos         r   Úfrom_service_account_jsonz-_ClientFactoryMixin.from_service_account_json\   sV   € ô, �W‰WÐ*¨C¸'ÕBÀgÜ#Ÿy™y¨Ó1Ð÷ Cð -ˆs×,Ñ,Ð-=ÐOÀÒOÈÑOÐO÷ CÐBús   ™AÁAN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úclassmethodr   r&   © r   r   r   r   4   s6   „ ñð €Làñ$ó ð$ð: ñPó ñPr   r   c                   óZ   — e Zd ZU dZdZeeedf   df   ed<   	 d	d„Z	d„ Z
ed„ «       Zd„ Zy)
ÚClientaï  Client to bundle configuration needed for API requests.

    Stores ``credentials`` and an HTTP object so that subclasses
    can pass them along to a connection class.

    If no value is passed in for ``_http``, a :class:`requests.Session` object
    will be created and authorized with the ``credentials``. If not, the
    ``credentials`` and ``_http`` need not be related.

    Callers and subclasses may seek to use the private key from
    ``credentials`` to sign data.

    Args:
        credentials (google.auth.credentials.Credentials):
            (Optional) The OAuth2 Credentials to use for this client. If not
            passed (and if no ``_http`` object is passed), falls back to the
            default inferred from the environment.
        client_options (google.api_core.client_options.ClientOptions):
            (Optional) Custom options for the client.
        _http (requests.Session):
            (Optional) HTTP object to make requests. Can be any object that
            defines ``request()`` with the same interface as
            :meth:`requests.Session.request`. If not passed, an ``_http``
            object is created that is bound to the ``credentials`` for the
            current object.
            This parameter should be considered private, and could change in
            the future.

    Raises:
        google.auth.exceptions.DefaultCredentialsError:
            Raised if ``credentials`` is not specified and the library fails
            to acquire default credentials.
    N.ÚSCOPEc                 óÈ  — t        |t        «      r)t        j                  j                  j                  |«      }|€(t        j                  j                  j                  «       }|r5|j                  r)t        j                  j                  j                  d«      ‚t        rC|j                  r7|s|j                  r)t        j                  j                  j                  d«      ‚|r=t        |t        j                  j                  j                  «      st        t         «      ‚|j"                  xs | j$                  }|s¦|€¤|j                  r/t        j                  j'                  |j                  |¬«      \  }}nit        r@|j                  �4t        j                  j                  j                  |j                  «      }n#t        j                  j)                  |¬«      \  }}t        j                  j                  j+                  ||¬«      | _        |j.                  r*| j,                  j1                  |j.                  «      | _        || _        |j4                  | _        y )NzK'credentials' and 'client_options.credentials_file' are mutually exclusive.zh'client_options.api_key' is mutually exclusive with 'credentials' and 'client_options.credentials_file'.)Úscopes)Ú
isinstanceÚdictÚgoogleÚapi_coreÚclient_optionsÚ	from_dictÚClientOptionsÚcredentials_fileÚ
exceptionsÚDuplicateCredentialArgsÚHAS_GOOGLE_AUTH_API_KEYÚapi_keyÚauthr   r   Ú
ValueErrorÚ_GOOGLE_AUTH_CREDENTIALS_HELPr1   r/   Úload_credentials_from_fileÚdefaultÚwith_scopes_if_requiredÚ_credentialsÚquota_project_idÚwith_quota_projectÚ_http_internalÚclient_cert_sourceÚ_client_cert_source)Úselfr   Ú_httpr6   r1   Ú_s         r   Ú__init__zClient.__init__¡   sß  € Ü�n¤dÔ+Ü#Ÿ_™_×;Ñ;×EÑEÀnÓUˆNØÐ!Ü#Ÿ_™_×;Ñ;×IÑIÓKˆNá˜>×:Ò:Ü—/‘/×,Ñ,×DÑDØ]óð õ
 $Ø×&Ò&Ù × ?Ò ?ä—/‘/×,Ñ,×DÑDØzóð ñ œzØœŸ™×0Ñ0×<Ñ<ô 
ô Ô:Ó;Ð;à×&Ñ&Ò4¨$¯*©*ˆñ ˜Ð,Ø×.Ò.Ü!'§¡×!GÑ!GØ"×3Ñ3¸Fð "Hó "‘�™Qõ )¨^×-CÑ-CÐ-OÜ$Ÿk™k×1Ñ1×=Ñ=¸n×>TÑ>TÓU‘ä!'§¡×!4Ñ!4¸FÐ!4Ó!C‘�˜Qä"ŸK™K×3Ñ3×KÑKØ ð Ló 
ˆÔð ×*Ò*Ø $× 1Ñ 1× DÑ DØ×/Ñ/ó!ˆDÔð $ˆÔØ#1×#DÑ#DˆÕ r   c                 ó:   — t        dj                  ddg«      «      ‚)z1Explicitly state that clients are not pickleable.Ú
z4Pickling client objects is explicitly not supported.z>Clients have non-trivial state that is local and unpickleable.)r   Újoin©rJ   s    r   Ú__getstate__zClient.__getstate__Ó   s&   € äØ�I‰IàJØTðóó
ð 	
r   c                 ó  — | j                   €mt        j                  j                  j                  j                  | j                  t        ¬«      | _         | j                   j                  | j                  «       | j                   S )z�Getter for object used for HTTP transport.

        :rtype: :class:`~requests.Session`
        :returns: An HTTP object.
        )Úrefresh_timeout)
rG   r4   r>   Ú	transportÚrequestsÚAuthorizedSessionrD   Ú_CREDENTIALS_REFRESH_TIMEOUTÚconfigure_mtls_channelrI   rQ   s    r   rK   zClient._httpÞ   sm   € ð ×ÑÐ&Ü"(§+¡+×"7Ñ"7×"@Ñ"@×"RÑ"RØ×!Ñ!Ü <ð #Só #ˆDÔð ×Ñ×6Ñ6°t×7OÑ7OÔPØ×"Ñ"Ð"r   c                 óR   — | j                   �| j                   j                  «        yy)zâClean up transport, if set.

        Suggested use:

        .. code-block:: python

           import contextlib

           with contextlib.closing(client):  # closes on exit
               do_something_with(client)
        N)rG   ÚcloserQ   s    r   r[   zClient.closeí   s'   € ð ×ÑÐ*Ø×Ñ×%Ñ%Õ'ð +r   )NNN)r'   r(   r)   r*   r/   r   r   ÚstrÚ__annotations__rM   rR   ÚpropertyrK   r[   r,   r   r   r.   r.   x   sP   … ñ ðD +/€Eˆ5��s˜C�x‘ $Ð&Ñ'Ó.ðó
0Eòd	
ð ñ#ó ð#ó(r   r.   c                   ó(   — e Zd ZdZdd„Zed„ «       Zy)Ú_ClientProjectMixinai  Mixin to allow setting the project on the client.

    :type project: str
    :param project:
        (Optional) the project which the client acts on behalf of. If not
        passed, falls back to the default inferred from the environment.

    :type credentials: :class:`google.auth.credentials.Credentials`
    :param credentials:
        (Optional) credentials used to discover a project, if not passed.

    :raises: :class:`EnvironmentError` if the project is neither passed in nor
             set on the credentials or in the environment. :class:`ValueError`
             if the project value is invalid.
    Nc                 óz  — |€Et        j                  t        j                  t        j                  t        j                  «      «      }|€|�t        |dd «      }|€| j                  |«      }|€t        d«      ‚t        |t        «      r|j                  d«      }t        |t        «      st        d«      ‚|| _        y )Nr   zHProject was not passed and could not be determined from the environment.r   zProject must be a string.)ÚosÚgetenvr   ÚPROJECTÚLEGACY_PROJECTÚgetattrÚ_determine_defaultÚEnvironmentErrorr2   ÚbytesÚdecoder\   r?   r   )rJ   r   r   s      r   rM   z_ClientProjectMixin.__init__  s°   € ð
 ˆ?Ü—i‘iÜ ×(Ñ(Ü—	‘	Ô*×9Ñ9Ó:óˆGð ˆ?˜{Ð6Ü˜k¨<¸Ó>ˆGàˆ?Ø×-Ñ-¨gÓ6ˆGàˆ?Ü"ð3óð ô
 �gœuÔ%Ø—n‘n WÓ-ˆGä˜'¤3Ô'ÜÐ8Ó9Ð9àˆ�r   c                 ó   — t        | «      S )z'Helper:  use default project detection.r   )r   s    r   rg   z&_ClientProjectMixin._determine_default/  s   € ô *¨'Ó2Ð2r   )NN)r'   r(   r)   r*   rM   Ústaticmethodrg   r,   r   r   r`   r`   ý   s!   „ ñó ðB ñ3ó ñ3r   r`   c                   ó   — e Zd ZdZdZdd„Zy)ÚClientWithProjecta§  Client that also stores a project.

    :type project: str
    :param project: the project which the client acts on behalf of. If not
                    passed falls back to the default inferred from the
                    environment.

    :type credentials: :class:`~google.auth.credentials.Credentials`
    :param credentials: (Optional) The OAuth2 Credentials to use for this
                        client. If not passed (and if no ``_http`` object is
                        passed), falls back to the default inferred from the
                        environment.

    :type _http: :class:`~requests.Session`
    :param _http: (Optional) HTTP object to make requests. Can be any object
                  that defines ``request()`` with the same interface as
                  :meth:`~requests.Session.request`. If not passed, an
                  ``_http`` object is created that is bound to the
                  ``credentials`` for the current object.
                  This parameter should be considered private, and could
                  change in the future.

    :raises: :class:`ValueError` if the project is neither passed in nor
             set in the environment.
    TNc                 óf   — t         j                  | ||¬«       t        j                  | |||¬«       y )N)r   r   )r   r6   rK   )r`   rM   r.   )rJ   r   r   r6   rK   s        r   rM   zClientWithProject.__init__R  s2   € Ü×$Ñ$ T°7ÈÐ$ÔTÜ�‰Ø˜k¸.ÐPUð 	õ 	
r   )NNNN)r'   r(   r)   r*   r   rM   r,   r   r   rn   rn   5  s   „ ñð4 €Lô
r   rn   )r*   r   r!   rb   Úpickler   Útypingr   r   Úgoogle.api_core.client_optionsr4   Úgoogle.api_core.exceptionsÚgoogle.authr   Úgoogle.auth.credentialsÚgoogle.auth.transport.requestsÚgoogle.cloud._helpersr   Úgoogle.oauth2r	   Úgoogle.auth.api_keyr<   ÚImportErrorr@   rX   Úobjectr   r.   r`   rn   r,   r   r   Ú<module>r|      sª   ðñ Gã 	Û Û 	Ý  Ý Ý ã %Û !Û Ý (Û Û %Ý <Ý )ð$Ûà"Ðð4ð ð  #Ð ôAP˜&ô APôHB(Ð ô B(ôJ53˜&ô 53ôp!
˜Ð 3õ !
øða ò $Ø#Òð$ús   ÁB  Â B
Â	B
