§
    8?Äj3  ã                   ó�   — d dl Z d dlZd dlZd dlmc mZ  ej        e¦  «        Z	 G d„ d¦  «        Z
 G d„ dej        ¦  «        ZdS )é    Nc                   ó0   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ ZdS )ÚRefreshThreadManagerzD
    Organizes exactly one background job that refresh a token.
    c                 óD   — d| _         t          j        ¦   «         | _        dS )zInitializes the manager.N)Ú_workerÚ	threadingÚLockÚ_lock©Úselfs    úLC:\Projects\Historical\venv\Lib\site-packages\google/auth/_refresh_worker.pyÚ__init__zRefreshThreadManager.__init__   s   € ð ˆŒÝ”^Ñ%Ô%ˆŒ
ˆ
ˆ
ó    c                 óx  — |�|€t          j        d¦  «        ‚| j        5  | j        �| j        j        �	 ddd¦  «         dS | j        �| j                             ¦   «         sAt          |t          j        |¦  «        ¬¦  «        | _        | j         	                    ¦   «          ddd¦  «         n# 1 swxY w Y   dS )au  Starts a refresh thread for the given credentials.
        The credentials are refreshed using the request parameter.
        request and cred MUST not be None

        Returns True if a background refresh was kicked off. False otherwise.

        Args:
            cred: A credentials object.
            request: A request object.
        Returns:
          bool
        NzQUnable to start refresh. cred and request must be valid and instantiated objects.F)ÚcredÚrequestT)
ÚeÚInvalidValuer	   r   Ú_error_infoÚis_aliveÚRefreshThreadÚcopyÚdeepcopyÚstart)r   r   r   s      r   Ústart_refreshz"RefreshThreadManager.start_refresh#   s  € ð ˆ<˜7˜?Ý”.Øcñô ð ð ŒZð 	%ð 	%ØŒ|Ð'¨D¬LÔ,DÐ,PØð	%ð 	%ð 	%ñ 	%ô 	%ð 	%ð 	%ð 	%ð Œ|Ð#¨4¬<×+@Ò+@Ñ+BÔ+BÐ#Ý,°$ÅÄÈgÑ@VÔ@VÐWÑWÔW�”Ø”×"Ò"Ñ$Ô$Ð$ð	%ð 	%ð 	%ñ 	%ô 	%ð 	%ð 	%ð 	%ð 	%ð 	%ð 	%øøøð 	%ð 	%ð 	%ð 	%ð ˆts    B/ÁA!B/Â/B3Â6B3c                 ól   — | j         5  | j        rd| j        _        ddd¦  «         dS # 1 swxY w Y   dS )zY
        Removes any errors that were stored from previous background refreshes.
        N)r	   r   r   r
   s    r   Úclear_errorz RefreshThreadManager.clear_error>   s„   € ð ŒZð 	0ð 	0ØŒ|ð 0Ø+/�”Ô(ð	0ð 	0ð 	0ñ 	0ô 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0ð 	0øøøð 	0ð 	0ð 	0ð 	0ð 	0ð 	0s   ˆ)©-°-c                 óB   — | j                              ¦   «         }d|d<   |S )z2Pickle helper that serializes the _lock attribute.Nr	   )Ú__dict__r   ©r   Ústates     r   Ú__getstate__z!RefreshThreadManager.__getstate__F   s#   € à”×"Ò"Ñ$Ô$ˆØˆˆg‰Øˆr   c                 óf   — t          j        ¦   «         |d<   | j                             |¦  «         dS )z4Pickle helper that deserializes the _lock attribute.r	   N)r   r   r   Úupdater   s     r   Ú__setstate__z!RefreshThreadManager.__setstate__L   s/   € å"œÑ)Ô)ˆˆg‰ØŒ×Ò˜UÑ#Ô#Ð#Ð#Ð#r   N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r!   r$   © r   r   r   r      si   € € € € € ðð ð&ð &ð &ðð ð ð60ð 0ð 0ðð ð ð$ð $ð $ð $ð $r   r   c                   ó(   ‡ — e Zd ZdZˆ fd„Zd„ Zˆ xZS )r   z,
    Thread that refreshes credentials.
    c                 ód   •—  t          ¦   «         j        di |¤Ž || _        || _        d| _        dS )záInitializes the thread.

        Args:
            cred: A Credential object to refresh.
            request: A Request object used to perform a credential refresh.
            **kwargs: Additional keyword arguments.
        Nr)   )Úsuperr   Ú_credÚ_requestr   )r   r   r   ÚkwargsÚ	__class__s       €r   r   zRefreshThread.__init__W   s>   ø€ ð 	�‰ŒÔÐ"Ð"˜6Ð"Ð"Ð"ØˆŒ
ØˆŒØˆÔÐÐr   c                 ó¾   — 	 | j                              | j        ¦  «         dS # t          $ r/}t                               d|› �¦  «         || _        Y d}~dS d}~ww xY w)z1
        Perform the credential refresh.
        z"Background refresh failed due to: N)r-   Úrefreshr.   Ú	ExceptionÚ_LOGGERÚerrorr   )r   Úerrs     r   ÚrunzRefreshThread.rune   sy   € ð	#ØŒJ×Ò˜tœ}Ñ-Ô-Ð-Ð-Ð-øÝð 	#ð 	#ð 	#Ý�MŠMÐD¸sÐDÐDÑEÔEÐEØ"ˆDÔÐÐÐÐÐÐøøøøð	#øøøs   ‚# £
A­$AÁA)r%   r&   r'   r(   r   r7   Ú__classcell__)r0   s   @r   r   r   R   sQ   ø€ € € € € ðð ð ð  ð  ð  ð  ð#ð #ð #ð #ð #ð #ð #r   r   )r   Úloggingr   Úgoogle.auth.exceptionsÚauthÚ
exceptionsr   Ú	getLoggerr%   r4   r   ÚThreadr   r)   r   r   ú<module>r?      s²   ðð €€€Ø €€€Ø Ð Ð Ð à "Ð "Ð "Ð "Ð "Ð "Ð "Ð "Ð "à
ˆ'Ô
˜HÑ
%Ô
%€ð7$ð 7$ð 7$ð 7$ð 7$ñ 7$ô 7$ð 7$ðt#ð #ð #ð #ð #�IÔ$ñ #ô #ð #ð #ð #r   