U
    ®9%e‚  ã                   @   sL   d dl Z d dlmZmZ G dd„ deƒZG dd„ deƒZG dd„ deƒZdS )	é    N)ÚOptionalÚUnionc                   @   sh   e Zd ZdZedœdd„Zee eje	edf dœdd„Z
ee d	œd
d„Zdd„ Zdd„ Zdd„ ZdS )ÚCompilationErroré   )Úreturnc                 C   sŠ   | j }| jd krd}nJ| j d¡d |j… | j d … }|r\| d|j d ¡ d |¡}nd}d |j|j|¡}| j	r†|d| j	 7 }|S )Nz <source unavailable>Ú
ú ú^z <source empty>zat {}:{}:{})
ÚnodeÚsrcÚsplitÚlinenoÚ source_line_count_max_in_messageÚappendÚ
col_offsetÚjoinÚformatÚerror_message)Úselfr
   Zsource_excerptÚmessage© r   úU/var/www/html/Darija-Ai-API/env/lib/python3.8/site-packages/triton/compiler/errors.pyÚ_format_message   s    
"z CompilationError._format_messageN)r   r
   r   c                 C   s    || _ || _|| _|  ¡ | _d S ©N)r   r
   r   r   r   )r   r   r
   r   r   r   r   Ú__init__   s    zCompilationError.__init__)r   c                 C   s   || _ |  ¡ | _d S r   )r   r   r   )r   r   r   r   r   Úset_source_code   s    z CompilationError.set_source_codec                 C   s   | j S r   )r   ©r   r   r   r   Ú__str__#   s    zCompilationError.__str__c                 C   s   d  t| ƒj| j¡S )Nz{}({!r}))r   ÚtypeÚ__name__r   r   r   r   r   Ú__repr__&   s    zCompilationError.__repr__c                 C   s   t | ƒ| j| j| jffS r   )r   r   r
   r   r   r   r   r   Ú
__reduce__)   s    zCompilationError.__reduce__)r   Ú
__module__Ú__qualname__r   Ústrr   r   ÚastÚASTr   r   r   r   r    r!   r   r   r   r   r      s    r   c                   @   s   e Zd ZdZdS )ÚCompileTimeAssertionFailurezBSpecific exception for failed tests in `static_assert` invocationsN)r   r"   r#   Ú__doc__r   r   r   r   r'   .   s   r'   c                   @   s   e Zd ZdS )ÚUnsupportedLanguageConstructN)r   r"   r#   r   r   r   r   r)   3   s   r)   )r%   Útypingr   r   Ú	Exceptionr   r'   r)   r   r   r   r   Ú<module>   s   )