o
    i                      @   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	   P/home/ubuntu/veenaModal/venv/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   	underliner	   r	   r
   __str__   s   zParseError.__str__)r   r   r   _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   expected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
   r3   Q   s   zArityError._pluralizeN)r   r   r   r   r   r3   r	   r	   r	   r
   r)   A   s    r)   c                   @   s   e Zd Zdd ZdS )VariadictArityErrorc                 C   r0   )Nz6Expected at least %s %s for function %s(), received %sr1   r2   r4   r	   r	   r
   r   Z   r5   zVariadictArityError.__str__N)r   r   r   r   r	   r	   r	   r
   r9   X   s    r9   c                   @   r!   )JMESPathTypeErrorc                 C   s   || _ || _|| _|| _d S r   )r,   current_valueactual_typeexpected_types)r   r,   r;   r<   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,   r;   r=   r<   r4   r	   r	   r
   r   l   s
   zJMESPathTypeError.__str__N)r   r   r   r   r   r	   r	   r	   r
   r:   c   s    r:   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   r4   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)jmespath.compatr   
ValueErrorr   r   r"   r%   r)   r9   r:   r>   r?   r	   r	   r	   r
   <module>   s     
