
    Li                     *   U d Z ddlZddlmZmZ ddlmZmZmZm	Z	m
Z
mZmZmZmZ dedefdZde	defdZdedefd	Zdedefd
ZdedefdZdedefdZdedefdZe	eeeeeeeed eee
d ed eeeei
Zeee   edef   f   ed<   dedee   fdZy)zCLI error handling utilities.    N)CallableOptional)	BucketNotFoundErrorCLIErrorCLIExtensionInstallErrorGatedRepoErrorHfHubHTTPErrorLocalTokenNotFoundErrorRemoteEntryNotFoundErrorRepositoryNotFoundErrorRevisionNotFoundErrorerrorreturnc                     | j                   r| j                   j                         nd}| j                  r| d| j                   d}n| d}|dz  }|S )N
Repository 'z' not found.z not found.z9 If the repo is private, make sure you are authenticated.)	repo_type
capitalizerepo_id)r   labelmsgs      a/var/www/html/lcp-python-backend/venv/lib/python3.12/site-packages/huggingface_hub/cli/_errors.py_format_repo_not_foundr       sU    ,1OOEOO&&(E}}r%--5{#FFCJ    c                     | j                   r| j                   nd}| j                  r!d|j                          d| j                   dS d| dS )N
repositoryzAccess denied. r   z' requires approval.zAccess denied. This z requires approval.)r   r   r   r   r   s     r   _format_gated_repor   *   sN    $EOOLE}} !1!1!3 4Bu}}oEYZZ!%(;<<r   c                 <    | j                   rd| j                    dS y)NzBucket 'zG' not found. If the bucket is private, make sure you are authenticated.zrBucket not found. Check the bucket id (namespace/name). If the bucket is private, make sure you are authenticated.)	bucket_idr   s    r   _format_bucket_not_foundr"   1   s!    %//**qrrr   c                     | j                   r| j                   nd}| j                  rt        | j                  j                        nd }| j                  rd| d| j                   d}nd| d}|r|d| z  }|S )Nr   zFile not found in r   '..z
URL: )r   responsestrurlr   )r   r   r(   r   s       r   _format_entry_not_foundr)   7   st    $EOOLE%*^^#enn  
!C}}"5'EMM?"="5'+
Jr   c                     | j                   r| j                   nd}| j                  rd| d| j                   dS d| dS )Nr   zRevision not found in r   r$   z. Check the revision parameter.)r   r   r   s     r   _format_revision_not_foundr+   C   sC    $EOOLE}}'wbrBB#E7*IJJr   c                     t        |       S )z%No traceback, just the error message.r'   r!   s    r   _format_cli_errorr.   J   s    u:r   c                     | j                   Wdj                  t        j                  t	        | j                         | j                   | j                   j
                              nd}| d|  S )a0  Format a CLI extension installation error.

    The error is likely to be a tricky subprocess error to investigate. In this specific case we want to format the
    traceback of the root cause while keeping the "nicely formatted" error message of the CLIExtensionInstallError
    as a 1-line message.
     
)	__cause__join	tracebackformat_exceptiontype__traceback__)r   cause_tbs     r   #_format_cli_extension_install_errorr9   O   s`     ??& 		**4+@%//SXSbSbSpSpqr 
 Zr%!!r   c                      y)Nz)Not logged in. Run 'hf auth login' first. )_s    r   <lambda>r=   d   s    r   c                     t        |       S Nr-   r!   s    r   r=   r=   f   s
    #e* r   c                     d|  S )NzInvalid value. r;   r!   s    r   r=   r=   g   s    w7 r   .CLI_ERROR_MAPPINGSc                 h    t         j                         D ]  \  }}t        | |      s ||       c S  y r?   )rA   items
isinstance)r   exc_type	formatters      r   format_known_exceptionrG   m   s9    1779 $)eX&U##$ r   )__doc__r4   typingr   r   huggingface_hub.errorsr   r   r   r   r	   r
   r   r   r   r'   r   r   r"   r)   r+   r.   r9   
ValueErrorrA   dictr6   	Exception__annotations__rG   r;   r   r   <module>rO      s+   $  %
 
 
"9 c =n = =@$7 @C @	#; 	 	K&; K KX # 
"/G "C "" &135R5,7AA Di(38*<<= )  r   