a
    ͝Gd                     @   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                       sH   e Zd ZdZd	eje dd fddZeeje dddZ	  Z
S )
TemplateErrorz"Baseclass for all template errors.N)messagereturnc                    s   t  | d S N)super__init__)selfr   	__class__ M/var/www/html/django/DPS/env/lib/python3.9/site-packages/jinja2/exceptions.pyr
   
   s    zTemplateError.__init__r   c                 C   s   | j r| j d S d S )Nr   )argsr   r   r   r   r      s    zTemplateError.message)N)__name__
__module____qualname____doc__tOptionalstrr
   propertyr   __classcell__r   r   r   r   r      s   r   c                   @   s\   e Zd ZU dZdZeje ed< dejej	edf  eje ddddZ
edd	d
ZdS )TemplateNotFoundzRaised 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   r   )namer   r   c                 C   sN   t | | |d u r6ddlm} t||r2|  |}|| _|| _|g| _d S )Nr   r   )	IOErrorr
   runtimer   
isinstanceZ_fail_with_undefined_errorr   r   	templates)r   r   r   r   r   r   r   r
      s    
zTemplateNotFound.__init__r   c                 C   s
   t | jS r   )r   r   r   r   r   r   __str__1   s    zTemplateNotFound.__str__)N)r   r   r   r   r   r   r   r   __annotations__Unionr
   r"   r   r   r   r   r      s   
	 r   c                       sB   e Zd ZdZdejejedf  eje dd 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   Nr   )namesr   r   c                    s   |d u r^ddl m} g }|D ]&}t||r8||j q|| qdtt|}d| }t 	|rp|d nd | t
|| _d S )Nr   r   z, z(none of the templates given were found: )r   r   r    appendZ_undefined_messagejoinmapr   r	   r
   listr!   )r   r&   r   r   partsr   Z	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                       sR   e Zd ZdZdeeeje eje dd fddZedddZ	d	d
 Z
  ZS )TemplateSyntaxErrorzBRaised to tell the user that there is a problem with the template.N)r   linenor   filenamer   c                    s.   t  | || _|| _|| _d | _d| _d S )NF)r	   r
   r/   r   r0   source
translated)r   r   r/   r   r0   r   r   r   r
   [   s    zTemplateSyntaxError.__init__r   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rz| j	 | jd  }W n t
y   Y n0 |d|   d|S )Nzline zFile "z", z  r   z    
)r2   r   castr   r   r/   r0   r   r1   
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   r/   r   r0   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   r.   X   s     r.   c                   @   s   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=      s   r=   c                   @   s   e Zd ZdZdS )TemplateRuntimeErrorzoA generic runtime error in the template engine.  Under some situations
    Jinja may raise this exception.
    Nr>   r   r   r   r   r?      s   r?   c                   @   s   e Zd ZdZdS )UndefinedErrorz<Raised if a template tries to operate on :class:`Undefined`.Nr>   r   r   r   r   r@      s   r@   c                   @   s   e Zd ZdZdS )SecurityErrorzWRaised if a template tries to do something insecure if the
    sandbox is enabled.
    Nr>   r   r   r   r   rA      s   rA   c                   @   s   e Zd ZdZdS )FilterArgumentErrorzQThis error is raised if a filter was called with inappropriate
    arguments
    Nr>   r   r   r   r   rB      s   rB   )typingr   TYPE_CHECKINGr   r   	Exceptionr   r   LookupErrorr   r%   r.   r=   r?   r@   rA   rB   r   r   r   r   <module>   s   ##3