Module for a simple query language
A query filter is always a list. The first item in the list is the operator (e.g. [OP_AND, ...]), while the other items depend on the operator. For logic operators (e.g. OP_AND
, OP_OR
), they are subfilters whose results are combined. Unary operators take exactly one other item (e.g. a subfilter for OP_NOT
and a field name for OP_TRUE
). Binary operators take exactly two operands, usually a field name and a value to compare against. Filters are converted to callable functions by query._CompileFilter
.
Function |
|
Builds a parser for query filter strings. |
Function |
|
Try to make a filter from arguments to a command. |
Function |
|
Builds simple a filter. |
Function |
|
Parses a query filter. |
Function | _ |
CHecks if a string could be a filter. |
Function | _ |
Checks if a string could be a globbing pattern. |
Function | _ |
Creates parsing action function for logic operator. |
Function | _ |
Regular expression value for condition. |
Function | _ |
Generates filter for one argument. |
Constant | _KNOWN |
Undocumented |
Constant | _KNOWN |
Undocumented |
Try to make a filter from arguments to a command.
If the name could be a filter it is parsed as such. If it's just a globbing pattern, e.g. "*.site", such a filter is constructed. As a last resort the names are treated just as a plain name filter.
Parameters | |
args:list of string | Arguments to command |
force | Whether to force treatment as a full-fledged filter |
namefield:string | Name of field to use for simple filters (use None for a default of "name") |
isnumeric:bool | Whether the namefield type is numeric, as opposed to the default string type; this influences how the filter is built |
Returns | |
list | Query filter |
Parses a query filter.
Parameters | |
text:string | Query filter |
parser:pyparsing.ParserElement | Pyparsing object |
Returns | |
list | Undocumented |
Creates parsing action function for logic operator.
Parameters | |
op:string | Operator for data structure, e.g. OP_AND |