o
    1j                     @   s:   d dl Z d dlZd dlZddlmZ dd ZdddZdS )	    N   )write_json_filec                    s    fdd}|S )z
try-exceptc              
      s   z | g|R i |}|rt d| j| j|d W d S W d S  tyI   t \}}}t d| j| jt|t|d t||| t	d Y d S w )NT)result_dictFerr_typeerr_msgr   )
save_result_mode_output	Exceptionsysexc_infostr	tracebackprint_exceptionexit)selfargskwargsresultexc_type	exc_valueexc_tbfunc [/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/paddlex/utils/result_saver.pywrap   s"   z"try_except_decorator.<locals>.wrapr   )r   r   r   r   r   try_except_decorator   s   r   c                 C   s   d| i}| s|du r|dur|dusJ | ||d n|dur)|du r)|du s+J | | tj|s=tj|dd t|tj|| ddd dS )	zformat, build and save resultZ	done_flagNr   T)exist_okz_result.json   )indent)updateospathexistsmakedirsr   join)Zrun_passmodeoutputr   r   r   Z	json_datar   r   r   r   .   s   
"r   )NNN)r#   r   r   Zfile_interfacer   r   r   r   r   r   r   <module>   s   