
    g              
          d 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	Z	 ddl
ZddlZddlZ	 ddlZdZdZd	 Zd
 Zd Zd Zej.                  j0                  eej.                  j2                  eej4                  j6                  eej4                  j8                  eej:                  j<                  j>                  eiZ er#ee ej:                  jB                  j>                  <   d Z"y# e$ rZ ed      edZ[ww xY w# e$ r dZY w xY w)zHelpers for transitioning from oauth2client to google-auth.

.. warning::
    This module is private as it is intended to assist first-party downstream
    clients with the transition from oauth2client to google-auth.
    )absolute_import)_helpersNzoauth2client is not installed.TFz8Unable to convert {} to a google-auth credentials class.c                     t         j                  j                  j                  | j                  | j
                  | j                  | j                  | j                  | j                        }| j                  |_        |S )aB  Converts to :class:`google.oauth2.credentials.Credentials`.

    Args:
        credentials (Union[oauth2client.client.OAuth2Credentials,
            oauth2client.client.GoogleCredentials]): The credentials to
            convert.

    Returns:
        google.oauth2.credentials.Credentials: The converted credentials.
    )tokenrefresh_token	token_uri	client_idclient_secretscopes)googleoauth2credentialsCredentialsaccess_tokenr   r   r	   r
   r   token_expiry_expires)r   new_credentialss     N/var/www/openai/venv/lib/python3.12/site-packages/google/auth/_oauth2client.py_convert_oauth2_credentialsr   0   so     mm//;;&&!//''''!//!! < O  +77O    c                     | j                   j                         }| j                  |d<   t        j                  j
                  j                  j                  |      S )au  Converts to :class:`google.oauth2.service_account.Credentials`.

    Args:
        credentials (Union[
            oauth2client.service_account.ServiceAccountCredentials,
            oauth2client.service_account._JWTAccessCredentials]): The
            credentials to convert.

    Returns:
        google.oauth2.service_account.Credentials: The converted credentials.
    r   )serialization_datacopyr   r   r   service_accountr   from_service_account_info)r   infos     r   $_convert_service_account_credentialsr   I   sI     ))..0D#--D==((44NNtTTr   c                 j    t         j                  j                  j                  | j                        S )a  Converts to :class:`google.auth.compute_engine.Credentials`.

    Args:
        credentials (oauth2client.contrib.gce.AppAssertionCredentials): The
            credentials to convert.

    Returns:
        google.oauth2.service_account.Credentials: The converted credentials.
    )service_account_email)r   authcompute_enginer   r   r   s    r   &_convert_gce_app_assertion_credentialsr#   Z   s/     ;;%%11)?? 2  r   c                     t         j                  j                  j                  t	        j
                  | j                        | j                        S )a  Converts to :class:`google.auth.app_engine.Credentials`.

    Args:
        credentials (oauth2client.contrib.app_engine.AppAssertionCredentials):
            The credentials to convert.

    Returns:
        google.oauth2.service_account.Credentials: The converted credentials.
    )r   service_account_id)r   r    
app_enginer   r   string_to_scopesscoper%   r"   s    r   ,_convert_appengine_app_assertion_credentialsr)   i   sC     ;;!!--(():):;&99 .  r   c                     t        |       }	 t        |   |       S # t        $ r&}t        t        j                  |            }||d}~ww xY w)a  Convert oauth2client credentials to google-auth credentials.

    This class converts:

    - :class:`oauth2client.client.OAuth2Credentials` to
      :class:`google.oauth2.credentials.Credentials`.
    - :class:`oauth2client.client.GoogleCredentials` to
      :class:`google.oauth2.credentials.Credentials`.
    - :class:`oauth2client.service_account.ServiceAccountCredentials` to
      :class:`google.oauth2.service_account.Credentials`.
    - :class:`oauth2client.service_account._JWTAccessCredentials` to
      :class:`google.oauth2.service_account.Credentials`.
    - :class:`oauth2client.contrib.gce.AppAssertionCredentials` to
      :class:`google.auth.compute_engine.Credentials`.
    - :class:`oauth2client.contrib.appengine.AppAssertionCredentials` to
      :class:`google.auth.app_engine.Credentials`.

    Returns:
        google.auth.credentials.Credentials: The converted credentials.

    Raises:
        ValueError: If the credentials could not be converted.
    N)type_CLASS_CONVERSION_MAPKeyError
ValueError_CONVERT_ERROR_TMPLformat)r   credentials_class
caught_excnew_excs       r   convertr4      sT    2 [)&$%67DD &0778IJK:%&s    	A
!AA
)#__doc__
__future__r   google.authr   google.auth.app_enginer   google.auth.compute_enginegoogle.oauth2.credentialsgoogle.oauth2.service_accountoauth2client.clientoauth2clientoauth2client.contrib.gceoauth2client.service_accountImportErrorr2   oauth2client.contrib.appengine_HAS_APPENGINEr/   r   r   r#   r)   clientOAuth2CredentialsGoogleCredentialsr   ServiceAccountCredentials_JWTAccessCredentialscontribgceAppAssertionCredentialsr,   	appenginer4    r   r   <module>rM      s(   '    !   $H#')N
 Q 2U"$ ))+F))+F  ::<`  668\446\   	5 &&>>
&M  H
6
7ZGH  Ns(   C$ C: $C7)	C22C7:DD