Add lark import error (#7465)

This commit is contained in:
Bagatur 2023-07-10 03:21:23 -04:00 committed by GitHub
parent bcab894f4e
commit 04cddfba0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -145,6 +145,11 @@ def get_parser(
Returns: Returns:
Lark parser for the query language. Lark parser for the query language.
""" """
# QueryTransformer is None when Lark cannot be imported.
if QueryTransformer is None:
raise ImportError(
"Cannot import lark, please install it with 'pip install lark'."
)
transformer = QueryTransformer( transformer = QueryTransformer(
allowed_comparators=allowed_comparators, allowed_operators=allowed_operators allowed_comparators=allowed_comparators, allowed_operators=allowed_operators
) )