o
    1j`                     @   s
  d dl Z d dlZd dlmZ d dlmZ g dZG dd deZG dd deZ	G d	d
 d
eZ
G dd deZG dd deZG dd deZG dd deZG dd deZG dd deZd$ddZd$ddZd$ddZdd Zd$dd Zd!eeef fd"d#ZdS )%    N)Path)Union)UnsupportedAPIErrorUnsupportedParamErrorKeyNotFoundErrorClassNotFoundExceptionNoEntityRegisteredExceptionUnsupportedDeviceErrorCalledProcessErrorModelNotFoundErrorDuplicateRegistrationError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_errorc                   @      e Zd Zd ZdS )r   N__name__
__module____qualname____doc__ r   r   \/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/paddlex/utils/errors/others.pyr   '       r   c                   @   r   )r   Nr   r   r   r   r   r   +   r   r   c                   @   r   )r   Nr   r   r   r   r   r   /   r   r   c                   @   r   )r   Nr   r   r   r   r   r   3   r   r   c                   @   r   )r   Nr   r   r   r   r   r   7   r   r   c                   @   r   )r	   Nr   r   r   r   r   r	   ;   r   r	   c                       s*   e Zd Zd Zd fdd	Zdd Z  ZS )r
   Nc                    s&   t    || _|| _|| _|| _d S N)super__init__
returncodecmdoutputstderr)selfr   r    r!   r"   	__class__r   r   r   B   s
   

zCalledProcessError.__init__c                 C   s   | j r4| j dk r4zdt| j dtt| j   dW S  ty3   dt| j d| j   d Y S w dt| j d| j  dS )Nr   zCommand z died with .z died with unknown signal z returned non-zero exit status )r   reprr    signalSignals
ValueError)r#   r   r   r   __str__I   s   ( zCalledProcessError.__str__)NN)r   r   r   r   r   r+   __classcell__r   r   r$   r   r
   ?   s    r
   c                   @   r   )r   Nr   r   r   r   r   r   S   r   r   c                   @   s   e Zd ZdZdS )r   zModel Not Found ErrorNr   r   r   r   r   r   W   r   r   c                 C   s.   |dur|j  d|  }n| }td| d)zraise unsupported api errorNr&   z	The API `z` is not supported.)r   r   )Zapi_nameclsnamer   r   r   r   [   s   r   c                 C   s6   d|  d}|rt j|ddd}|d| 7 }t|)zraise key not found error`z` not found in config.   F)indentensure_asciiz
The content of config:
)jsondumpsr   )keyconfigmsgZ
config_strr   r   r   r   e   s
   r   c                 C   sB   |j }d|  d| d}|durd|}|d| d7 }t|)zraise class not found errorr/   z` is not registered on r&   Nz,  z
The registied entities: [])r   joinr   )cls_namebase_clsZall_entitiesbase_cls_namer7   Zall_entities_strr   r   r   r   n   s   
r   c                 C   s   | j }d| d}t|)z raise no entity registered errorzThere no entity register on z+. Hint: Maybe the subclass is not imported.)r   r   )r;   r<   r7   r   r   r   r   x   s   r   c                 C   s6   d|  d}|durd |}|d| d7 }t|)r   zThe device `z` is not supported! Nz, z!The supported device types are: [z].)r9   r	   )ZdeviceZsupported_devicer7   Zsupported_device_strr   r   r   r      s
   
r   
model_pathc                 C   s   d|  d}t |)z_raise ModelNotFoundError

    Args:
        model_path (str|Path): the path to model file.
    zThe model file(s)(`z`) is not found.)r   )r=   r7   r   r   r   r      s   r   r   )r3   r(   pathlibr   typingr   __all__	Exceptionr   r   r   r   r   r	   r
   r   r   r   r   r   r   r   strr   r   r   r   r   <module>   s(   



	

	