o
    j#                     @   s  e efZd dlZd dlmZ zd dlmZ W n e	y&   G dd dZY nw e Z
ddlmZ dd	lmZ dd
lmZ G dd deZG dd deZG dd deZdd Zdd Zd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dEd$d%Zd&d' ZdEd(d)Zd*d+ Z dZ!d,d- Z"d.d/ Z#dFd0d1Z$dGd2d3Z%dGd4d5Z&d6d7 Z'dHd9d:Z(d;d< Z)edHd=d>Z*d?d@ Z+dAdB Z,dCdD Z-dS )I    N)contextmanager)localc                   @      e Zd ZdS )_threadlocalN__name__
__module____qualname__ r
   r
   W/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/Cython/Compiler/Errors.pyr      s    r      )open_new_file   )
DebugFlags)Optionsc                   @   r   )
PyrexErrorNr   r
   r
   r
   r   r          r   c                   @   r   )PyrexWarningNr   r
   r
   r
   r   r      r   r   c                   @   r   )CannotSpecializeNr   r
   r
   r
   r   r      r   r   c                 C   s   | d }t |trJ d| z| }W n ty    d}Y nw d|td| d d | d  }d|d| d	  f }d
}| d| d| d}|S )Nr   zOPlease replace filename strings with Scanning.FileSourceDescriptor instances %rz[unprintable code]
r      z
...
%s
%s^ r   z<------------------------------------------------------------)
isinstanceany_string_type	get_linesUnicodeDecodeErrorjoinmax)positionsourceFsZhbarr
   r
   r   context    s   $r"   c                 C   s&   | rd| d   | d | d f S dS )Nz
%s:%d:%d: r   r   r    )Zget_error_description)r   r
   r
   r   format_position1   s
   r$   c                 C   s*   |rt |}t|}d||| pdf } | S )Nz$
Error compiling Cython file:
%s%s%sr#   )r$   r"   )messager   Zpos_strcontr
   r
   r   format_error7   s
   r'   c                   @   s   e Zd ZdddZdd ZdS )CompileErrorNr#   c                 C   s:   || _ || _t||| _d| _t| | j ||f| _d S )NF)r   message_onlyr'   formatted_messagereported	Exception__init__argsselfr   r%   r
   r
   r   r-   @   s   zCompileError.__init__c                 C   s   | j S N)r*   )r0   r
   r
   r   __str__J      zCompileError.__str__Nr#   )r   r   r	   r-   r2   r
   r
   r
   r   r(   >   s    

r(   c                   @   s   e Zd ZdddZdS )CompileWarningNr#   c                 C   s   || _ t| t||  d S r1   )r   r,   r-   r$   r/   r
   r
   r   r-   O   s   zCompileWarning.__init__r4   r   r   r	   r-   r
   r
   r
   r   r5   M       r5   c                   @      e Zd Zdd ZdS )InternalErrorc                 C      || _ t| d|  d S )NzInternal compiler error: %sr)   r,   r-   r0   r%   r
   r
   r   r-   V   s   
zInternalError.__init__Nr6   r
   r
   r
   r   r9   S       r9   c                   @   r8   )
AbortErrorc                 C   r:   )NzAbort error: %sr;   r<   r
   r
   r   r-   ^   s   zAbortError.__init__Nr6   r
   r
   r
   r   r>   [   r=   r>   c                   @   s   e Zd ZdddZdS )CompilerCrashNc                 C   s   |rd| }nd}|| _ |rd||f }|r&dd l}|dd|| 7 }|r8|s.|d7 }|d|jj|f 7 }t| || |||||f| _d S )Nr   zCompiler crash in %s%sr   z/

Compiler crash traceback from this point on:
r#   z%s: %s)	r)   	tracebackr   	format_tb	__class__r   r(   r-   r.   )r0   posr"   r%   causeZ
stacktracer@   r
   r
   r   r-   d   s&   
zCompilerCrash.__init__r1   r6   r
   r
   r
   r   r?   b   r7   r?   c                   @   s   e Zd ZdZdS )NoElementTreeInstalledExceptionzcraised when the user enabled options.gdb_debug but no ElementTree
    implementation was found
    N)r   r   r	   __doc__r
   r
   r
   r   rE   z   s    rE   Tc                 C   s8   | d ur
t | t_nd t_|rtjt_nd t_dt_d S Nr   )r   threadlocalcython_errors_listing_filesysstderrcython_errors_echo_filecython_errors_count)pathZecho_to_stderrr
   r
   r   open_listing_file   s   

rO   c                   C   s   t jrt j  d t _d S d S r1   )rH   rI   closer
   r
   r
   r   close_listing_file   s   

rQ   c              	   C   s
  t j}|r|r|d |  d S | jrd S d| _zd|  }W n ty6   tt| ddt| dd d }Y nw t j}|rVz|| W n tyU   ||	dd	 Y nw t j
}|ruz|| W n tyt   ||	dd	 Y nw t  jd
7  _tjrtdd S )NTz%s
r)   z[unprintable exception message]r   r   ASCIIreplacer   zfatal errors)rH   cython_errors_stackappendr+   UnicodeEncodeErrorr'   getattrrI   writeencoderL   rM   r   Z	fast_failr>   )errZ	use_stackZerror_stacklinelisting_file	echo_filer
   r
   r   report_error   s:   

r_   c                 C   s4   | d u rt |t| |}tjrt|t| |S r1   )r9   r(   r   Zdebug_exception_on_errorr,   r_   )r   r%   r[   r
   r
   r   error   s   
r`   c              	   C   s8   z|  | W d S  ty   |  |dd Y d S w )NasciirT   )rY   rW   rZ   )filer\   r
   r
   r   _write_file_encode   s
   rc   c                 C   sL   |j d sd S t| |}d| }tj}|rt|| tj}|r$t|| |S )NZshow_performance_hintszperformance hint: %s
)Z
directivesr5   rH   rI   rc   rL   )r   r%   envwarnr\   r]   r^   r
   r
   r   performance_hint   s   



rf   c                 C   sJ   |t k rd S t| |}d| }tj}|rt|| tj}|r#t|| |S )Nz	note: %s
)LEVELr5   rH   rI   rc   rL   r   r%   levelre   r\   r]   r^   r
   r
   r   r%      s   


r%   c                 C   s^   |t k rd S tjr| rt| |S t| |}d| }tj}|r#t|| tj}|r-t|| |S Nzwarning: %s
)	rg   r   Zwarning_errorsr`   r5   rH   rI   rc   rL   rh   r
   r
   r   warning   s   




rk   c                 C   sf   |t k rd S tj}||v rd S t| |}d| }tj}|r"t|| tj}|r,t|| || |S rj   )rg   rH   cython_errors_warn_once_seenr5   rI   rc   rL   add)r   r%   ri   Zwarn_once_seenre   r\   r]   r^   r
   r
   r   	warn_once   s   



rn   c                  C   s   g } t j|  | S r1   )rH   rU   rV   )errorsr
   r
   r   hold_errors   s   rp   Fc                 C   s(   t j }| s|D ]}t| q	d S d S r1   )rH   rU   popr_   )ignoreheld_errorsr[   r
   r
   r   release_errors  s   

rt   c                   C   s
   t jd S )NrR   )rH   rU   r
   r
   r
   r   rs     s   
rs   c              	   c   s,    t  }z|V  W t| d d S t| d w )N)rr   )rp   rt   )rr   ro   r
   r
   r   local_errors  s
   ru   c                   C   s$   dt _d t _d t _t t _g t _d S rG   )rH   rM   rI   rL   setrl   rU   r
   r
   r
   r   init_thread  s
   
rw   c                   C   s   t j  t jd d = d S r1   )rH   rl   clearrU   r
   r
   r
   r   reset$  s   
ry   c                   C   s   t jS r1   )rH   rM   r
   r
   r
   r   get_errors_count(  r3   rz   )T)r   )r   )F).bytesstrr   rJ   
contextlibr   	threadingr   r   ImportErrorrH   ZUtilsr   r#   r   r   r,   r   r   r   r"   r$   r'   r(   r5   r9   r>   r?   rE   rO   rQ   r_   r`   rg   rc   rf   r%   rk   rn   rp   rt   rs   ru   rw   ry   rz   r
   r
   r
   r   <module>   sT   







