class _FilterCompilerHelper(object):
Converts a query filter to a callable usable for filtering.
| Method | __call__ |
Converts a query filter into a callable function. |
| Method | __init__ |
Initializes this class. |
| Method | _ |
Inner function for converting filters. |
| Method | _ |
Handles binary operators. |
| Method | _ |
Handles logic operators. |
| Method | _ |
Handles unary operators. |
| Method | _ |
Returns a field definition by name. |
| Constant | _EQUALITY |
Known operators |
| Constant | _LEVELS |
Undocumented |
| Constant | _OPS |
Undocumented |
| Constant | _OPTYPE |
Functions for equality checks depending on field flags. |
| Constant | _OPTYPE |
Undocumented |
| Constant | _OPTYPE |
Undocumented |
| Instance Variable | _fields |
Undocumented |
| Instance Variable | _hints |
Undocumented |
| Instance Variable | _op |
Undocumented |
Converts a query filter into a callable function.
| Parameters | |
hints:_FilterHints or None | Callbacks doing analysis on filter |
| qfilter:list | Filter structure |
| Returns | |
| callable | Function receiving context and item as parameters, returning boolean as to whether item matches filter |
Inner function for converting filters.
Calls the correct handler functions for the top-level operator. This function is called recursively (e.g. for logic operators).
Handles binary operators.
| Parameters | |
| hints | Callback doing some analysis on the filter |
| level:integer | Current depth |
| op:string | Operator |
| op | Functions implementing operators |
| operands:list | List of operands |
Handles logic operators.
| Parameters | |
| hints | Callback doing some analysis on the filter |
| level:integer | Current depth |
| op:string | Operator |
| op | Function implementing operator |
| operands:list | List of operands |
Handles unary operators.
| Parameters | |
| hints | Callback doing some analysis on the filter |
| level:integer | Current depth |
| op:string | Operator |
| op | Function implementing operator |
| operands:list | List of operands |
Known operators
Operator as key (qlang.OP_*), value a tuple of operator group (_OPTYPE_*) and a group-specific value:
- _OPTYPE_LOGIC: Callable taking any number of arguments; used by
_HandleLogicOp - _OPTYPE_UNARY: Always None; details handled by
_HandleUnaryOp - _OPTYPE_BINARY: Callable taking exactly two parameters, the left- and right-hand side of the operator, used by
_HandleBinaryOp
| Value |
|
Undocumented
| Value |
|
Functions for equality checks depending on field flags.
List of tuples containing flags and a callable receiving the left- and right-hand side of the operator. The flags are an OR-ed value of QFF_* (e.g. QFF_HOSTNAME or QFF_SPLIT_TIMESTAMP).
Order matters. The first item with flags will be used. Flags are checked using binary AND.