Ë
    °ëj  ã                   óT   — d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	  G d	„ d
«      Z
y)zAContain helper class to retrieve/store token from/to local cache.é    N)ÚPath)ÚOptionalé   )Ú	constantsé   )Ú	get_tokenc                   ó¬   — e Zd Z eej
                  «      Z eej                  «      Ze	de
ddfd„«       Ze	dee
   fd„«       Ze	dd„«       Ze	d„ «       Zy)	ÚHfFolderÚtokenÚreturnNc                 óˆ   — | j                   j                  j                  dd¬«       | j                   j                  |«       y)a  
        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)Ú
path_tokenÚparentÚmkdirÚ
write_text)Úclsr   s     úm/home/oem/CyberBrain26-unified/dev-env/.venv/lib/python3.12/site-packages/huggingface_hub/utils/_hf_folder.pyÚ
save_tokenzHfFolder.save_token    s3   € ð 	�‰×Ñ×#Ñ#¨D¸4Ð#Ô@Ø�‰×!Ñ! %Õ(ó    c                 óh   — 	 | j                  «        t        «       S # t        $ r Y t        «       S w xY w)aB  
        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.
        )Ú_copy_to_new_path_and_warnÚ	Exceptionr   ©r   s    r   r   zHfFolder.get_token1   s9   € ð	Ø×*Ñ*Ô,ô ‹{Ðøô ò 	Øä‹{Ðð	ús   ‚ œ	1°1c                 ó¬   — 	 | j                   j                  «        	 | j                  j                  «        y# t        $ r Y Œ'w xY w# t        $ r Y yw xY w)zX
        Deletes the token from storage. Does not fail if token does not exist.
        N)r   ÚunlinkÚFileNotFoundErrorÚ_old_path_tokenr   s    r   Údelete_tokenzHfFolder.delete_tokenF   sU   € ð
	Ø�N‰N×!Ñ!Ô#ð	Ø×Ñ×&Ñ&Õ(øô	 !ò 	Ùð	ûô
 !ò 	Ùð	ús    ‚8 �A ¸	AÁAÁ	AÁAc                 ó"  — | j                   j                  «       ru| j                  j                  «       sZ| j                  | j                   j	                  «       «       t        j                  d| j                   › d| j                  › d�«       y y y )NzA token has been found in `zG`. This is the old path where tokens were stored. The new location is `zÅ` which is configurable using `HF_HOME` environment variable. Your token has been copied to this new location. You can now safely delete the old token file manually or use `huggingface-cli logout`.)r   Úexistsr   r   Ú	read_textÚwarningsÚwarnr   s    r   r   z#HfFolder._copy_to_new_path_and_warnU   s{   € à×Ñ×%Ñ%Ô'°·±×0EÑ0EÔ0GØ�N‰N˜3×.Ñ.×8Ñ8Ó:Ô;Ü�M‰MØ-¨c×.AÑ.AÐ-Bð Cà—^‘^Ð$ð %-ð-õð 1HÐ'r   )r   N)Ú__name__Ú
__module__Ú__qualname__r   r   ÚHF_TOKEN_PATHr   Ú_OLD_HF_TOKEN_PATHr   ÚclassmethodÚstrr   r   r   r    r   © r   r   r
   r
      s‹   „ Ù�i×-Ñ-Ó.€Já˜9×7Ñ7Ó8€Oð ð)˜sð ) tò )ó ð)ð  ð˜( 3™-ò ó ðð( òó ðð ñ
ó ñ
r   r
   )Ú__doc__r$   Úpathlibr   Útypingr   Ú r   Ú_authr   r
   r-   r   r   ú<module>r3      s&   ðñ Hã Ý Ý å Ý ÷Gò Gr   