B ݁[ @sddlmZGdddeZeGdddeZeGdddeZeGdd d eZeGd d d eZeGd d d eZeGdddeZ GdddeZ GdddeZ dS))with_str_methodc@s eZdZdS) JMESPathErrorN)__name__ __module__ __qualname__rrT/Users/kashii/Desktop/Projects/Workshops/worker-safety/lambda/jmespath/exceptions.pyrsrcs,eZdZdZeffdd ZddZZS) ParseErrorzInvalid jmespath expressioncs:tt||||||_||_||_||_d|_dS)N) superr __init__ lex_position token_valueupper token_typemsg expression)selfr r rr) __class__rrr 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)r rr rr)r underlinerrr__str__szParseError.__str__)rrrZ_ERROR_MESSAGEr r __classcell__rr)rrr s r c@seZdZddZddZdS)IncompleteExpressionErrorcCs ||_t||_d|_d|_dS)N)rlenr rr )rrrrrset_expression!s z(IncompleteExpressionError.set_expressioncCs d|jdd}d|j|fS)Nrrrz;Invalid jmespath expression: Incomplete expression: "%s" %s)r r)rrrrrr'sz!IncompleteExpressionError.__str__N)rrrrrrrrrrsrcs&eZdZdfdd ZddZZS) LexerErrorNcs0||_||_||_tt||||||_dS)N)lexer_position lexer_valuemessager rr r)rrrr r)rrrr 1s zLexerError.__init__cCs d|jd}d|j|j|fS)Nrrz"Bad jmespath expression: %s: %s %s)rr r)rrrrrr;szLexerError.__str__)N)rrrr rrrr)rrr/s rc@s$eZdZddZddZddZdS) ArityErrorcCs||_||_||_d|_dS)N)expected_arity actual_arity function_namer)rexpectedZactualnamerrrr CszArityError.__init__cCs d|j|d|j|j|jfS)Nz-Expected %s %s for function %s(), received %sargument)r" _pluralizer$r#)rrrrrIs  zArityError.__str__cCs|dkr |S|dSdS)Nrsr)rwordcountrrrr(QszArityError._pluralizeN)rrrr rr(rrrrr!Asr!c@seZdZddZdS)VariadictArityErrorcCs d|j|d|j|j|jfS)Nz6Expected at least %s %s for function %s(), received %sr')r"r(r$r#)rrrrrZs  zVariadictArityError.__str__N)rrrrrrrrr,Xsr,c@seZdZddZddZdS)JMESPathTypeErrorcCs||_||_||_||_dS)N)r$ current_value actual_typeexpected_types)rr$r.r/r0rrrr eszJMESPathTypeError.__init__cCsd|j|j|j|jfS)NzQIn function %s(), invalid type for value: %s, expected one of: %s, received: "%s")r$r.r0r/)rrrrrlszJMESPathTypeError.__str__N)rrrr rrrrrr-csr-cseZdZfddZZS)EmptyExpressionErrorcstt|ddS)Nz-Invalid JMESPath expression: cannot be empty.)r r1r )r)rrrr ts zEmptyExpressionError.__init__)rrrr rrr)rrr1ssr1c@s eZdZdS)UnknownFunctionErrorN)rrrrrrrr2ysr2N) jmespath.compatr ValueErrorrr rrr!r,r-r1r2rrrrs