
    QЦiD                        S r SSKJr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Jr  S	S
KJrJr  \R,                  " \5      r\" SS9r\R5                  S/ SQS9  S'S\S\\\R8                  " SS94   SS4S jj5       r\R5                  SSS/S9 S(S\\\   \R8                  " SS94   SS4S jj5       rS\\   4S jr \R5                  SSS/S9  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9S)S# j5       r"\R5                  S$S%/S9S)S& j5       r#g)*a  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
    )	AnnotatedOptionalN)ENDPOINT)whoami   )	auth_listauth_switchloginlogout)ANSIget_stored_tokens	get_tokenlogging   )TokenOpttyper_factoryz,Manage authentication (login, logout, etc.).)helpr
   )zhf auth loginzhf auth login --token $HF_TOKENz7hf auth login --token $HF_TOKEN --add-to-git-credential)examplestokenadd_to_git_credentialzTSave to git credential helper. Useful only if you plan to run git commands directly.returnc                     [        XS9  g)z8Login using a token from huggingface.co/settings/tokens.r   r   N)r
   r   s     W/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/huggingface_hub/cli/auth.py
auth_loginr   3   s    $ 
C    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    H   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   V   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   n   s5    & ')
12jjl
Hr   r#   zhf auth listc                      [        5         g)zList all stored access tokens.N)r    r   r   auth_list_cmdr:      s	     Kr   r   zhf auth whoamic                     [        5       n U c   [        S5        [        R                  " 5       e[	        U 5      n[        [
        R                  " S5      US   5        US    Vs/ s H  o"S   PM	     nnU(       a/  [        [
        R                  " S5      SR                  U5      5        [        S:w  a  [        S	[         35        ggs  snf )
z;Find out which huggingface.co account you are logged in as.NzNot logged inzuser: nameorgszorgs: ,zhttps://huggingface.coz(Authenticated through private endpoint: )	r   r'   r5   r6   r   r   boldjoinr   )r   infoorgr=   s       r   auth_whoamirC      s     KE}ojjl%=D	$))H
tF|,#'<0<CK<D0dii!388D>2++8
CD ,	 1s   #C)NF)N)r   N)$__doc__typingr   r   r5   huggingface_hub.constantsr   huggingface_hub.hf_apir   _loginr   r	   r
   r   utilsr   r   r   r   
_cli_utilsr   r   
get_logger__name__r%   auth_clicommandboolOptionr   strr    r2   r7   r:   rC   r9   r   r   <module>rR      s  & '  . ) : : ? ? / 
		H	% LM 
    	
D
D$g	
	
D 

D
D 
 FG   		"34	6"
 
"	"JHSM J0 
 FG   	 	I1	
	I %g	
	I 
I	I. 
&N#34 5
 
(&6%78E 9Er   