
    -Ph#                     *   e efZd dlZd dlmZ 	 d dlmZ n# e	$ r  G d d          ZY nw xY w 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d2d!Zd" Zd2d#Zd$ Z dZ!d% Z"d& Z#d3d'Z$d4d(Z%d4d)Z&d* Z'd5d,Z(d- Z)ed5d.            Z*d/ Z+d0 Z,d1 Z-dS )6    N)contextmanager)localc                       e Zd ZdS )_threadlocalN__name__
__module____qualname__     V/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/Cython/Compiler/Errors.pyr   r      s          r   r      )open_new_file   )
DebugFlags)Optionsc                       e Zd ZdS )
PyrexErrorNr   r   r   r   r   r              Dr   r   c                       e Zd ZdS )PyrexWarningNr   r   r   r   r   r      r   r   r   c                       e Zd ZdS )CannotSpecializeNr   r   r   r   r   r      r   r   r   c                 T   | d         }t          |t                    rJ d|z              	 |                                }d                    |t	          d| d         dz
            | d                            }d|d| d         z  d	}n# t
          $ r d
}Y nw xY wdd|dd}|S )Nr   zOPlease replace filename strings with Scanning.FileSourceDescriptor instances %r r      z...
 r   z^
z[unprintable code]
z<------------------------------------------------------------
)
isinstanceany_string_type	get_linesjoinmaxUnicodeDecodeError)positionsourceFss       r   contextr)       s    a[F6?33 d dY\bbd d d4
 GGAc!Xa[]++HQK7899ahqk!2!2!23  # # #"# 666*AHs   B BBc                 b    | r,d| d                                          | d         | d         fz  S dS )Nz
%s:%d:%d: r   r   r   r   )get_error_description)r%   s    r   format_positionr,   /   s@     :x{@@BB (Xa[: : 	:2r   c                 ^    |r*t          |          }t          |          }d|d|| pd} | S )Nz
Error compiling Cython file:
r   r   )r,   r)   )messager%   pos_strconts       r   format_errorr1   5   sE     ^!(++x  @Dggw}Z\}]Nr   c                       e Zd ZddZd ZdS )CompileErrorNr   c                     || _         || _        t          ||          | _        d| _        t
                              | | j                   ||f| _        d S )NF)r%   message_onlyr1   formatted_messagereported	Exception__init__argsselfr%   r.   s      r   r9   zCompileError.__init__>   sU     #!-gx!@!@4!7888 w'			r   c                     | j         S N)r6   )r<   s    r   __str__zCompileError.__str__H   s    %%r   Nr   )r   r	   r
   r9   r?   r   r   r   r3   r3   <   s7        ( ( ( (& & & & &r   r3   c                       e Zd ZddZdS )CompileWarningNr   c                 j    || _         t                              | t          |          |z              d S r>   )r%   r8   r9   r,   r;   s      r   r9   zCompileWarning.__init__M   s2     4!:!:W!DEEEEEr   r@   r   r	   r
   r9   r   r   r   rB   rB   K   s.        F F F F F Fr   rB   c                       e Zd Zd ZdS )InternalErrorc                 P    || _         t                              | d|z             d S )NzInternal compiler error: %sr5   r8   r9   r<   r.   s     r   r9   zInternalError.__init__T   s9    #4!>" 	 	 	 	 	r   NrD   r   r   r   rF   rF   Q   s#            r   rF   c                       e Zd Zd ZdS )
AbortErrorc                 P    || _         t                              | d|z             d S )NzAbort error: %srH   rI   s     r   r9   zAbortError.__init__\   s,    #4!2W!<=====r   NrD   r   r   r   rK   rK   Y   s#        > > > > >r   rK   c                       e Zd ZddZdS )CompilerCrashNc                 ,   |rd|z   }nd}|| _         |rd||}|r2dd l}|dd                    |                    |                    z   z  }|r|s|dz  }||j        j        d|z  }t                              | ||           |||||f| _        d S )Nr   zCompiler crash in r   z/

Compiler crash traceback from this point on:
r   z: )	r5   	tracebackr"   	format_tb	__class__r   r3   r9   r:   )r<   posr)   r.   cause
stacktracerP   s          r   r9   zCompilerCrash.__init__b   s     	WnGGG# 	D 	D29'77CG 	:D	++J77889:G  	D  45?#;#;#;UUCCGdC111 '7E:>			r   r>   rD   r   r   r   rN   rN   `   s(        ? ? ? ? ? ?r   rN   c                       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   rW   rW   x   s           r   rW   Tc                     | 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)pathecho_to_stderrs     r   open_listing_filerc   }   sP     1>t1D1D..15. 3.1j++.2+&'K###r   c                  v    t           j        r,t           j                                         d t           _        d S d S r>   )r[   r\   closer   r   r   close_listing_filerf      s:    - 6.4466615...6 6r   c           	         t           j        }|r|r|d                             |            d S | j        rd S d| _        d| z  }nA# t          $ r4 t          t          | dd          t          | dd                     dz   }Y nw xY wt           j        }|rO|                    |           n9# t          $ r, |                    |	                    dd	                     Y nw xY wt           j
        }|rO|                    |           n9# t          $ r, |                    |	                    dd	                     Y nw xY wt           xj        d
z  c_        t          j        rt          d          d S )NTz%s
r5   z[unprintable exception message]r%   r   ASCIIreplacer   zfatal errors)r[   cython_errors_stackappendr7   UnicodeEncodeErrorr1   getattrr\   writeencoder_   r`   r   	fast_failrK   )err	use_stackerror_stacklinelisting_file	echo_files         r   report_errorrx      s   1K -y -Bs##### <SLTT! 	G 	G 	G^=^ _ _ 'Z > >@ @BFGDDD	G #= 	D##D))))% D D D""4;;w	#B#BCCCCCD7	 	A&&&&% A A AGY ? ?@@@@@A''1,'' 	-^,,,	- 	-s5   A ;BBB) )3CC0D 3D<;D<c                     | t          |          t          | |          }t          j        rt	          |          t          |           |S r>   )rF   r3   r   debug_exception_on_errorr8   rx   )r%   r.   rr   s      r   errorr{      sL    G$$$
x
)
)C*@)C..,@Jr   c                     	 |                      |           d S # t          $ r- |                      |                    dd                     Y d S w xY w)Nasciirj   )ro   rm   rp   )fileru   s     r   _write_file_encoder      sc    4

4 4 4 4

4;;w	223333334s    3AAc                     |j         d         sd S t          | |          }d|z  }t          j        }|rt	          ||           t          j        }|rt	          ||           |S )Nshow_performance_hintszperformance hint: %s
)
directivesrB   r[   r\   r   r_   )r%   r.   envwarnru   rv   rw   s          r   performance_hintr      su    >23 (G,,D#d*D9L /<...3I ,9d+++Kr   c                     |t           k     rd S t          | |          }d|z  }t          j        }|rt	          ||           t          j        }|rt	          ||           |S )Nz	note: %s
)LEVELrB   r[   r\   r   r_   r%   r.   levelr   ru   rv   rw   s          r   r.   r.      sn    u}}(G,,D$D9L /<...3I ,9d+++Kr   c                     |t           k     rd S 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{   rB   r[   r\   r   r_   r   s          r   warningr      s    u}} (( (Xw'''(G,,DT!D9L /<...3I ,9d+++Kr   c                    |t           k     rd S t          j        }||v rd S t          | |          }d|z  }t          j        }|rt          ||           t          j        }|rt          ||           |                    |           |S r   )r   r[   cython_errors_warn_once_seenrB   r\   r   r_   add)r%   r.   r   warn_once_seenr   ru   rv   rw   s           r   	warn_oncer      s    u}} =N.  (G,,DT!D9L /<...3I ,9d+++wKr   c                  H    g } t           j                            |            | S r>   )r[   rk   rl   )errorss    r   hold_errorsr      s#    F#**6222Mr   Fc                 r    t           j                                        }| s|D ]}t          |           d S d S r>   )r[   rk   poprx   )ignoreheld_errorsrr   s      r   release_errorsr     sR    15577K  	 	C 	 	r   c                  &    t           j        d         S )Nrh   )r[   rk   r   r   r   r   r   
  s    *2..r   c              #   z   K   t                      }	 |V  t          |            d S # t          |            w xY w)N)r   )r   r   )r   r   s     r   local_errorsr     sK      ]]F&f%%%%%%f%%%%%s   ( :c                      dt           _        d t           _        d t           _        t	                      t           _        g t           _        d S rZ   )r[   r`   r\   r_   setr   rk   r   r   r   init_threadr     s4    &'K#-1K**.K'/2uuK,&(K###r   c                  `    t           j                                         t           j        d d = d S r>   )r[   r   clearrk   r   r   r   resetr   "  s,    ,22444'***r   c                      t           j        S r>   )r[   r`   r   r   r   get_errors_countr   &  s    **r   )T)r   )r   )F).bytesstrr    r]   
contextlibr   	threadingr   r   ImportErrorr[   Utilsr   r   r   r   r8   r   r   r   r)   r,   r1   r3   rB   rF   rK   rN   rW   rc   rf   rx   r{   r   r   r   r.   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      s  
 #, 



 % % % % % %///////    lnn ! ! ! ! ! !            	 	 	 	 	 	 	 		 	 	 	 	9 	 	 		 	 	 	 	z 	 	 	      & & & & &: & & &F F F F F\ F F F    I   > > > > > > > >? ? ? ? ?L ? ? ?0    j   
( ( ( (6 6 6
- - - -6   	
4 4 4            (     / / / & & & &) ) )+ + ++ + + + +s    ,,