o
    oÇhÄ  ã                   @   sT   d dl 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S )é    N)ÚOptionalé   )ÚTritonErrorc                   @   sT   e Zd ZdZdZdefdd„Zddee dej	d	ee fd
d„Z
dd„ Zdd„ ZdS )ÚCompilationErrorz3Base class for all errors raised during compilationé   Úreturnc                 C   sª   | j }| jd u rd}n.t|dƒr6| j d¡d |j… | j d … }|r3| d|j d ¡ d |¡}nd}n| j}t|dƒrGd 	|j|j|¡n|}| j
rS|d| j
 7 }|S )Nz <source unavailable>ÚlinenoÚ
ú ú^z <source empty>zat {}:{}:
{})ÚnodeÚsrcÚhasattrÚsplitr   Ú source_line_count_max_in_messageÚappendÚ
col_offsetÚjoinÚformatÚerror_message)Úselfr   Úsource_excerptÚmessage© r   új/var/www/html/construction_image-detection-poc/venv/lib/python3.10/site-packages/triton/compiler/errors.pyÚ_format_message
   s$   

"ÿÿz CompilationError._format_messageNr   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__c                 C   s   | j S r   )r   ©r   r   r   r   Ú__str__%   s   zCompilationError.__str__c                 C   s   t | ƒ| j| j| jffS r   )Útyper   r   r   r   r   r   r   Ú
__reduce__(   s   zCompilationError.__reduce__r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ústrr   r   ÚastÚASTr   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$   r%   r   r   r   r   r)   -   s    r)   c                   @   s   e Zd ZdS )ÚUnsupportedLanguageConstructN)r"   r#   r$   r   r   r   r   r*   2   s    r*   )r'   Útypingr   Úerrorsr   r   r)   r*   r   r   r   r   Ú<module>   s    '