o
    àý°jÏ  ã                   @   s²   d dl ZejrddlmZ G dd„ deƒZG dd„ dee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G dd„ deƒZG dd„ deƒZdS )é    Né   ©Ú	Undefinedc                       sJ   e Zd ZdZd	deje ddf‡ fdd„Zedeje fdd„ƒZ	‡  Z
S )
ÚTemplateErrorz"Baseclass for all template errors.NÚmessageÚreturnc                    s   t ƒ  |¡ d S ©N)ÚsuperÚ__init__)Úselfr   ©Ú	__class__© ú„/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/jinja2/exceptions.pyr
   
   s   zTemplateError.__init__c                 C   s   | j r| j d S d S )Nr   )Úargs©r   r   r   r   r      s   zTemplateError.messager   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚtÚOptionalÚstrr
   Úpropertyr   Ú__classcell__r   r   r   r   r      s
    r   c                   @   sb   e Zd ZU dZdZeje ed< 	ddejej	edf  deje ddfdd„Z
defd	d
„ZdS )ÚTemplateNotFoundzÀRaised if a template does not exist.

    .. versionchanged:: 2.11
        If the given name is :class:`Undefined` and no message was
        provided, an :exc:`UndefinedError` is raised.
    Nr   Únamer   r   c                 C   sN   t  | |¡ |d u rddlm} t||ƒr| ¡  |}|| _|| _|g| _d S )Nr   r   )	ÚIOErrorr
   Úruntimer   Ú
isinstanceÚ_fail_with_undefined_errorr   r   Ú	templates)r   r   r   r   r   r   r   r
      s   
zTemplateNotFound.__init__c                 C   s
   t | jƒS r   )r   r   r   r   r   r   Ú__str__1   s   
zTemplateNotFound.__str__r   )r   r   r   r   r   r   r   r   Ú__annotations__ÚUnionr
   r"   r   r   r   r   r      s   
 	ýþý
ür   c                       sJ   e Zd ZdZ		d
dejejedf  deje ddf‡ fdd	„Z	‡  Z
S )ÚTemplatesNotFounda”  Like :class:`TemplateNotFound` but raised if multiple templates
    are selected.  This is a subclass of :class:`TemplateNotFound`
    exception, so just catching the base exception will catch both.

    .. versionchanged:: 2.11
        If a name in the list of names is :class:`Undefined`, a message
        about it being undefined is shown rather than the empty string.

    .. versionadded:: 2.2
    r   NÚnamesr   r   r   c                    s†   |d u r/ddl m} g }|D ]}t||ƒr| |j¡ q| |¡ qd tt|ƒ¡}d|› �}tƒ  	|r8|d nd |¡ t
|ƒ| _d S )Nr   r   z, z(none of the templates given were found: éÿÿÿÿ)r   r   r   ÚappendÚ_undefined_messageÚjoinÚmapr   r	   r
   Úlistr!   )r   r&   r   r   Úpartsr   Ú	parts_strr   r   r   r
   A   s   

zTemplatesNotFound.__init__)r   N)r   r   r   r   r   ÚSequencer$   r   r   r
   r   r   r   r   r   r%   5   s    ýþýür%   c                       s^   e Zd ZdZ		ddededeje deje ddf
‡ fdd	„Zdefd
d„Z	dd„ Z
‡  ZS )ÚTemplateSyntaxErrorzBRaised to tell the user that there is a problem with the template.Nr   Úlinenor   Úfilenamer   c                    s.   t ƒ  |¡ || _|| _|| _d | _d| _d S )NF)r	   r
   r1   r   r2   ÚsourceÚ
translated)r   r   r1   r   r2   r   r   r   r
   [   s   
zTemplateSyntaxError.__init__c                 C   s¨   | j r
t t| j¡S d| j› �}| jp| j}|r d|› d|› �}t t| j¡d| g}| jd urOz| j 	¡ | jd  }W n	 t
yE   Y n
w | d| ¡  ¡ d |¡S )Nzline zFile "z", z  r   z    Ú
)r4   r   Úcastr   r   r1   r2   r   r3   Ú
splitlinesÚ
IndexErrorr(   Ústripr*   )r   Úlocationr   ÚlinesÚliner   r   r   r"   l   s   
ÿ
zTemplateSyntaxError.__str__c                 C   s   | j | j| j| j| jffS r   )r   r   r1   r   r2   r   r   r   r   Ú
__reduce__ƒ   s   zTemplateSyntaxError.__reduce__)NN)r   r   r   r   r   Úintr   r   r
   r"   r=   r   r   r   r   r   r0   X   s"    ûþýüûúr0   c                   @   ó   e Zd ZdZdS )ÚTemplateAssertionErrora  Like a template syntax error, but covers cases where something in the
    template caused an error at compile time that wasn't necessarily caused
    by a syntax error.  However it's a direct subclass of
    :exc:`TemplateSyntaxError` and has the same attributes.
    N©r   r   r   r   r   r   r   r   r@   ‹   ó    r@   c                   @   r?   )ÚTemplateRuntimeErrorzoA generic runtime error in the template engine.  Under some situations
    Jinja may raise this exception.
    NrA   r   r   r   r   rC   “   rB   rC   c                   @   r?   )ÚUndefinedErrorz<Raised if a template tries to operate on :class:`Undefined`.NrA   r   r   r   r   rD   ™   rB   rD   c                   @   r?   )ÚSecurityErrorzWRaised if a template tries to do something insecure if the
    sandbox is enabled.
    NrA   r   r   r   r   rE   �   rB   rE   c                   @   r?   )ÚFilterArgumentErrorzQThis error is raised if a filter was called with inappropriate
    arguments
    NrA   r   r   r   r   rF   £   rB   rF   )Útypingr   ÚTYPE_CHECKINGr   r   Ú	Exceptionr   r   ÚLookupErrorr   r%   r0   r@   rC   rD   rE   rF   r   r   r   r   Ú<module>   s    ##3