
    5pj                        % 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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\4S jrS\S\4S jr0 \S _\
\_\\_\\_\\_\S _\S _\S _\\_\\_\\_\	S _\S _\S _\S _\\_\\_r \!\"\#   \S\4   4   \$S'   S\#S\S-  4S jr%g)zCLI error handling utilities.    N)Callable)BucketNotFoundErrorCLIErrorCLIExtensionInstallErrorDeviceCodeErrorEntryNotFoundErrorGatedRepoErrorHfHubHTTPError
HfUriErrorIncompleteSnapshotErrorLocalEntryNotFoundErrorLocalTokenNotFoundErrorOfflineModeIsEnabled	OIDCErrorRemoteEntryNotFoundErrorRepositoryNotFoundErrorRevisionNotFoundErrorerrorreturnc                 z   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S-  nU R                  bH  U R                   (       a  U R                   S:w  a  SU R                    3OS	nUS
U R                   U 3-  nU$ US-  nU$ )N
Repository '' not found.z not found.ze
If the repo is private, make sure you are authenticated and your token has the required permissions.z-
If the repo does not exist, create it with: modelz --type  zhf repos create zhf repos create <repo_id>)	repo_type
capitalizerepo_id)r   labelmsg	type_flags       W/var/www/html/pdf-tiff/venv/lib/python3.13/site-packages/huggingface_hub/cli/_errors.py_format_repo_not_foundr#   '   s    ,1OOEOO&&(E}}r%--5{#ssC;;C}} 49OO[bHbhu/0hj	!%--<< J 	**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(   9   sN    $EOOLE}} !1!1!3 4Bu}}oEYZZ!%(;<<r$   c                     U R                   (       a   SU R                    S3nSU R                    3nOSnSnUS-  nUSU 3-  nU$ )NzBucket 'r   zhf buckets create zBucket not found.zhf buckets create <bucket_id>zg
If the bucket is private, make sure you are authenticated and your token has the required permissions.z/
If the bucket does not exist, create it with: )	bucket_id)r   r    cmds      r"   _format_bucket_not_foundr,   @   sY    )6"5??"34!-uuC=cUCCCJr$   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   r2   r    s       r"   _format_entry_not_foundr3   L   st    $EOOLE%*^^#enn  
!C}}"5'EMM?"="5'+
Jr$   c                 4    U R                   nUb  SU 3$ SU  3$ )NzLocal entry not found. )	__cause__)r   causes     r"   _format_local_entry_not_foundr7   X   s+    OOE(00$UG,,r$   c                 @    [        U 5      nUSU R                   3-  nU$ )Nz#
Incomplete snapshot available at: )r7   snapshot_path)r   r    s     r"   _format_incomplete_snapshotr:   _   s*    
'
.C1%2E2E1FGGC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<   e   sC    $EOOLE}}'wbrBB#E7*IJJr$   c                     [        U 5      $ )z%No traceback, just the error message.r1   r   s    r"   _format_cli_errorr@   l   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.
r   
)r5   join	tracebackformat_exceptiontype__traceback__)r   cause_tbs     r"   #_format_cli_extension_install_errorrI   q   s`     ??& 		**4+@%//SXSbSbSpSpqr 
 Zr%!!r$   c                     [        U 5      $ Nr>   r?   s    r"   <lambda>rL      s    E
r$   c                     g)Nz)Not logged in. Run 'hf auth login' first. )_s    r"   rL   rL      s    'Rr$   c                     SU  3$ )NzOIDC Exchange failed. rN   r?   s    r"   rL   rL      s    5eW=r$   c                     SU  3$ )NzLogin failed: rN   r?   s    r"   rL   rL      s    ^E7#;r$   c                     [        U 5      $ rK   r>   r?   s    r"   rL   rL      s    c%jr$   c                     [        U 5      $ rK   r>   r?   s    r"   rL   rL      s    #e*r$   c                 :    SU R                    SU R                   3$ )NzInvalid HF URI: z. )urir    r?   s    r"   rL   rL      s     02eii[Ir$   c                     SU  3$ )NzInvalid value. rN   r?   s    r"   rL   rL      s    w7r$   .CLI_ERROR_MAPPINGSc                 r    [         R                  5        H  u  p[        X5      (       d  M  U" U 5      s  $    g rK   )rW   items
isinstance)r   exc_type	formatters      r"   format_known_exceptionr]      s3    1779e&&U##  : r$   )&__doc__rD   collections.abcr   huggingface_hub.errorsr   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r1   r#   r(   r,   r3   r7   r:   r<   r@   rI   
ValueErrorrW   dictrF   	Exception__annotations__r]   rN   r$   r"   <module>re      s   $  $    ("9 c $=n = =	$7 	C 		#; 	 	-)@ -S -'> 3 K&; K KX # 
"/G "C "A2A &A 1	A
 3A 5A RA =A ;A 5A 8A :A 0A ,A  I!A" 7#A$ A%A& 'A Di(38*<<= .) d
 r$   