
    ,h	                     L    S r SSKJr  SSKJr  SSKJr  SSKJr   " S S	5      r	g
)zAContain helper class to retrieve/store token from/to local cache.    )Path)Optional   )	constants   	get_tokenc                   b    \ rS rSr\S\SS4S j5       r\S\\   4S j5       r\S	S j5       r	Sr
g)
HfFolder   tokenreturnNc                     [        [        R                  5      nUR                  R	                  SSS9  UR                  U5        g)z
Save token, creating folder as needed.

Token is saved in the huggingface home folder. You can configure it by setting
the `HF_HOME` environment variable.

Args:
    token (`str`):
        The token to save to the [`HfFolder`]
T)parentsexist_okN)r   r   HF_TOKEN_PATHparentmkdir
write_text)clsr   
path_tokens      X/var/www/html/shao/venv/lib/python3.13/site-packages/huggingface_hub/utils/_hf_folder.py
save_tokenHfFolder.save_token   s;     )112
t<e$    c                     [        5       $ )a  
Get token or None if not existent.

This method is deprecated in favor of [`huggingface_hub.get_token`] but is kept for backward compatibility.
Its behavior is the same as [`huggingface_hub.get_token`].

Returns:
    `str` or `None`: The token, `None` if it doesn't exist.
r   r   s    r   r	   HfFolder.get_token-   s     {r   c                 t     [        [        R                  5      R                  5         g! [         a     gf = f)zH
Deletes the token from storage. Does not fail if token does not exist.
N)r   r   r   unlinkFileNotFoundErrorr   s    r   delete_tokenHfFolder.delete_token<   s0    
	(()002  		s   '* 
77 )r   N)__name__
__module____qualname____firstlineno__classmethodstrr   r   r	   r"   __static_attributes__r$   r   r   r   r      sW     %s %t % %" 
(3- 
 
  r   r   N)
__doc__pathlibr   typingr    r   _authr	   r   r$   r   r   <module>r1      s!    H    , ,r   