Ë
    ëÿæi$  ã                   óX  — d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	m
Z
mZmZ ddlmZmZmZ d	d
lmZmZmZmZ d	dlmZ  ej0                  e«      Z ed¬«      Zej9                  dg d¢¬«      	 	 	 d/dedee ej<                  d¬«      f   dee ej<                  d¬«      f   ddfd„«       Zej9                  dddg¬«      	 d0dee dz   ej<                  d¬«      f   ddfd„«       Z!de dz  fd„Z"ej9                  dd d!g¬«      	 	 d1dee dz   ej<                  d"¬«      f   dee ej<                  d¬«      f   ddfd#„«       Z#ej9                  d$d%g¬«      d2d&„«       Z$ej9                  dd'd(g¬«      d2d)„«       Z%ej9                  d*d+d,g¬«      ejL                  fd-eddfd.„«       Z'y)3a�  Contains commands to authenticate to the Hugging Face Hub and interact with your repositories.

Usage:
    # login and save token locally.
    hf auth login --token=hf_*** --add-to-git-credential

    # switch between tokens
    hf auth switch

    # list all tokens
    hf auth list

    # logout from all tokens
    hf auth logout

    # check which account you are logged in as
    hf auth whoami
é    )Ú	AnnotatedN)ÚENDPOINT)Úwhoamié   )Ú	auth_listÚauth_switchÚloginÚlogout)Úget_stored_tokensÚ	get_tokenÚloggingé   )ÚFormatWithAutoOptÚOutputFormatWithAutoÚTokenOptÚtyper_factory)Úoutz,Manage authentication (login, logout, etc.).)Úhelpr	   )zhf auth loginzhf auth login --token $HF_TOKENz7hf auth login --token $HF_TOKEN --add-to-git-credentialzhf auth login --force)ÚexamplesÚtokenÚadd_to_git_credentialzTSave to git credential helper. Useful only if you plan to run git commands directly.Úforcez)Force re-login even if already logged in.Úreturnc                 ó"   — t        | || ¬«       y)z8Login using a token from huggingface.co/settings/tokens.)r   r   Úskip_if_logged_inN)r	   )r   r   r   s      úm/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/huggingface_hub/cli/auth.pyÚ
auth_loginr   4   s   € ô2 
�Ð-BÐZ_ÐV_Ö`ó    r
   zhf auth logoutz$hf auth logout --token-name my-tokenÚ
token_namezName of token to logoutc                 ó   — t        | ¬«       y)zLogout from a specific token.©r   N)r
   r!   s    r   Úauth_logoutr"   P   s   € ô �jÖ!r   c                  ó¶  — t        t        «       j                  «       «      } | st        j	                  d«       y t        d«       t        | d«      D ]  \  }}t        |› d|› �«       Œ 	 	 t        d«      }|j                  «       dk(  ry t        |«      dz
  }d|cxk  rt        | «      k  rn n| |   S t        d«       	 ŒW# t        $ r t        d	«       Y Œw xY w)
Nz+No stored tokens found. Please login first.zAvailable stored tokens:r   z. z=Enter the number of the token to switch to (or 'q' to quit): Úqr   z$Invalid selection. Please try again.z4Invalid input. Please enter a number or 'q' to quit.)Úlistr   ÚkeysÚloggerÚerrorÚprintÚ	enumerateÚinputÚlowerÚintÚlenÚ
ValueError)Útoken_namesÚir   ÚchoiceÚindexs        r   Ú_select_token_namer4   ^   sÖ   € ÜÔ(Ó*×/Ñ/Ó1Ó2€KáÜ�‰ÐBÔCØä	Ð
$Ô%Ü" ;°Ö2‰ˆˆ:Ü���2�j�\Ð"Õ#ð 3à
ð
	JÜÐZÓ[ˆFØ�|‰|‹~ Ò$ØÜ˜“K !‘OˆEØ�EÔ,œC Ó,Õ,Ø" 5Ñ)Ð)äÐ<Õ=ð øô ò 	JÜÐHÖIð	Jús   Á+C Â
)C Â4C ÃCÃCÚswitchzhf auth switchz$hf auth switch --token-name my-tokenzName of the token to switch toc                 óx   — | €
t        «       } | €t        d«       t        j                  «       ‚t	        | |¬«       y)zSwitch between access tokens.Nz!No token name provided. Aborting.)r   )r4   r)   ÚtyperÚExitr   )r   r   s     r   Úauth_switch_cmdr9   v   s8   € ð& ÐÜ'Ó)ˆ
ØÐÜÐ1Ô2Ü�j‰j‹lÐÜ�
Ð2GÖHr   z	list | lszhf auth listc                  ó   — t        «        y)zList all stored access tokens.N)r   © r   r   Úauth_list_cmdr<   ‘   s	   € ô …Kr   zhf auth tokenz8hf auth token | xargs curl -H 'Authorization: Bearer {}'c                  ó²   — t        «       } | €+t        j                  d«       t        j                  d¬«      ‚t        | «       t        j                  d«       y)z)Print the current access token to stdout.Nz)Not logged in. Run `hf auth login` first.r   ©Úcodez@Run `hf auth whoami` to see which account this token belongs to.)r   r   r(   r7   r8   r)   Úhint)r   s    r   Ú
auth_tokenrA   —   s@   € ô ‹K€EØ€}Ü�	‰	Ð=Ô>Ü�j‰j˜aÔ Ð Ü	ˆ%„LÜ‡H�HÐOÕPr   r   zhf auth whoamizhf auth whoami --format jsonÚformatc                 ó   — t        «       }|€+t        j                  d«       t        j                  d¬«      ‚t        |«      }dj                  d„ |d   D «       «      xs d}t        dk7  rt        nd}t        j                  d	|d
   ||¬«       y)z;Find out which huggingface.co account you are logged in as.NzNot logged inr   r>   Ú,c              3   ó&   K  — | ]	  }|d    –— Œ y­w)ÚnameNr;   )Ú.0Úorgs     r   Ú	<genexpr>zauth_whoami.<locals>.<genexpr>®   s   è ø€ Ð8©< C�C˜•K©<ùs   ‚Úorgszhttps://huggingface.coz	Logged inrF   )ÚuserrJ   Úendpoint)	r   r   r(   r7   r8   r   Újoinr   Úresult)rB   r   ÚinforJ   rL   s        r   Úauth_whoamirP   ¢   sv   € ô ‹K€EØ€}Ü�	‰	�/Ô"Ü�j‰j˜aÔ Ð ä�%‹=€DØ�8‰8Ñ8¨4°ª<Ó8Ó8Ò@¸D€DÜ#Ð'?Ò?�xÀT€HÜ‡J�Jˆ{  f¡°DÀ8ÖLr   )NFF)N)NF)r   N)(Ú__doc__Útypingr   r7   Úhuggingface_hub.constantsr   Úhuggingface_hub.hf_apir   Ú_loginr   r   r	   r
   Úutilsr   r   r   Ú
_cli_utilsr   r   r   r   Ú_outputr   Ú
get_loggerÚ__name__r'   Úauth_cliÚcommandÚboolÚOptionr   Ústrr"   r4   r9   r<   rA   ÚautorP   r;   r   r   Ú<module>ra      s   ðñõ& ã å .Ý )ç :Ó :ß 9Ñ 9ß XÓ XÝ ð 
ˆ×	Ñ	˜HÓ	%€ñ ÐLÔM€ð 
×ÑØòð ó ð ð 	ð 	ñaØðaà$ØØˆ�‰Øgô	
ð	ñðað ØØˆ�‰Ø<ô	
ð	ñðað 
òaóðað& 
×ÑØØÐ FÐGð ó ð 	ñ	"ØØˆd‰
Øˆ�‰Ð3Ô4ð	6ñð"ð
 
ò"ó	ð"ðJ˜C $™Jó Jð0 
×ÑØØÐ FÐGð ó ð 	ð 	ñIØØˆd‰
Øˆ�‰Ø1ô	
ð	ñðIð %ØØˆ�‰Øgô	
ð	ñðIð 
òIó	ðIð. 
×Ñ�+¨Ð(8ÐÓ9òó :ðð
 
×Ñ�' _Ð6pÐ$qÐÓròQó sðQð 
×Ñ�(Ð&6Ð8VÐ%WÐÓXà 4× 9Ñ 9ñMØðMà	òMó YñMr   