o ^ @sddlmZGdddeZeGdddeZeGdddeZeGdd d eZeGd d d eZeGd d d eZeGdddeZ GdddeZ GdddeZ dS))with_str_methodc@ eZdZdS) JMESPathErrorN__name__ __module__ __qualname__r r 5/usr/lib/python3/dist-packages/jmespath/exceptions.pyrrcs,eZdZdZeffdd ZddZZS) ParseErrorzInvalid jmespath expressioncs:tt||||||_||_||_||_d|_dSN) superr __init__ lex_position token_valueupper token_typemsg expression)selfrrrr __class__r r r s   zParseError.__init__cCs0d|jdd}d|j|j|j|j|j|fS)N ^zF%s: Parse error at column %s, token "%s" (%s), for expression: "%s" %s)rrrrrr underliner r r __str__szParseError.__str__)rrr_ERROR_MESSAGErr __classcell__r r rr r s  r c@eZdZddZddZdS)IncompleteExpressionErrorcCs ||_t||_d|_d|_dSr )rlenrrr)rrr r r set_expression!s  z(IncompleteExpressionError.set_expressioncCs d|jdd}d|j|fS)Nrrrz;Invalid jmespath expression: Incomplete expression: "%s" %s)rrrr r r r's z!IncompleteExpressionError.__str__N)rrrr$rr r r r r"s r"cs&eZdZdfdd ZddZZS) LexerErrorNcs0||_||_||_tt||||||_dSr )lexer_position lexer_valuemessagerr%rr)rr&r'r(rrr r r1s  zLexerError.__init__cCs d|jd}d|j|j|fS)Nrrz"Bad jmespath expression: %s: %s %s)r&r(rrr r r r;s zLexerError.__str__r )rrrrrr r r rr r%/s r%c@s$eZdZddZddZddZdS) ArityErrorcCs||_||_||_d|_dSr )expected_arity actual_arity function_namer)rexpectedactualnamer r r rCs zArityError.__init__cC d|j|d|j|j|jfS)Nz-Expected %s %s for function %s(), received %sargumentr* _pluralizer,r+rr r r rI zArityError.__str__cCs|dkr|S|dS)Nrsr )rwordcountr r r r3QszArityError._pluralizeN)rrrrrr3r r r r r)As r)c@seZdZddZdS)VariadictArityErrorcCr0)Nz6Expected at least %s %s for function %s(), received %sr1r2r4r r r rZr5zVariadictArityError.__str__N)rrrrr r r r r9Xs r9c@r!)JMESPathTypeErrorcCs||_||_||_||_dSr )r, current_value actual_typeexpected_types)rr,r;r<r=r r r res zJMESPathTypeError.__init__cCsd|j|j|j|jfS)NzQIn function %s(), invalid type for value: %s, expected one of: %s, received: "%s")r,r;r=r<r4r r r rls zJMESPathTypeError.__str__N)rrrrrr r r r r:cs r:cseZdZfddZZS)EmptyExpressionErrorcstt|ddS)Nz-Invalid JMESPath expression: cannot be empty.)rr>rr4rr r rts zEmptyExpressionError.__init__)rrrrr r r rr r>ssr>c@r)UnknownFunctionErrorNrr r r r r?yr r?N) jmespath.compatr ValueErrorrr r"r%r)r9r:r>r?r r r r s