Ë
    µŒjE*  ã                   óP   — d Z ddlZddlmZ ddlmZ dZ	 dZ		 dZ
	  G d„ d	e«      Zy)
z=Client for interacting with the Google Cloud Translation API.é    N)ÚClient)Ú
ConnectionÚenÚbaseÚnmtc                   óT   ‡ — e Zd ZdZdZ	 eddddfˆ fd„	Zdd„Zd„ Z	 	 	 	 	 d	d„Z	ˆ xZ
S )
r   a³  Client to bundle configuration needed for API requests.

    :type target_language: str
    :param target_language: (Optional) The target language used for
                            translations and language names. (Defaults to
                            :data:`ENGLISH_ISO_639`.)

    :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.

    :type client_info: :class:`~google.api_core.client_info.ClientInfo`
    :param client_info:
        The client info used to send a user-agent string along with API
        requests. If ``None``, then default info will be used. Generally,
        you only need to set this if you're developing your own library
        or partner tool.
    :type client_options: :class:`~google.api_core.client_options.ClientOptions` or :class:`dict`
    :param client_options: (Optional) Client options used to set user options on the client.
        API Endpoint should be set through client_options.
    )z.https://www.googleapis.com/auth/cloud-platformNc                 ó  •— || _         t        t        | �  ||¬«       d|i}|rVt	        |t
        «      r)t        j                  j                  j                  |«      }|j                  r|j                  }||d<   t        | fi |¤Ž| _        y )N)ÚcredentialsÚ_httpÚclient_infoÚapi_endpoint)Útarget_languageÚsuperr   Ú__init__Ú
isinstanceÚdictÚgoogleÚapi_coreÚclient_optionsÚ	from_dictr   r   Ú_connection)	Úselfr   r
   r   r   r   Úkw_argsr   Ú	__class__s	           €új/var/www/html/Fitness-lenito-AI-main/venv/lib/python3.12/site-packages/google/cloud/translate_v2/client.pyr   zClient.__init__F   s‡   ø€ ð  /ˆÔÜŒf�dÑ$°ÀEÐ$ÔJà  +Ð.ˆÙÜ˜.¬$Ô/Ü!'§¡×!?Ñ!?×!IÑ!IØ"ó"�ð ×*Ò*Ø-×:Ñ:�Ø*6�˜Ñ'ä% dÑ6¨gÑ6ˆÕó    c                 ó°   — i }|€| j                   }|�||d<   | j                  j                  dd|¬«      }|j                  di «      j                  dd«      S )a  Get list of supported languages for translation.

        Response

        See
        https://cloud.google.com/translate/docs/discovering-supported-languages

        :type target_language: str
        :param target_language: (Optional) The language used to localize
                                returned language names. Defaults to the
                                target language on the current client.

        :rtype: list
        :returns: List of dictionaries. Each dictionary contains a supported
                  ISO 639-1 language code (using the dictionary key
                  ``language``). If ``target_language`` is passed, each
                  dictionary will also contain the name of each supported
                  language (localized to the target language).
        ÚtargetÚGETz
/languages)ÚmethodÚpathÚquery_paramsÚdataÚ	languages© )r   r   Úapi_requestÚget)r   r   r"   Úresponses       r   Úget_languageszClient.get_languages]   sl   € ð( ˆØÐ"Ø"×2Ñ2ˆOØÐ&Ø%4ˆL˜Ñ"Ø×#Ñ#×/Ñ/Ø˜|¸,ð 0ó 
ˆð �|‰|˜F BÓ'×+Ñ+¨K¸Ó<Ð<r   c                 óð  — d}t        |t        «      rd}|g}d|i}| j                  j                  dd|¬«      }|j	                  di «      j	                  dd	«      }t        |«      t        |«      k7  rt        d
||«      ‚t        |«      D ]a  \  }}t        ||   «      dk(  r||   d   ||<   n"dt        ||   «      fz  }t        ||||   «      ‚|||   d<   ||   j                  dd«       Œc |r|d   S |S )aÐ  Detect the language of a string or list of strings.

        See https://cloud.google.com/translate/docs/detecting-language

        :type values: str or list
        :param values: String or list of strings that will have
                       language detected.

        :rtype: dict or list
        :returns: A list of dictionaries for each queried value. Each
                  dictionary typically contains three keys

                  * ``confidence``: The confidence in language detection, a
                    float between 0 and 1.
                  * ``input``: The corresponding input value.
                  * ``language``: The detected language (as an ISO 639-1
                    language code).

                  though the key ``confidence`` may not always be present.

                  If only a single value is passed, then only a single
                  dictionary will be returned.
        :raises: :class:`ValueError <exceptions.ValueError>` if the number of
                 detections is not equal to the number of values.
                 :class:`ValueError <exceptions.ValueError>` if a value
                 produces a list of detections with 0 or multiple results
                 in it.
        FTÚqÚPOSTz/detect©r    r!   r#   r#   Ú
detectionsr%   z-Expected same number of values and detectionsé   r   z6Expected a single detection per value, API returned %dÚinputÚ
isReliableN)	r   Ústrr   r&   r'   ÚlenÚ
ValueErrorÚ	enumerateÚpop)	r   ÚvaluesÚsingle_valuer#   r(   r.   ÚindexÚvalueÚmessages	            r   Údetect_languagezClient.detect_language{   s6  € ð: ˆÜ�fœcÔ"ØˆLØ�XˆFà�Vˆ}ˆà×#Ñ#×/Ñ/Ø 	°ð 0ó 
ˆð —\‘\ &¨"Ó-×1Ñ1°,ÀÓCˆ
äˆv‹;œ#˜j›/Ò)ÜØ?ÀÈóð ô & fÖ-‰LˆE�5ô �:˜eÑ$Ó%¨Ò*Ø$.¨uÑ$5°aÑ$8�
˜5Ò!ð PÜ˜ EÑ*Ó+Ð-ñ.�ô ! ¨%°¸EÑ1BÓCÐCà).ˆJ�uÑ˜gÑ&à�uÑ×!Ñ! ,°Õ5ð .ñ  Ø˜a‘=Ð àÐr   c                 ó�  — d}t        |t        «      rd}|g}|€| j                  }t        |t        «      r|g}||||||dœ}| j                  j	                  dd|¬«      }	|	j                  di «      j                  dd	«      }
t        |«      t        |
«      k7  rt        d
||
«      ‚t        ||
«      D ]
  \  }}||d<   Œ |r|
d   S |
S )aõ  Translate a string or list of strings.

        See https://cloud.google.com/translate/docs/translating-text

        :type values: str or list
        :param values: String or list of strings to translate.

        :type target_language: str
        :param target_language: The language to translate results into. This
                                is required by the API and defaults to
                                the target language of the current instance.

        :type format_: str
        :param format_: (Optional) One of ``text`` or ``html``, to specify
                        if the input text is plain text or HTML.

        :type source_language: str
        :param source_language: (Optional) The language of the text to
                                be translated.

        :type customization_ids: str or list
        :param customization_ids: (Optional) ID or list of customization IDs
                                  for translation. Sets the ``cid`` parameter
                                  in the query.

        :type model: str
        :param model: (Optional) The model used to translate the text, such
                      as ``'base'`` or ``'nmt'``.

        :rtype: dict or list
        :returns: A list of dictionaries for each queried value. Each
                  dictionary typically contains three keys (though not
                  all will be present in all cases)

                  * ``detectedSourceLanguage``: The detected language (as an
                    ISO 639-1 language code) of the text.
                  * ``translatedText``: The translation of the text into the
                    target language.
                  * ``input``: The corresponding input value.
                  * ``model``: The model used to translate the text.

                  If only a single value is passed, then only a single
                  dictionary will be returned.
        :raises: :class:`~exceptions.ValueError` if the number of
                 values and translations differ.
        FT)r   r+   ÚcidÚformatÚsourceÚmodelr,   Ú r-   r#   Útranslationsr%   z'Expected iterations to have same lengthr0   r   )	r   r2   r   r   r&   r'   r3   r4   Úzip)r   r7   r   Úformat_Úsource_languageÚcustomization_idsrA   r8   r#   r(   rC   r:   Útranslations                r   Ú	translatezClient.translate¿   sø   € ðn ˆÜ�fœcÔ"ØˆLØ�XˆFàÐ"Ø"×2Ñ2ˆOÜÐ'¬Ô-Ø!2Ð 3Ðð &ØØ$ØØ%Øñ
ˆð ×#Ñ#×/Ñ/°vÀBÈTÐ/ÓRˆà—|‘| F¨BÓ/×3Ñ3°NÀBÓGˆÜˆv‹;œ#˜lÓ+Ò+ÜØ9¸6À<óð ô #& f¨lÖ";ÑˆE�;Ø#(ˆK˜Ò ð #<ñ Ø ‘?Ð"àÐr   )N)NNNr%   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚSCOPEÚENGLISH_ISO_639r   r)   r<   rI   Ú__classcell__)r   s   @r   r   r   !   sM   ø„ ñðB @€EØ1ð (ØØØØõ7ó.=ò<BðN ØØØØ÷W r   r   )rM   Úgoogle.api_core.client_optionsr   Úgoogle.cloud.clientr   Ú
BaseClientÚgoogle.cloud.translate_v2._httpr   rO   ÚBASEÚNMTr%   r   r   Ú<module>rW      s<   ðñ Dó &Ý 4å 6à€Ø *à€Ø à€Ø 'ôu ˆZõ u r   