
    ڏDj$                        e efZd dlZd dlmZ 	 d dlmZ  e       Z
ddlmZ dd	lmZ dd
lmZ  G d de      Z G d de      Z G d de      Zd Zd Zd Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zd0d Zd! Zd0d"Zd# Z dZ!d$ Z"d% Z#d1d&Z$d2d'Z%d2d(Z&d) Z'd3d*Z(d+ Z)ed3d,       Z*d- Z+d. Z,d/ Z-y# e	$ r  G d d      ZY w xY w)4    N)contextmanager)localc                       e Zd Zy)_threadlocalN__name__
__module____qualname__     ZC:\Crop_Prediction\Backend\crop-ai-system\venv\Lib\site-packages\Cython/Compiler/Errors.pyr   r      s    r   r      )open_new_file   )
DebugFlags)Optionsc                       e Zd Zy)
PyrexErrorNr   r   r   r   r   r          r   r   c                       e Zd Zy)PyrexWarningNr   r   r   r   r   r      r   r   r   c                       e Zd Zy)CannotSpecializeNr   r   r   r   r   r      r   r   r   c                    | d   }t        |t              r
J d|z         	 |j                         }dj                  |t	        d| d   dz
        | d          }d|dd| d   z  d	}d}| d| d| d}|S # t
        $ r d
}Y w xY w)Nr   zOPlease replace filename strings with Scanning.FileSourceDescriptor instances %r
r      z...
 r   ^z[unprintable code]z<------------------------------------------------------------)
isinstanceany_string_type	get_linesjoinmaxUnicodeDecodeError)positionsourceFshbars        r   contextr*       s    a[F6?3 dY\bbd4
 IIaAx{1}-hqk:;hqk!23D&1#RvR AH  ! !s   A6 6BBc                 F    | rd| d   j                         | d   | d   fz  S y)Nz
%s:%d:%d: r   r   r    )get_error_description)r%   s    r   format_positionr.   1   s6    x{@@B (Xa[: : 	:r   c                 P    |r#t        |      }t        |      }d||| xs d} | S )Nz
Error compiling Cython file:
r,   )r.   r*   )messager%   pos_strconts       r   format_errorr3   7   s1    !(+x >BGW]XZ][Nr   c                       e Zd ZddZd Zy)CompileErrorNc                     || _         || _        t        ||      | _        d| _        t
        j                  | | j                         ||f| _        y )NF)r%   message_onlyr3   formatted_messagereported	Exception__init__argsselfr%   r0   s      r   r;   zCompileError.__init__@   sK     #!-gx!@4!7!78 w'	r   c                     | j                   S N)r8   )r>   s    r   __str__zCompileError.__str__J   s    %%%r   Nr,   )r   r	   r
   r;   rA   r   r   r   r5   r5   >   s    (&r   r5   c                       e Zd ZddZy)CompileWarningNc                 V    || _         t        j                  | t        |      |z          y r@   )r%   r:   r;   r.   r=   s      r   r;   zCompileWarning.__init__O   s#     4!:W!DEr   rB   r   r	   r
   r;   r   r   r   rD   rD   M   s    Fr   rD   c                       e Zd Zd Zy)InternalErrorc                 D    || _         t        j                  | d|z         y )NzInternal compiler error: %sr7   r:   r;   r>   r0   s     r   r;   zInternalError.__init__V   s%    #4!>" 	r   NrF   r   r   r   rH   rH   S   s    r   rH   c                       e Zd Zd Zy)
AbortErrorc                 D    || _         t        j                  | d|z         y )NzAbort error: %srJ   rK   s     r   r;   zAbortError.__init__^   s     #4!2W!<=r   NrF   r   r   r   rM   rM   [   s    >r   rM   c                       e Zd ZddZy)CompilerCrashNc                 $   |rd|z   }nd}|| _         |rd||}|r*dd l}|ddj                  |j                  |            z   z  }|r%|s|dz  }||j                  j
                  d|z  }t        j                  | ||       |||||f| _        y )Nr   zCompiler crash in r   z/

Compiler crash traceback from this point on:
r,   z: )	r7   	tracebackr"   	format_tb	__class__r   r5   r;   r<   )r>   posr*   r0   cause
stacktracerR   s          r   r;   zCompilerCrash.__init__d   s    WnGG#297CGD	++J789:G 45??#;#;UCCGdC1 '7E:>	r   r@   rF   r   r   r   rP   rP   b   s    ?r   rP   c                       e Zd ZdZy)NoElementTreeInstalledExceptionzcraised when the user enabled options.gdb_debug but no ElementTree
    implementation was found
    N)r   r	   r
   __doc__r   r   r   rY   rY   z   s    r   rY   c                     | t        |       t        _        nd t        _        |r%t        j                  t        _        dt        _        y d t        _        dt        _        y Nr   )r   threadlocalcython_errors_listing_filesysstderrcython_errors_echo_filecython_errors_count)pathecho_to_stderrs     r   open_listing_filere      sJ     1>t1D.15..1jj+ '(K# /3+&'K#r   c                  x    t         j                  r*t         j                  j                          d t         _        y y r@   )r]   r^   closer   r   r   close_listing_filerh      s*    --..44615. .r   c           	         t         j                  }|r|r|d   j                  |        y | j                  ry d| _        d| z  }t         j                  }|r|j                  |       t         j                  }|r|j                  |       t         xj                  d
z  c_        t        j                  rt        d      y # t        $ r( t        t        | dd      t        | dd             dz   }Y w xY w# t        $ r$ |j                  |j                  dd	             Y w xY w# t        $ r$ |j                  |j                  dd	             Y w xY w)NTz%s
r7   z[unprintable exception message]r%   r   ASCIIreplacer   zfatal errors)r]   cython_errors_stackappendr9   UnicodeEncodeErrorr3   getattrr^   writeencodera   rb   r   	fast_failrM   )err	use_stackerror_stacklinelisting_file	echo_files         r   report_errorrz      s8   11KyBs# <<SLT
 #==##D)  77	& 	''1,'^,,  " 	G^=^ _ 'Z >@BFGD	G & D""4;;w	#BCD
 & AGY ?@As5   B> C2 8D" >.C/.C/2*DD"*EEc                     | t        |      t        | |      }t        j                  rt	        |      t        |       |S r@   )rH   r5   r   debug_exception_on_errorr:   rz   )r%   r0   rt   s      r   errorr}      s>    G$$
x
)C**)C.,@Jr   c                     	 | j                  |       y # t        $ r$ | j                  |j                  dd             Y y w xY w)Nasciirl   )rq   ro   rr   )filerw   s     r   _write_file_encoder      s9    4

4 4

4;;w	234s    *A Ac                     |j                   d   sy t        | |      }d|z  }t        j                  }|rt	        ||       t        j
                  }|rt	        ||       |S )Nshow_performance_hintszperformance hint: %s
)
directivesrD   r]   r^   r   ra   )r%   r0   envwarnrw   rx   ry   s          r   performance_hintr      s]    >>23(G,D#d*D99L<.33I9d+Kr   c                     |t         k  ry t        | |      }d|z  }t        j                  }|rt	        ||       t        j
                  }|rt	        ||       |S )Nz	note: %s
)LEVELrD   r]   r^   r   ra   r%   r0   levelr   rw   rx   ry   s          r   r0   r0      sW    u}(G,D$D99L<.33I9d+Kr   c                     |t         k  ry t        j                  r| rt        | |      S t	        | |      }d|z  }t
        j                  }|rt        ||       t
        j                  }|rt        ||       |S Nzwarning: %s
)	r   r   warning_errorsr}   rD   r]   r^   r   ra   r   s          r   warningr      so    u}(Xw''(G,DT!D99L<.33I9d+Kr   c                     |t         k  ry t        j                  }||v ry t        | |      }d|z  }t        j                  }|rt        ||       t        j                  }|rt        ||       |j                  |       |S r   )r   r]   cython_errors_warn_once_seenrD   r^   r   ra   add)r%   r0   r   warn_once_seenr   rw   rx   ry   s           r   	warn_oncer      s{    u} ==N. (G,DT!D99L<.33I9d+wKr   c                  H    g } t         j                  j                  |        | S r@   )r]   rm   rn   )errorss    r   hold_errorsr      s     F##**62Mr   c                 j    t         j                  j                         }| s|D ]  }t        |        y y r@   )r]   rm   poprz   )ignoreheld_errorsrt   s      r   release_errorsr     s5    11557K 	C	 r   c                  (    t         j                  d   S )Nrj   )r]   rm   r   r   r   r   r     s    **2..r   c              #   d   K   t               }	 | t        |        y # t        |        w xY ww)N)r   )r   r   )r   r   s     r   local_errorsr     s'     ]F&f%f%s   0 0-0c                      dt         _        d t         _        d t         _        t	               t         _        g t         _        y r\   )r]   rb   r^   ra   setr   rm   r   r   r   init_threadr     s,    &'K#-1K**.K'/2uK,&(K#r   c                  f    t         j                  j                          t         j                  d d = y r@   )r]   r   clearrm   r   r   r   resetr   $  s"    ,,224''*r   c                  "    t         j                  S r@   )r]   rb   r   r   r   get_errors_countr   (  s    ***r   )T)r   )r   )F).bytesstrr    r_   
contextlibr   	threadingr   r   ImportErrorr]   Utilsr   r,   r   r   r:   r   r   r   r*   r.   r3   r5   rD   rH   rM   rP   rY   re   rh   rz   r}   r   r   r   r0   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s+  
 #, 
 %/ n !  	 		9 		z 	"&: &F\ FI > >?L ?0j 
(6
-6 	
4 (/ & &)++y  s   C C,+C,