o
    >û—a   ã                   @   s¸   d dl mZ G dd„ deƒZeG dd„ deƒƒZeG dd„ deƒƒZeG dd	„ d	eƒƒZeG d
d„ deƒƒZeG dd„ deƒƒZeG dd„ deƒƒZ	G dd„ deƒZ
G dd„ deƒZdS )é    )Úwith_str_methodc                   @   ó   e Zd ZdS )ÚJMESPathErrorN©Ú__name__Ú
__module__Ú__qualname__© r	   r	   ú7usr/lib/python3.10/site-packages/jmespath/exceptions.pyr      ó    r   c                       s,   e Zd ZdZef‡ fdd„	Zdd„ Z‡  ZS )Ú
ParseErrorzInvalid jmespath expressionc                    s:   t t| ƒ |||¡ || _|| _| ¡ | _|| _d | _d S ©N)	Úsuperr   Ú__init__Úlex_positionÚtoken_valueÚupperÚ
token_typeÚmsgÚ
expression)Úselfr   r   r   r   ©Ú	__class__r	   r
   r      s   

zParseError.__init__c                 C   s0   d| j d  d }d| j| j | j| j| j|f S )Nú é   ú^zF%s: Parse error at column %s, token "%s" (%s), for expression:
"%s"
%s)r   r   r   r   r   ©r   Z	underliner	   r	   r
   Ú__str__   s   þÿÿzParseError.__str__)r   r   r   Z_ERROR_MESSAGEr   r   Ú__classcell__r	   r	   r   r
   r      s
    ÿ
r   c                   @   ó   e Zd Zdd„ Zdd„ ZdS )ÚIncompleteExpressionErrorc                 C   s    || _ t|ƒ| _d | _d | _d S r   )r   Úlenr   r   r   )r   r   r	   r	   r
   Úset_expression!   s   

z(IncompleteExpressionError.set_expressionc                 C   s    d| j d  d }d| j|f S )Nr   r   r   z;Invalid jmespath expression: Incomplete expression:
"%s"
%s)r   r   r   r	   r	   r
   r   '   s
   ÿÿz!IncompleteExpressionError.__str__N)r   r   r   r"   r   r	   r	   r	   r
   r       s    r    c                       s&   e Zd Zd‡ fdd„	Zdd„ Z‡  ZS )Ú
LexerErrorNc                    s0   || _ || _|| _tt| ƒ |||¡ || _d S r   )Úlexer_positionÚlexer_valueÚmessager   r#   r   r   )r   r$   r%   r&   r   r   r	   r
   r   1   s   þ
zLexerError.__init__c                 C   s    d| j  d }d| j| j|f S )Nr   r   z"Bad jmespath expression: %s:
%s
%s)r$   r&   r   r   r	   r	   r
   r   ;   s   
ÿzLexerError.__str__r   )r   r   r   r   r   r   r	   r	   r   r
   r#   /   s    
r#   c                   @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )Ú
ArityErrorc                 C   s   || _ || _|| _d | _d S r   )Úexpected_arityÚactual_arityÚfunction_namer   )r   ÚexpectedZactualÚnamer	   r	   r
   r   C   s   
zArityError.__init__c                 C   ó    d| j |  d| j ¡| j| jf S )Nz-Expected %s %s for function %s(), received %sÚargument©r(   Ú
_pluralizer*   r)   ©r   r	   r	   r
   r   I   ó   üÿzArityError.__str__c                 C   s   |dkr|S |d S )Nr   Úsr	   )r   ÚwordÚcountr	   r	   r
   r0   Q   s   zArityError._pluralizeN)r   r   r   r   r   r0   r	   r	   r	   r
   r'   A   s    r'   c                   @   s   e Zd Zdd„ ZdS )ÚVariadictArityErrorc                 C   r-   )Nz6Expected at least %s %s for function %s(), received %sr.   r/   r1   r	   r	   r
   r   Z   r2   zVariadictArityError.__str__N)r   r   r   r   r	   r	   r	   r
   r6   X   s    r6   c                   @   r   )ÚJMESPathTypeErrorc                 C   s   || _ || _|| _|| _d S r   )r*   Úcurrent_valueÚactual_typeÚexpected_types)r   r*   r8   r9   r:   r	   r	   r
   r   e   s   
zJMESPathTypeError.__init__c                 C   s   d| j | j| j| jf S )NzQIn function %s(), invalid type for value: %s, expected one of: %s, received: "%s")r*   r8   r:   r9   r1   r	   r	   r
   r   l   s
   þÿzJMESPathTypeError.__str__N)r   r   r   r   r   r	   r	   r	   r
   r7   c   s    r7   c                       s   e Zd Z‡ fdd„Z‡  ZS )ÚEmptyExpressionErrorc                    s   t t| ƒ d¡ d S )Nz-Invalid JMESPath expression: cannot be empty.)r   r;   r   r1   r   r	   r
   r   t   s   
ÿzEmptyExpressionError.__init__)r   r   r   r   r   r	   r	   r   r
   r;   s   s    r;   c                   @   r   )ÚUnknownFunctionErrorNr   r	   r	   r	   r
   r<   y   r   r<   N)Zjmespath.compatr   Ú
ValueErrorr   r   r    r#   r'   r6   r7   r;   r<   r	   r	   r	   r
   Ú<module>   s     
