o
    ‚.ÚdŸ  ã                   @   sz  U d Z ddlmZ ddlmZ ddlmZ ddlm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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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G d*d+„ d+eƒZG d,d-„ d-eƒZG d.d/„ d/eƒZG d0d1„ d1e
ƒZG d2d3„ d3eƒZG d4d5„ d5eƒZ G d6d7„ d7e
ƒZ!G d8d9„ d9e"ƒZ#G d:d;„ d;e#ƒZ$G d<d=„ d=e#ƒZ%G d>d?„ d?e#ƒZ&ee$ee%ee&ee&iZ'eee
 ee# f e(d@< dAee
 dBee# fdCdD„Z)dEedBe*fdFdG„Z+G dHdI„ dIe*ƒZ,dJS )Kz(Liquid specific Exceptions and warnings.é    )ÚPath)ÚAny)ÚDict)ÚOptional)ÚType)ÚUnionc                
       s|   e Zd ZdZdddœdedee deeee	f  f‡ fdd„Z
d	ef‡ fd
d„Zed	efdd„ƒZed	efdd„ƒZ‡  ZS )ÚErrorz%Base class for all Liquid exceptions.N©ÚlinenumÚfilenameÚargsr
   r   c                   s   || _ || _tƒ j|Ž  d S )N)r
   r   ÚsuperÚ__init__©Úselfr
   r   r   ©Ú	__class__© úI/var/www/Matress/matenv/lib/python3.10/site-packages/liquid/exceptions.pyr      s   zError.__init__Úreturnc                    s:   t ƒ  ¡ }| jr|› d| j› }| jr|d| j› 7 }|S )Nz
, on line z of )r   Ú__str__r
   r   ©r   Úmsgr   r   r   r      s   
zError.__str__c                 C   s   | j r| j d S dS )z/The exception's error message if one was given.r   N)r   ©r   r   r   r   Úmessage    s   
zError.messagec                 C   s*   t | jtƒr| j ¡ S | jrt| jƒS dS )z|The name of the template that raised this exception.

        An empty string is return if a name is not available.
        Ú )Ú
isinstancer   r   Úas_posixÚstrr   r   r   r   Úname'   s
   

z
Error.name)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úobjectr   Úintr   r   r   r   r   Úpropertyr   r   Ú__classcell__r   r   r   r   r      s     üþýü
r   c                   @   ó   e Zd ZdZdS )ÚLiquidInterruptzLoop interrupt exception.N©r    r!   r"   r#   r   r   r   r   r)   4   ó    r)   c                   @   r(   )Ú
StopRenderzáTemplate inheritance interrupt.

    An interrupt used to signal that `BoundTemplate.render_with_context` should stop
    rendering more nodes. This is used by template inheritance tags and is not an error
    condition.
    Nr*   r   r   r   r   r,   8   r+   r,   c                   @   r(   )ÚLiquidEnvironmentErrorz7An exception raised due to a misconfigured environment.Nr*   r   r   r   r   r-   A   r+   r-   c                
       óF   e Zd ZdZdddœdedee deeee	f  f‡ fdd„Z
‡  ZS )	ÚLiquidSyntaxErrorz.Exception raised when there is a parser error.Nr	   r   r
   r   c                   ó   t ƒ j|||dœŽ d | _d S ©Nr	   ©r   r   Úsourcer   r   r   r   r   H   ó   
zLiquidSyntaxError.__init__©r    r!   r"   r#   r$   r   r%   r   r   r   r   r'   r   r   r   r   r/   E   s    üþýür/   c                
       r.   )	ÚTemplateInheritanceErrorzAn exceptions raised when template inheritance tags are used incorrectly.

    This could occur when parsing a template or at render time.
    Nr	   r   r
   r   c                   r0   r1   r2   r   r   r   r   r   X   r4   z!TemplateInheritanceError.__init__r5   r   r   r   r   r6   R   s    üþýür6   c                   @   r(   )ÚRequiredBlockErrorzBAn exception raised when a required block has not been overridden.Nr*   r   r   r   r   r7   b   r+   r7   c                   @   r(   )ÚLiquidTypeErrorz5Exception raised when an error occurs at render time.Nr*   r   r   r   r   r8   f   r+   r8   c                   @   r(   )ÚDisabledTagErrorzBException raised when an attempt is made to render a disabled tag.Nr*   r   r   r   r   r9   j   r+   r9   c                   @   r(   )ÚNoSuchFilterFuncz,Exception raised when a filter lookup fails.Nr*   r   r   r   r   r:   n   r+   r:   c                   @   r(   )ÚFilterErrorz%Exception raised when a filter fails.Nr*   r   r   r   r   r;   r   r+   r;   c                   @   r(   )ÚFilterArgumentErrorz7Exception raised when a filter's arguments are invalid.Nr*   r   r   r   r   r<   v   r+   r<   c                   @   r(   )ÚFilterValueErrorz1Exception raised when a filters value is invalid.Nr*   r   r   r   r   r=   z   r+   r=   c                       s&   e Zd ZdZdef‡ fdd„Z‡  ZS )ÚTemplateNotFoundz4Exception raised when a template could not be found.r   c                    s   t ƒ  ¡ }d|› S )Nztemplate not found )r   r   r   r   r   r   r      s   

zTemplateNotFound.__str__)r    r!   r"   r#   r   r   r'   r   r   r   r   r>   ~   s    r>   c                   @   r(   )ÚResourceLimitErrorz6Base class for exceptions relating to resource limits.Nr*   r   r   r   r   r?   †   r+   r?   c                   @   r(   )ÚContextDepthErrorz„Exception raised when the maximum context depth is reached.

    Usually indicates recursive use of `render` or `include` tags.
    Nr*   r   r   r   r   r@   Š   r+   r@   c                   @   r(   )ÚLoopIterationLimitErrorzAException raised when the loop iteration limit has been exceeded.Nr*   r   r   r   r   rA   ‘   r+   rA   c                   @   r(   )ÚOutputStreamLimitErrorz?Exception raised when an output stream limit has been exceeded.Nr*   r   r   r   r   rB   •   r+   rB   c                   @   r(   )ÚLocalNamespaceLimitErrorz@Exception raised when a local namespace limit has been exceeded.Nr*   r   r   r   r   rC   ™   r+   rC   c                   @   r(   )ÚLiquidValueErrorzFException raised when a cast from str to int exceeds the length limit.Nr*   r   r   r   r   rD   £   r+   rD   c                   @   r(   )ÚUndefinedErrorz-Exception raised by the StrictUndefined type.Nr*   r   r   r   r   rE   §   r+   rE   c                   @   r(   )Ú	BreakLoopz.Exception raised when a BreakNode is rendered.Nr*   r   r   r   r   rF   «   r+   rF   c                   @   r(   )ÚContinueLoopz1Exception raised when a ContinueNode is rendered.Nr*   r   r   r   r   rG   ¯   r+   rG   c                   @   r(   )ÚTemplateTraversalErrorzCException raised when an AST node or expression can not be visited.Nr*   r   r   r   r   rH   ³   r+   rH   c                   @   r(   )ÚLiquidWarningzBase warning.Nr*   r   r   r   r   rI   ·   r+   rI   c                   @   r(   )ÚLiquidSyntaxWarningz-Replaces LiquidSyntaxError when in WARN mode.Nr*   r   r   r   r   rJ   »   r+   rJ   c                   @   r(   )ÚLiquidTypeWarningz+Replaces LiquidTypeError when in WARN mode.Nr*   r   r   r   r   rK   ¿   r+   rK   c                   @   r(   )ÚFilterWarningz-Replaces filter exceptions when in WARN mode.Nr*   r   r   r   r   rL   Ã   r+   rL   ÚWARNINGSÚexcr   c                 C   s   t  | t¡S )z3Return a warning equivalent of the given exception.)rM   ÚgetrI   )rN   r   r   r   Úlookup_warningÏ   s   rP   Ú_c                 C   ó   t dƒ‚)z8A dummy escape function that always raises an exception.ú.autoescape requires Markupsafe to be installed©r   )rQ   r   r   r   ÚescapeÔ   s   rU   c                       s\   e Zd ZdZdef‡ fdd„Zdedefdd„Zdefdd	„Zd
e	de	defdd„Z
‡  ZS )ÚMarkupz5A dummy markup class that always raises an exception.rQ   c                    s   t ƒ  ¡  tdƒ‚©NrS   )r   r   r   ©r   rQ   r   r   r   r   Ü   s   
zMarkup.__init__r   c                 C   rR   rW   rT   rX   r   r   r   Újoinà   ó   ÿzMarkup.joinc                 C   rR   rW   rT   r   r   r   r   Úunescapeå   rZ   zMarkup.unescaper   Úkwargsc                 O   rR   rW   rT   )r   r   r\   r   r   r   Úformatê   rZ   zMarkup.format)r    r!   r"   r#   r$   r   r   rY   r[   r   r]   r'   r   r   r   r   rV   Ù   s    rV   N)-r#   Úpathlibr   Útypingr   r   r   r   r   Ú	Exceptionr   r)   r,   r-   r/   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   ÚUserWarningrI   rJ   rK   rL   rM   Ú__annotations__rP   r   rU   rV   r   r   r   r   Ú<module>   sV    )	
ü