o
    'h                     @   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__ M/var/www/html/olx_land/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 )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   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