+
    QV-jh/  ã                   ó”  a € R$ t,0 t R t^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIH	t	 ^ RI
Ht ^ RIHt ^RIHt ^RIHt ^RIHtHt RtR	tR
 R ltRs]! 4       tRs] ^ k ]P6                  ! ]4      tR R ltR R ltR R lt R R lt! ! R R]4      t"]! 4       t#Rs$] ^k Rt%R R lt&R R lt'R R lt(R R lt)R  R! lt*R" R# lt+R# )%zVContains a helper to get the token from machine (env variable, secret or config file).N)ÚPath)ÚLock)Ú	TypedDict)Ú	constants)Ú	OIDCError)Úis_colab_enterpriseÚis_google_colabi€  iÀ  c                ó4   € V ^8„  d   QhR\         R\        RR/# )é   ÚpathÚcontentÚreturnN)r   Ústr)Úformats   "Úl/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/huggingface_hub/utils/_auth.pyÚ__annotate__r   #   s!   € ÷ ñ œð ¤sð ¨tñ ó    c                ó6  € V P                   P                  RR\        R7       \        P                  ! \        V 4      \        P                  \        P                  ,          \        P                  ,          \        4      p\        P                  ! VR4      ;_uu_ 4       pVP                  V4       RRR4        V P                  \        4       V P                   P                  \        4       R#   + '       g   i     LG; i  \        \        3 d     R# i ; i)ziWrite content to file, restricting both the file and its parent directory to owner-only on POSIX systems.T)ÚparentsÚexist_okÚmodeÚwN)ÚparentÚmkdirÚ_SECRET_DIR_MODEÚosÚopenr   ÚO_WRONLYÚO_CREATÚO_TRUNCÚ_SECRET_FILE_MODEÚfdopenÚwriteÚchmodÚOSErrorÚNotImplementedError)r   r   ÚfdÚfs   &&  r   Ú_write_secretr(   #   s´   € à‡K�K×Ñ˜d¨TÔ8HÐÔIÜ	�Š”�T“œBŸK™K¬"¯*©*Õ4´r·z±zÕAÔCTÓ	U€BÜ	�Š�2�s×	Ô	˜qØ	�‰�Ô÷ 
ðØ�
‰
Ô$Ô%Ø�‰×ÑÔ*Ö+÷	 
×	ûô
 Ô(Ð)ô âðús   ÂC0Â:4D Ã0D 	ÄDÄDFc                ó2   € V ^8„  d   QhR\         R,          /# ©r
   r   N©r   )r   s   "r   r   r   8   s   € ÷ ñ ”3˜•:ñ r   c                 ó‚   € \        4       ;'       g/    \        4       ;'       g    \        4       ;'       g    \        4       # )am  
Get token if user is logged in.

Note: in most cases, you should use [`huggingface_hub.utils.build_hf_headers`] instead. This method is only useful
      if you want to retrieve the token for other purposes than sending an HTTP request.

If `HF_OIDC_RESOURCE` is set (Trusted Publishers, typically in CI), a short-lived token obtained via OIDC token
exchange takes precedence. Otherwise the token is retrieved from the `HF_TOKEN` environment variable, then from the
token file in the Hugging Face home folder. Returns None if user is not logged in. To log in, use [`login`] or
`hf auth login`.

Note: if `HF_OIDC_RESOURCE` is set but the OIDC token exchange fails, this raises instead of returning `None`,
opting into OIDC is explicit, so a failure surfaces as a clear error rather than a silent fallback.

Returns:
    `str` or `None`: The token, `None` if it doesn't exist.
)Ú_get_token_from_oidcÚ_get_token_from_environmentÚ_get_token_from_fileÚ_get_token_from_google_colab© r   r   Ú	get_tokenr2   8   sA   € ô& 	Ó÷ 	*ð 	*Ü&Ó(÷	*ð 	*äÓ!÷	*ð 	*ô (Ó)ð	r   c                ó2   € V ^8„  d   QhR\         R,          /# r*   r+   )r   s   "r   r   r   R   s   € ÷ =$ñ =$¤c¨D¥jñ =$r   c            	     óŠ  € \        4       '       d   \        4       '       d   R# \        ;_uu_ 4        \        '       d   \        uuRRR4       #  ^ RIHp  ^ RIHp  T P                  R4      p\        T4      sR	s\        uuRRR4       #   \         d     RRR4       R# i ; i  T P                   d    \        P                  ! R4       Rs LWT P                   d    \        P                  ! R4       Rs L�T d0   p\        P                  ! R\!        T4       R24       Rs Rp?L±Rp?ii ; i  + '       g   i     R# ; i)
z×Get token from Google Colab secrets vault using `google.colab.userdata.get(...)`.

Token is read from the vault only once per session and then stored in a global variable to avoid re-requesting
access to the vault.
N)Úuserdata)ÚErrorÚHF_TOKENz¥
Access to the secret `HF_TOKEN` has not been granted on this notebook.
You will not be requested again.
Please restart the session if you want to be prompted again.aœ  
The secret `HF_TOKEN` does not exist in your Colab secrets.
To authenticate with the Hugging Face Hub, create a token in your settings tab (https://huggingface.co/settings/tokens), set it as secret in your Google Colab and restart your session.
You will be able to reuse this secret in all of your notebooks.
Please note that authentication is recommended but still optional to access public models or datasets.z@
Error while fetching `HF_TOKEN` secret value from your vault: 'zÍ'.
You are not authenticated with the Hugging Face Hub in this notebook.
If the error persists, please let us know by opening an issue on GitHub (https://github.com/huggingface/huggingface_hub/issues/new).T)r   r   Ú_GOOGLE_COLAB_SECRET_LOCKÚ_IS_GOOGLE_COLAB_CHECKEDÚ_GOOGLE_COLAB_SECRETÚgoogle.colabr5   Úgoogle.colab.errorsr6   ÚImportErrorÚgetÚ_clean_tokenÚNotebookAccessErrorÚwarningsÚwarnÚSecretNotFoundErrorr   )r5   Ú
ColabErrorÚtokenÚes       r   r0   r0   R   s-  € ô ×ÒÔ 3× 5Ò 5Ù÷ 
#Ö	"÷ $Ó#Ü'÷ 
#Ò	"ð	Ý-Ý?ð	(Ø—L‘L Ó,ˆEÜ#/°Ó#6Ð ð< $(Ð Ü#÷] 
#Ò	"øô ô 	Ø÷ 
#Ñ	"ð	ûð ×+Ñ+ô 	(ô �MŠMðQôð
 $(Ò Ø×+Ñ+ô 		(ä�MŠMð{ôð $(Ò Øô 	(ä�MŠMØSÔTWÐXYÓTZÐS[ð \Oð Oôð $(Õ ûð	(ú÷G 
#×	"Ð	"úsw   ±D1ÁB
ÁB$Á8D1Â
B!ÂD1Â B!Â!D1Â$)D.ÃD1ÃD.ÃD.Ã7D1Ã9D.Ã>D.Ã?%D)Ä$D1Ä)D.Ä.D1Ä1E	c                ó2   € V ^8„  d   QhR\         R,          /# r*   r+   )r   s   "r   r   r   ’   s   € ÷ `ñ `¤S¨4¥Zñ `r   c                  ó    € \        \        P                  P                  R 4      ;'       g     \        P                  P                  R4      4      # )r7   ÚHUGGING_FACE_HUB_TOKEN)r?   r   Úenvironr>   r1   r   r   r.   r.   ’   s0   € äœŸ
™
Ÿ™ zÓ2×^Ð^´b·j±j·n±nÐE]Ó6^Ó_Ð_r   c                ó2   € V ^8„  d   QhR\         R,          /# r*   r+   )r   s   "r   r   r   —   s   € ÷ ñ œc D�jñ r   c                  óˆ   €  \        \        \        P                  4      P	                  4       4      #   \
         d     R # i ; i)N)r?   r   r   ÚHF_TOKEN_PATHÚ	read_textÚFileNotFoundErrorr1   r   r   r/   r/   —   s8   € ðÜœD¤×!8Ñ!8Ó9×CÑCÓEÓFÐFøÜô Úðús   ‚/2 ²AÁ Ac                   ó,   a € ] tR t^žt o V 3R ltRtV tR# )Ú_OidcTokenCachec                ó>   <€ V ^8„  d   Qh/ S[ ;R&   S[ ;R&   S[;R&   # )r
   ÚresourcerE   Ú
expires_at)r   Úfloat)r   Ú__classdict__s   "€r   r   Ú_OidcTokenCache.__annotate__ž   s&   ø‡ ‚ Ù�Mñ á�Jñ ñ Ñò r   r1   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotate_func__Ú__static_attributes__Ú__classdictcell__)rV   s   @r   rQ   rQ   ž   s   ø‡ ‡ „ r   rQ   i,  c                ó2   € V ^8„  d   QhR\         R,          /# r*   r+   )r   s   "r   r   r   «   s   € ÷ 0ñ 0œc D�jñ 0r   c                 ó¤  € \         P                  P                  R4      p V '       g   R# ^RIHpHp \        ;_uu_ 4        \        P                  ! 4       p\        e<   \        R,          V 8X  d*   V\        R,          8  d   \        R,          uuRRR4       # \         P                  P                  R4      ;'       g    RpVf   V! 4       f   \        R4      hV! WR	7      pVR
,          p\        VP                  RR4      4      pVe   ^ M\        pRV RVRV\        Wx,
          ^ 4      ,           /s	VuuRRR4       #   + '       g   i     R# ; i)aÓ  Get a short-lived OIDC token in CI (Trusted Publishers).

Enabled by setting `HF_OIDC_RESOURCE`, which scopes the token to a repo or user.
The ID token is read from `HF_OIDC_ID_TOKEN` if available, or minted from a supported CI provider (e.g. GitHub Actions).

Returns `None` when OIDC is not enabled.
If enabled, any failure is raised explicitly rather than falling back silently.

See `huggingface_hub._oidc` and https://huggingface.co/docs/hub/trusted-publishers.
ÚHF_OIDC_RESOURCEN)Údetect_providerÚ
oidc_loginrS   rT   rE   ÚHF_OIDC_ID_TOKENzçHF_OIDC_RESOURCE is set but no OIDC id token is available: not running in a supported CI provider (github) and HF_OIDC_ID_TOKEN is not set. Set HF_OIDC_ID_TOKEN to the id token minted by your CI provider, or unset HF_OIDC_RESOURCE.)rS   Úsubject_tokenÚaccess_tokenÚ
expires_ini  )r   rJ   r>   Ú_oidcrb   rc   Ú_OIDC_TOKEN_LOCKÚtimeÚ	monotonicÚ_OIDC_TOKEN_CACHEr   ÚintÚ_OIDC_REFRESH_MARGINÚmax)	rS   rb   rc   Únowre   ÚresultrE   rg   Úmargins	            r   r-   r-   «   s  € ô �z‰z�~‰~Ð0Ó1€HßÙç3÷ 
Ö	Ü�nŠnÓˆäÒ)Ü! *Õ-°Ô9ØÔ'¨Õ5Ô5ä$ WÕ-÷ 
Ò	ô Ÿ
™
Ÿ™Ð'9Ó:×BÐB¸dˆØÒ ¡_Ó%6Ò%>ÜðOóð ñ  XÔKˆØ�~Õ&ˆÜ˜Ÿ™ L°$Ó7Ó8ˆ
ð $Ò/‘Ô5Iˆà˜Ø�UØ˜#¤ JÕ$7¸Ó ;Õ;ð
Ðð
 ÷= 
×	×	Ó	ús   Á AD>Â%D>Â?A4D>Ä>E	c                óF   € V ^8„  d   QhR\         \        \        3,          /# )r
   r   ©Údictr   )r   s   "r   r   r   Þ   s   € ÷ ñ œ4¤¤S �>ñ r   c                 ó˜  € \        \        P                  4      p V P                  4       '       g   / p\        P
                  ! 4       p VP                  V 4       VP                  4        Uu/ uF  q3VP                  VR4      bK  	  ppV# u upi   \        P                   d&   p\        P                  RT 24       / p Rp?T# Rp?ii ; i)a)  
Returns the parsed INI file containing the access tokens.
The file is located at `HF_STORED_TOKENS_PATH`, defaulting to `~/.cache/huggingface/stored_tokens`.
If the file does not exist, an empty dictionary is returned.

Returns: `dict[str, str]`
    Key is the token name and value is the token.
Úhf_tokenz"Error parsing stored tokens file: N)r   r   ÚHF_STORED_TOKENS_PATHÚexistsÚconfigparserÚConfigParserÚreadÚsectionsr>   r6   ÚloggerÚerror)Útokens_pathÚstored_tokensÚconfigÚ
token_namerF   s        r   Úget_stored_tokensr„   Þ   s·   € ô ”y×6Ñ6Ó7€KØ×Ñ×ÒØˆÜ×&Ò&Ó(€FðØ�‰�KÔ ØZ`×ZiÑZiÔZkÓlÑZkÈJ V§Z¡Z°
¸JÓ%GÒGÑZkˆÐlð Ðùò	 møÜ×Ñô Ü�‰Ð9¸!¸Ð=Ô>ØŒØÐûðús*   Á#B Á+B
ÂB Â
B ÂC	Â$CÃC	c                óJ   € V ^8„  d   QhR\         \        \        3,          RR/# )r
   r�   r   Nrt   )r   s   "r   r   r   ô   s"   € ÷ 6ñ 6¤t¬C´¨H¥~ð 6¸$ñ 6r   c                ót  € \        \        P                  4      p\        P                  ! 4       p\        V P                  4       4       F-  pVP                  V4       VP                  VRW,          4       K/  	  \        P                  ! 4       pVP                  V4       \        WP                  4       4       R# )z¸
Saves the given configuration to the stored tokens file.

Args:
    stored_tokens (`dict[str, str]`):
        The stored tokens to save. Key is the token name and value is the token.
rw   N)r   r   rx   rz   r{   ÚsortedÚkeysÚadd_sectionÚsetÚioÚStringIOr"   r(   Úgetvalue)r�   Ústored_tokens_pathr‚   rƒ   Úbufs   &    r   Ú_save_stored_tokensr�   ô   s†   € ô œi×=Ñ=Ó>Ðô ×&Ò&Ó(€FÜ˜]×/Ñ/Ó1Ö2ˆ
Ø×Ñ˜:Ô&Ø�
‰
�:˜z¨=Õ+DÖEñ 3ô �+Š+‹-€CØ
‡L�L�ÔÜÐ$§l¡l£nÖ5r   c                ó>   € V ^8„  d   QhR\         R\         R,          /# )r
   rƒ   r   Nr+   )r   s   "r   r   r   	  s   € ÷ 3ñ 3¤3ð 3¬3°­:ñ 3r   c                óH   € \        4       pW9  d   R# \        W,          4      # )z¤
Get the token by name.

Args:
    token_name (`str`):
        The name of the token to get.

Returns:
    `str` or `None`: The token, `None` if it doesn't exist.

N)r„   r?   )rƒ   r�   s   & r   Ú_get_token_by_namer“   	  s#   € ô &Ó'€MØÔ&ÙÜ˜Õ1Ó2Ð2r   c                ó4   € V ^8„  d   QhR\         R\         RR/# )r
   rE   rƒ   r   Nr+   )r   s   "r   r   r     s&   € ÷ Mñ M”sð M¬ð M°ñ Mr   c                ó    € \        \        P                  4      p\        4       pWV&   \	        V4       \
        P                  RV RV 24       R# )zÁ
Save the given token.

If the stored tokens file does not exist, it will be created.
Args:
    token (`str`):
        The token to save.
    token_name (`str`):
        The name of the token.
zThe token `z` has been saved to N)r   r   rx   r„   r�   r~   Úinfo)rE   rƒ   r€   r�   s   &&  r   Ú_save_tokenr—     sF   € ô ”y×6Ñ6Ó7€KÜ%Ó'€MØ %�*ÑÜ˜Ô&Ü
‡K�K�+˜j˜\Ð)=¸k¸]ÐKÖLr   c                óL   € V ^8„  d   QhR\         R,          R\         R,          /# )r
   rE   Nr   r+   )r   s   "r   r   r   -  s&   € ÷ Eñ Eœ˜d�
ð E¤s¨T¥zñ Er   c                ó‚   € V f   R# V P                  RR4      P                  RR4      P                  4       ;'       g    R# )zmClean token by removing trailing and leading spaces and newlines.

If token is an empty string, return None.
NÚÚ Ú
)ÚreplaceÚstrip)rE   s   &r   r?   r?   -  s;   € ð
 ‚}ÙØ�=‰=˜˜rÓ"×*Ñ*¨4°Ó4×:Ñ:Ó<×DÐDÀÐDr   c                ó„   € V ^8„  d   Qh/ ^ \         9   d   \        R,          ;R&   ^\         9   d   \        R,          ;R&   # )r
   Nr:   rl   )Ú__conditional_annotations__r   rQ   )r   s   "r   r   r      s;   € × \Ñ \÷J (Ò '”c˜D•jÑ 'ñK ]÷r 1Ò 0”? TÕ)Ñ 0òs ]r   )-r    Ú__doc__rz   r‹   Úloggingr   rj   rA   Úpathlibr   Ú	threadingr   Útypingr   r›   r   Úerrorsr   Ú_runtimer   r   r    r   r(   r9   r8   r:   Ú	getLoggerrX   r~   r2   r0   r.   r/   rQ   ri   rl   rn   r-   r„   r�   r“   r—   r?   r   )r    s   @r   Ú<module>r©      sÈ   øðö ]ã Û 	Û Û 	Û Û Ý Ý Ý å Ý ß :ð Ð ØÐ õð !Ð Ù ›FÐ Ø#'Ð Ó 'à	×	Ò	˜8Ó	$€õõ4=$õ@`õ
ô�iô ñ “6Ð Ø,0Ð Ó 0ØÐ õ0õfõ,6õ*3õ$M÷$Er   