
    Y j                        S r SSKJr  SSKrSSKJr  SSKJr  SSKJ	r	J
r
JrJr  SSKJrJrJr  S	S
KJrJr  S	SKJr  \R,                  " \5      r\" SS9r\R5                  S/ SQS9   S.S\S\\\R8                  " SS94   S\\\R8                  " SS94   SS4S jj5       r\R5                  SSS/S9 S/S\\S-  \R8                  " SS94   SS4S jj5       rS\S-  4S jr \R5                  SS S!/S9  S0S\\S-  \R8                  " S"S94   S\\\R8                  " SS94   SS4S# jj5       r!\R5                  S$S%/S9S1S& j5       r"\R5                  SS'S(/S9S1S) j5       r#\R5                  S*S+S,/S9S1S- j5       r$g)2a  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   )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                 "    [        XU(       + S9  g)z8Login using a token from huggingface.co/settings/tokens.)r   r   skip_if_logged_inN)r	   )r   r   r   s      i/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/huggingface_hub/cli/auth.py
auth_loginr   4   s    2 
Z_V_`    r
   zhf auth logoutz$hf auth logout --token-name my-token
token_namezName of token to logoutc                     [        U S9  g)zLogout from a specific token.r   N)r
   r   s    r   auth_logoutr    P   s     j!r   c                     [        [        5       R                  5       5      n U (       d  [        R	                  S5        g [        S5        [        U S5       H  u  p[        U SU 35        M       [        S5      nUR                  5       S:X  a  g [        U5      S-
  nSUs=::  a  [        U 5      :  a  O  OX   $ [        S5         MZ  ! [         a    [        S	5         Nf = f)
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_namer2   ^   s    (*//12KBC	
$%";22j\"# 3

	JZ[F||~$K!OEE,C,,"))<=   	JHI	Js   1C
 *C
 <C
 
C"!C"switchzhf auth switchz$hf auth switch --token-name my-tokenzName of the token to switch toc                 v    U c
  [        5       n U c   [        S5        [        R                  " 5       e[	        XS9  g)zSwitch between access tokens.Nz!No token name provided. Aborting.)r   )r2   r'   typerExitr   )r   r   s     r   auth_switch_cmdr7   v   s5    & ')
12jjl
Hr   z	list | lszhf auth listc                      [        5         g)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                      [        5       n U c*  [        R                  " S5        [        R                  " SS9e[        U 5        [        R                  " S5        g)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&   r5   r6   r'   hint)r   s    r   
auth_tokenr?      s@     KE}		=>jja  	%LHHOPr   r   zhf auth whoamizhf auth whoami --format jsonc                  &   [        5       n U c*  [        R                  " S5        [        R                  " SS9e[        U 5      nSR                  S US    5       5      =(       d    Sn[        S:w  a  [        OSn[        R                  " S	US
   X#S9  g)z;Find out which huggingface.co account you are logged in as.NzNot logged inr   r<   ,c              3   *   #    U  H	  oS    v   M     g7f)nameNr9   ).0orgs     r   	<genexpr>auth_whoami.<locals>.<genexpr>   s     8<CK<s   orgszhttps://huggingface.coz	Logged inrC   )userrH   endpoint)	r   r   r&   r5   r6   r   joinr   result)r   inforH   rJ   s       r   auth_whoamirN      st     KE}		/"jja  %=D8884<88@DD#'??xTHJJ{fDLr   )NFF)N)NF)r   N)%__doc__typingr   r5   huggingface_hub.constantsr   huggingface_hub.hf_apir   _loginr   r   r	   r
   utilsr   r   r   
_cli_utilsr   r   _outputr   
get_logger__name__r%   auth_clicommandboolOptionr   strr    r2   r7   r:   r?   rN   r9   r   r   <module>r^      sv  &   . ) : : 9 9 /  
		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 
(&68V%WXM YMr   