Ë
    ùmxi3  ã                   ó�   — 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y)é    Nc                   ó.   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zy)ÚRefreshThreadManagerzD
    Organizes exactly one background job that refresh a token.
    c                 óD   — d| _         t        j                  «       | _        y)zInitializes the manager.N)Ú_workerÚ	threadingÚLockÚ_lock©Úselfs    úR/home/htdocs/ttos/venv/lib/python3.12/site-packages/google/auth/_refresh_worker.pyÚ__init__zRefreshThreadManager.__init__   s   € ð ˆŒÜ—^‘^Ó%ˆ�
ó    c                 óš  — |�|€t        j                  d«      ‚| j                  5  | j                  � | j                  j                  �
	 ddd«       y| j                  �| j                  j                  «       s?t        |t        j                  |«      ¬«      | _        | j                  j                  «        ddd«       y# 1 sw Y   yxY w)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‰Zñ 	%Ø�|‰|Ð'¨D¯L©L×,DÑ,DÐ,PØ÷	%ð 	%ð �|‰|Ð#¨4¯<©<×+@Ñ+@Ô+BÜ,°$ÄÇÁÈgÓ@VÔW�”Ø—‘×"Ñ"Ô$÷	%ð ÷	%ð ús   ¦$CÁA%CÃC
c                 ó€   — | j                   5  | j                  rd| j                  _        ddd«       y# 1 sw Y   yxY w)zY
        Removes any errors that were stored from previous background refreshes.
        N)r	   r   r   r
   s    r   Úclear_errorz RefreshThreadManager.clear_error>   s3   € ð �Z‰Zñ 	0Ø�|Š|Ø+/�—‘Ô(÷	0÷ 	0ñ 	0ús   �4´=c                 óD   — | j                   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                 óh   — t        j                  «       |d<   | j                  j                  |«       y)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      s    „ ñò&òò6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                 óN   •— t        ‰| �  di |¤Ž || _        || _        d| _        y)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                  | j                  «       y# t        $ r)}t        j                  d|› �«       || _        Y d}~y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   sL   € ð	#Ø�J‰J×Ñ˜tŸ}™}Õ-øÜò 	#Ü�M‰MÐ>¸s¸eÐDÔEØ"ˆD×Ñûð	#ús   ‚%( ¨	A±AÁA)r%   r&   r'   r(   r   r7   Ú__classcell__)r0   s   @r   r   r   R   s   ø„ ñô ö#r   r   )r   Úloggingr   Úgoogle.auth.exceptionsÚauthÚ
exceptionsr   Ú	getLoggerr%   r4   r   ÚThreadr   r)   r   r   ú<module>r?      sE   ðó Û Û ç "Ð "à
ˆ'×
Ñ
˜HÓ
%€÷7$ñ 7$ôt#�I×$Ñ$õ #r   