
    Y j                     @   % S r SSKrSSKJr  SSKJrJrJrJrJ	r	J
r
JrJrJrJr  S\S\4S jrS\	S\4S jrS\S\4S	 jrS\S\4S
 jrS\S\4S jrS\S\4S jrS\S\4S jr\	\\\\\\\\S \\\S \
S \S \\\\0r\\\   \S\4   4   \S'   S\S\S-  4S jrg)zCLI error handling utilities.    N)Callable)
BucketNotFoundErrorCLIErrorCLIExtensionInstallErrorEntryNotFoundErrorGatedRepoErrorHfHubHTTPErrorLocalTokenNotFoundErrorRemoteEntryNotFoundErrorRepositoryNotFoundErrorRevisionNotFoundErrorerrorreturnc                     U R                   (       a  U R                   R                  5       OSnU R                  (       a  U SU R                   S3nOU S3nUS-  nU$ )N
Repository 'z' not found.z not found.ze If the repo is private, make sure you are authenticated and your token has the required permissions.)	repo_type
capitalizerepo_id)r   labelmsgs      l/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/huggingface_hub/cli/_errors.py_format_repo_not_foundr   !   sU    ,1OOEOO&&(E}}r%--5{#rrCJ    c                     U R                   (       a  U R                   OSnU R                  (       a!  SUR                  5        SU R                   S3$ SU S3$ )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                 F    U R                   (       a  SU R                    S3$ g)NzBucket 'zs' not found. If the bucket is private, make sure you are authenticated and your token has the required permissions.zBucket not found. Check the bucket id (namespace/name). If the bucket is private, make sure you are authenticated and your token has the required permissions.)	bucket_idr   s    r   _format_bucket_not_foundr"   2   s-    %//*  +^  _  	_ lr   c                    U R                   (       a  U R                   OSnU R                  (       a  [        U R                  R                  5      OS nU R                  (       a  SU SU R                   S3nOSU S3nU(       a  USU 3-  nU$ )Nr   zFile not found in r   '..z
URL: )r   responsestrurlr   )r   r   r(   r   s       r   _format_entry_not_foundr)   8   st    $EOOLE%*^^#enn  
!C}}"5'EMM?"="5'+
Jr   c                     U R                   (       a  U R                   OSnU R                  (       a  SU SU R                   S3$ SU S3$ )Nr   zRevision not found in r   r$   z. Check the revision parameter.)r   r   r   s     r   _format_revision_not_foundr+   D   sC    $EOOLE}}'wbrBB#E7*IJJr   c                     [        U 5      $ )z%No traceback, just the error message.r'   r!   s    r   _format_cli_errorr.   K   s    u:r   c                     U R                   bX  SR                  [        R                  " [	        U R                   5      U R                   U R                   R
                  5      5      OSnU SU  3$ )a   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   P   s`     ??& 		**4+@%//SXSbSbSpSpqr 
 Zr%!!r   c                     g)Nz)Not logged in. Run 'hf auth login' first. )_s    r   <lambda>r=   e   s    'Rr   c                     [        U 5      $ Nr-   r!   s    r   r=   r=   g   s    c%jr   c                     [        U 5      $ r?   r-   r!   s    r   r=   r=   h   s    #e*r   c                     SU  3$ )NzInvalid value. r;   r!   s    r   r=   r=   i   s    w7r   .CLI_ERROR_MAPPINGSc                 r    [         R                  5        H  u  p[        X5      (       d  M  U" U 5      s  $    g r?   )rB   items
isinstance)r   exc_type	formatters      r   format_known_exceptionrH   o   s3    1779e&&U##  : r   )__doc__r4   collections.abcr   huggingface_hub.errorsr   r   r   r   r   r	   r
   r   r   r   r'   r   r   r"   r)   r+   r.   r9   
ValueErrorrB   dictr6   	Exception__annotations__rH   r;   r   r   <module>rP      s1   $  $  "9 c =n = =l$7 lC l	#; 	 	K&; K KX # 
"/G "C "" &135R50,7AA Di(38*<<=  ) d
 r   