§
    BP„j(  ã                   óü   — d dl Z d dlZd dlZd dlmZ d dlmZ  e j        e¦  «        Z	dZ
ej        fZ G d„ de¦  «        Zd„ Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zdddej        dfd„Z ej         e¦   «         ¦  «        ZdS )é    N)Úhttp_client)Ú_helpers)ÚreadÚseekÚtellc                   ó*   — e Zd ZdZd„ Zd„ Zd„ Zd„ ZdS )ÚMemoryCachez8httplib2 Cache implementation which only caches locally.c                 ó   — i | _         d S ©N©Úcache)Úselfs    ú[/root/disk_3tb/conda_envs/Huy-visual/lib/python3.11/site-packages/oauth2client/transport.pyÚ__init__zMemoryCache.__init__#   s   € ØˆŒ
ˆ
ˆ
ó    c                 ó6   — | j                              |¦  «        S r   )r   Úget©r   Úkeys     r   r   zMemoryCache.get&   s   € ØŒz�~Š~˜cÑ"Ô"Ð"r   c                 ó   — || j         |<   d S r   r   )r   r   Úvalues      r   ÚsetzMemoryCache.set)   s   € ØˆŒ
�3‰ˆˆr   c                 ó<   — | j                              |d ¦  «         d S r   )r   Úpopr   s     r   ÚdeletezMemoryCache.delete,   s   € ØŒ
�Š�s˜DÑ!Ô!Ð!Ð!Ð!r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   © r   r   r	   r	       sV   € € € € € ØBÐBðð ð ð#ð #ð #ð ð  ð  ð"ð "ð "ð "ð "r   r	   c                  ó   — t           S )a  Return an HTTP object which caches results returned.

    This is intended to be used in methods like
    oauth2client.client.verify_id_token(), which calls to the same URI
    to retrieve certs.

    Returns:
        httplib2.Http, an HTTP object with a MemoryCache
    )Ú_CACHED_HTTPr    r   r   Úget_cached_httpr#   0   s
   € õ Ðr   c                  ó$   — t          j        | i |¤ŽS )a>  Return a new HTTP object.

    Args:
        *args: tuple, The positional arguments to be passed when
               contructing a new HTTP object.
        **kwargs: dict, The keyword arguments to be passed when
                  contructing a new HTTP object.

    Returns:
        httplib2.Http, an HTTP object.
    )Úhttplib2ÚHttp)ÚargsÚkwargss     r   Úget_http_objectr)   =   s   € õ Œ=˜$Ð) &Ð)Ð)Ð)r   c                 ó(   — | €i nt          | ¦  «        S )zÃCreates a copy of the headers.

    Args:
        headers: dict, request headers to copy.

    Returns:
        dict, the copied headers or a new dictionary if the headers
        were None.
    )Údict)Úheaderss    r   Ú_initialize_headersr-   L   s   € ð �ˆ2ˆ2¥d¨7¡m¤mÐ3r   c                 ó@   — |�d| v r|dz   | d         z   | d<   n|| d<   | S )a,  Adds a user-agent to the headers.

    Args:
        headers: dict, request headers to add / modify user
                 agent within.
        user_agent: str, the user agent to add.

    Returns:
        dict, the original headers passed in, but modified if the
        user agent is not None.
    Nz
user-agentú r    )r,   Ú
user_agents     r   Ú_apply_user_agentr1   Y   s@   € ð ÐØ˜7Ð"Ð"Ø%/°#Ñ%5¸ÀÔ8MÑ%MˆG�LÑ!Ð!à$.ˆG�LÑ!à€Nr   c                 óz  — i }	 t          j        | ¦  «        D ]€\  }}t          |t           j        ¦  «        st	          |¦  «        }t          |t           j        ¦  «        st	          |¦  «        }t          j        |¦  «        |t          j        |¦  «        <   Œ�n!# t          $ r ddlm	}  ||d|¦  «        ‚w xY w|S )a½  Forces header keys and values to be strings, i.e not unicode.

    The httplib module just concats the header keys and values in a way that
    may make the message header a unicode string, which, if it then tries to
    contatenate to a binary request body may result in a unicode decode error.

    Args:
        headers: dict, A dictionary of headers.

    Returns:
        The same dictionary but with all the keys converted to strings.
    r   )ÚNonAsciiHeaderErrorz: )
ÚsixÚ	iteritemsÚ
isinstanceÚbinary_typeÚstrr   Ú	_to_bytesÚUnicodeEncodeErrorÚoauth2client.clientr3   )r,   ÚcleanÚkÚvr3   s        r   Úclean_headersr?   n   sß   € ð €Eð	.Ý”M 'Ñ*Ô*ð 	Að 	A‰DˆAˆqÝ˜a¥¤Ñ1Ô1ð Ý˜‘F”F�Ý˜a¥¤Ñ1Ô1ð Ý˜‘F”F�Ý+3Ô+=¸aÑ+@Ô+@ˆE•(Ô$ QÑ'Ô'Ñ(Ð(ð	Aøõ ð .ð .ð .Ø;Ð;Ð;Ð;Ð;Ð;Ø!Ð! ! T¨1Ñ-Ô-Ð-ð.øøøð €Ls   „BB ÂB8c                 ój   ‡ ‡— |j         Šdddt          j        dfˆ ˆfd„	}||_         ‰ |j         _        dS )aÝ  Prepares an HTTP object's request method for auth.

    Wraps HTTP requests with logic to catch auth failures (typically
    identified via a 401 status code). In the event of failure, tries
    to refresh the token used and then retry the original request.

    Args:
        credentials: Credentials, the credentials used to identify
                     the authenticated user.
        http: httplib2.Http, an http object to be used to make
              auth requests.
    ÚGETNc           
      ó   •‡— ‰j         s/t                               d¦  «         ‰                     ‰¦  «         t	          |¦  «        }‰                     |¦  «         t          |‰j        ¦  «         d }t          ˆfd„t          D ¦   «         ¦  «        r‰ 
                    ¦   «         }t          ‰| |‰t          |¦  «        ||¦  «        \  }}d}	t          |	¦  «        D ]�}
|j        t          vr nŒt                               d|j        |
dz   |	¦  «         ‰                     ‰¦  «         ‰                     |¦  «         |�‰                     |¦  «         t          ‰| |‰t          |¦  «        ||¦  «        \  }}Œž||fS )Nz1Attempting refresh to obtain initial access_tokenc              3   ó:   •K  — | ]}t          ‰|d ¦  «        V — Œd S r   ©Úgetattr)Ú.0Ústream_propÚbodys     €r   ú	<genexpr>z:wrap_http_for_auth.<locals>.new_request.<locals>.<genexpr>©   s?   øè è € ð #ð #°K�w�t˜[¨$Ñ/Ô/ð #ð #ð #ð #ð #ð #r   é   z&Refreshing due to a %s (attempt %s/%s)é   )Úaccess_tokenÚ_LOGGERÚinfoÚ_refreshr-   Úapplyr1   r0   ÚallÚ_STREAM_PROPERTIESr   Úrequestr?   ÚrangeÚstatusÚREFRESH_STATUS_CODESr   )ÚuriÚmethodrH   r,   ÚredirectionsÚconnection_typeÚbody_stream_positionÚrespÚcontentÚmax_refresh_attemptsÚrefresh_attemptÚcredentialsÚorig_request_methods     `        €€r   Únew_requestz'wrap_http_for_auth.<locals>.new_request™   sÌ  øø€ ð Ô'ð 	6Ý�LŠLð 0ñ 1ô 1ð 1à× Ò Ð!4Ñ5Ô5Ð5õ & gÑ.Ô.ˆØ×Ò˜'Ñ"Ô"Ð"Ý˜' ;Ô#9Ñ:Ô:Ð:à#Ðåð #ð #ð #ð #Ý!ð#ñ #ô #ñ #ô #ð 	/à#'§9¢9¡;¤;Ð åÐ 3°S¸&À$Ý -¨gÑ 6Ô 6Ø ,¨oñ?ô ?‰ˆˆgð  !ÐÝ$Ð%9Ñ:Ô:ð 	Cð 	CˆOØŒ{Õ"6Ð6Ð6Ø�Ý�LŠLÐAØœ o¸Ñ&9Ø-ñ/ô /ð /ð × Ò Ð!4Ñ5Ô5Ð5Ø×Ò˜gÑ&Ô&Ð&Ø#Ð/Ø—	’	Ð.Ñ/Ô/Ð/å#Ð$7¸¸fÀdÝ$1°'Ñ$:Ô$:Ø$0°/ñCô C‰MˆD�'�'ð �Wˆ}Ðr   )rS   r%   ÚDEFAULT_MAX_REDIRECTSr`   )r`   Úhttprb   ra   s   `  @r   Úwrap_http_for_authre   ‰   s_   øø€ ð œ,Ðð !&¨D¸$Ý!)Ô!?Ø$(ð*ð *ð *ð *ð *ð *ð *ðZ €D„Lð  +€D„LÔÐÐr   c                 óœ   ‡ ‡‡— |j         Št          ‰ |¦  «         |j         Šdddt          j        dfˆˆ ˆfd„	}||_         ‰ |j         _        dS )a  Prepares an HTTP object's request method for JWT access.

    Wraps HTTP requests with logic to catch auth failures (typically
    identified via a 401 status code). In the event of failure, tries
    to refresh the token used and then retry the original request.

    Args:
        credentials: _JWTAccessCredentials, the credentials used to identify
                     a service account that uses JWT access tokens.
        http: httplib2.Http, an http object to be used to make
              auth requests.
    rA   Nc           	      óŽ  •— d‰
j         v r8‰
j        �‰
j        r‰
                     d ¦  «         t	          ‰	| |||||¦  «        S t          |¦  «        }t          |‰
j        ¦  «         |                      dd¦  «        d         }‰
 	                    d|i¦  «        \  }}d|z   |d<   t	          ‰| ||t          |¦  «        ||¦  «        S )NÚaudú?rK   r   zBearer ÚAuthorization)Ú_kwargsrL   Úaccess_token_expiredÚrefreshrS   r-   r1   r0   ÚsplitÚ_create_tokenr?   )rW   rX   rH   r,   rY   rZ   Úuri_rootÚtokenÚunused_expiryÚauthenticated_request_methodr`   ra   s            €€€r   rb   z-wrap_http_for_jwt_access.<locals>.new_requestß   sï   ø€ ð �KÔ'Ð'Ð'àÔ(Ð0ØÔ4ð 1à×#Ò# DÑ)Ô)Ð)ÝÐ7¸Ø! 4¨°,Ø*ñ,ô ,ð ,õ *¨'Ñ2Ô2ˆGÝ˜g {Ô'=Ñ>Ô>Ð>Ø—y’y  aÑ(Ô(¨Ô+ˆHØ#.×#<Ò#<¸eÀXÐ=NÑ#OÔ#OÑ ˆE�=à'0°5Ñ'8ˆG�OÑ$ÝÐ.°°V¸TÝ(¨Ñ1Ô1Ø'¨ñ:ô :ð :r   )rS   re   r%   rc   r`   )r`   rd   rb   rs   ra   s   `  @@r   Úwrap_http_for_jwt_accessrt   Ì   s|   øøø€ ð œ,ÐÝ�{ DÑ)Ô)Ð)à#'¤<Ð ð !&¨D¸$Ý!)Ô!?Ø$(ð:ð :ð :ð :ð :ð :ð :ð :ð2 €D„Lð  +€D„LÔÐÐr   rA   c                 óF   — t          | d| ¦  «        } |||||||¬¦  «        S )aÌ  Make an HTTP request with an HTTP object and arguments.

    Args:
        http: httplib2.Http, an http object to be used to make requests.
        uri: string, The URI to be requested.
        method: string, The HTTP method to use for the request. Defaults
                to 'GET'.
        body: string, The payload / body in HTTP request. By default
              there is no payload.
        headers: dict, Key-value pairs of request headers. By default
                 there are no headers.
        redirections: int, The number of allowed 203 redirects for
                      the request. Defaults to 5.
        connection_type: httplib.HTTPConnection, a subclass to be used for
                         establishing connection. If not set, the type
                         will be determined from the ``uri``.

    Returns:
        tuple, a pair of a httplib2.Response with the status code and other
        headers and the bytes of the content returned.
    rS   )rX   rH   r,   rY   rZ   rD   )rd   rW   rX   rH   r,   rY   rZ   Úhttp_callables           r   rS   rS   þ   s<   € õ2 ˜D )¨TÑ2Ô2€MØˆ=˜ V°$ÀØ&2Ø)8ð:ñ :ô :ð :r   )Úloggingr%   r4   Ú	six.movesr   Úoauth2clientr   Ú	getLoggerr   rM   rR   ÚUNAUTHORIZEDrV   Úobjectr	   r#   r)   r-   r1   r?   re   rt   rc   rS   r&   r"   r    r   r   ú<module>r}      sI  ðð €€€à €€€Ø 
€
€
€
Ø !Ð !Ð !Ð !Ð !Ð !à !Ð !Ð !Ð !Ð !Ð !ð ˆ'Ô
˜HÑ
%Ô
%€à-Ð ð $Ô0Ð2Ð ð"ð "ð "ð "ð "�&ñ "ô "ð "ð 
ð 
ð 
ð*ð *ð *ð
4ð 
4ð 
4ðð ð ð*ð ð ð6@+ð @+ð @+ðF/+ð /+ð /+ðd $¨$¸Ø!Ô7Ø ð:ð :ð :ð :ð> ˆxŒ}˜[˜[™]œ]Ñ+Ô+€€€r   