Represents a boolean expression and provides a test method to evaluate the expression and determine its truthiness.
- query – A string containing the query to be evaluated
- lazy – If
True, parse the query the first time it’s tested rather than immediately. This can help with performance if you instantiate a lot of rules and only end up evaluating a small handful.
Test the expression against the given context and return the result.
Parameters: context – A dict context to evaluate the expression against. Returns: True if the expression succesfully evaluated against the context, or False otherwise.
Raised when an expression contains a property path that’s not supplied in the context.
Raised when an expression uses an unknown operator.
This should never be thrown since the operator won’t be correctly parsed as a token by pyparsing, but it’s useful to have this hanging around for when additional operators are being added.