
    9i                     @   S SK r S SKrS SKJr  S SKJr  / SQr " S S\5      r " S S\5      r	 " S	 S
\5      r
 " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      rSS jrSS jrSS jrS rSS jrS\\\4   4S jrg)    N)Path)Union)
UnsupportedAPIErrorUnsupportedParamErrorCalledProcessErrorraise_unsupported_api_errorraise_key_not_found_errorraise_class_not_found_error raise_no_entity_registered_errorraise_unsupported_device_errorraise_model_not_found_errorDuplicateRegistrationErrorc                       \ rS rSrS rSrg)r   "    N__name__
__module____qualname____firstlineno____doc____static_attributes__r       [/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/paddlex/utils/errors/others.pyr   r   "   s    r   r   c                       \ rS rSrS rSrg)r   &   r   Nr   r   r   r   r   r   &       r   r   c                       \ rS rSrS rSrg)KeyNotFoundError*   r   Nr   r   r   r   r   r   *   s    r   r   c                       \ rS rSrS rSrg)ClassNotFoundException.   r   Nr   r   r   r   r"   r"   .        r   r"   c                       \ rS rSrS rSrg)NoEntityRegisteredException2   r   Nr   r   r   r   r&   r&   2   s    %r   r&   c                       \ rS rSrS rSrg)UnsupportedDeviceError6   r   Nr   r   r   r   r)   r)   6   r$   r   r)   c                   6   ^  \ rS rSrS rSU 4S jjrS rSrU =r$ )r   :   c                 R   > [         TU ]  5         Xl        X l        X0l        X@l        g N)super__init__
returncodecmdoutputstderr)selfr1   r2   r3   r4   	__class__s        r   r0   CalledProcessError.__init__=   s"    $r   c                    U R                   (       aU  U R                   S:  aE   S[        U R                  5       S[        [        R                  " U R                   * 5      5       S3$ S[        U R                  5       SU R                    S3$ ! [
         a*    S[        U R                  5       SU R                   *  S3s $ f = f)Nr   zCommand z died with .z died with unknown signal z returned non-zero exit status )r1   reprr2   signalSignals
ValueError)r5   s    r   __str__CalledProcessError.__str__D   s    ??t2`!$txx.!1T&..RVRaRaQaBb=c<ddeff d488n--LT__L]]^__  `!$txx.!11KT__L\K]]^__`s   AB 1C C)r2   r3   r1   r4   )NN)	r   r   r   r   r   r0   r>   r   __classcell__)r6   s   @r   r   r   :   s    ` `r   r   c                       \ rS rSrS rSrg)r   N   r   Nr   r   r   r   r   r   N   s    $r   r   c                       \ rS rSrSrSrg)ModelNotFoundErrorR   zModel Not Found Errorr   Nr   r   r   r   rD   rD   R   r   r   rD   c                 N    Ub  UR                    SU  3nOU n[        SU S35      e)zraise unsupported api errorr9   z	The API `z` is not supported.)r   r   )api_nameclsnames      r   r   r   V   s7     ,,q
+
	$/BC
DDr   c                 n    SU  S3nU(       a  [         R                  " USSS9nUSU 3-  n[        U5      e)zraise key not found error`z` not found in config.   F)indentensure_asciiz
The content of config:
)jsondumpsr   )keyconfigmsg
config_strs       r   r	   r	   `   sC    cU(
)CZZquE
+J<88
3
r   c                 |    UR                   nSU  SU S3nUb  SR                  U5      nUSU S3-  n[        U5      e)zraise class not found errorrK   z` is not registered on r9   z,  z
The registied entities: [])r   joinr"   )cls_namebase_clsall_entitiesbase_cls_namerS   all_entities_strs         r   r
   r
   i   sX    %%MhZ.}oQ
?C ::l3,-=,>a@@
 
%%r   c                 <    U R                   nSU S3n[        U5      e)z raise no entity registered errorzThere no entity register on z+. Hint: Maybe the subclass is not imported.)r   r&   )rY   r[   rS   s      r   r   r   s   s'    %%M(7b
cC
%c
**r   c                 ^    SU  S3nUb  SR                  U5      nUSU S3-  n[        U5      e)r   zThe device `z` is not supported! z, z!The supported device types are: [z].)rW   r)   )devicesupported_devicerS   supported_device_strs       r   r   r   z   sH     4
5C##yy)9:23G2HKK
 
%%r   
model_pathc                 $    SU  S3n[        U5      e)zSraise ModelNotFoundError

Args:
    model_path (str|Path): the path to model file.
zThe model file(s)(`z`) is not found.)rD   )rb   rS   s     r   r   r      s      
|+;
<C
S
!!r   r.   )rO   r;   pathlibr   typingr   __all__	Exceptionr   r   r   r"   r&   r)   r   r   rD   r   r	   r
   r   r   strr   r   r   r   <module>ri      s       )  I  y !Y !&) &!Y !` `(% %   E &+&"E#t),< "r   