Revision 67620dff
b/autotools/convert-constants | ||
---|---|---|
298 | 298 |
|
299 | 299 |
|
300 | 300 |
def main(): |
301 |
print Convert(qlang, "qlang") |
|
302 | 301 |
print Convert(errors, "errors") |
303 | 302 |
print Convert(jstore, "jstore") |
304 | 303 |
|
b/lib/qlang.py | ||
---|---|---|
32 | 32 |
""" |
33 | 33 |
|
34 | 34 |
import re |
35 |
import string # pylint: disable=W0402 |
|
36 | 35 |
import logging |
37 | 36 |
|
38 | 37 |
import pyparsing as pyp |
39 | 38 |
|
39 |
from ganeti import constants |
|
40 | 40 |
from ganeti import errors |
41 | 41 |
from ganeti import utils |
42 | 42 |
from ganeti import compat |
43 | 43 |
|
44 | 44 |
|
45 |
# Logic operators with one or more operands, each of which is a filter on its |
|
46 |
# own |
|
47 |
OP_OR = "|" |
|
48 |
OP_AND = "&" |
|
49 |
|
|
50 |
|
|
51 |
# Unary operators with exactly one operand |
|
52 |
OP_NOT = "!" |
|
53 |
OP_TRUE = "?" |
|
54 |
|
|
55 |
|
|
56 |
# Binary operators with exactly two operands, the field name and an |
|
57 |
# operator-specific value |
|
58 |
OP_EQUAL = "=" |
|
59 |
OP_NOT_EQUAL = "!=" |
|
60 |
OP_LT = "<" |
|
61 |
OP_LE = "<=" |
|
62 |
OP_GT = ">" |
|
63 |
OP_GE = ">=" |
|
64 |
OP_REGEXP = "=~" |
|
65 |
OP_CONTAINS = "=[]" |
|
66 |
|
|
67 |
|
|
68 |
#: Characters used for detecting user-written filters (see L{_CheckFilter}) |
|
69 |
FILTER_DETECTION_CHARS = frozenset("()=/!~'\"\\<>" + string.whitespace) |
|
70 |
|
|
71 |
#: Characters used to detect globbing filters (see L{_CheckGlobbing}) |
|
72 |
GLOB_DETECTION_CHARS = frozenset("*?") |
|
45 |
OP_OR = constants.QLANG_OP_OR |
|
46 |
OP_AND = constants.QLANG_OP_AND |
|
47 |
OP_NOT = constants.QLANG_OP_NOT |
|
48 |
OP_TRUE = constants.QLANG_OP_TRUE |
|
49 |
OP_EQUAL = constants.QLANG_OP_EQUAL |
|
50 |
OP_NOT_EQUAL = constants.QLANG_OP_NOT_EQUAL |
|
51 |
OP_LT = constants.QLANG_OP_LT |
|
52 |
OP_LE = constants.QLANG_OP_LE |
|
53 |
OP_GT = constants.QLANG_OP_GT |
|
54 |
OP_GE = constants.QLANG_OP_GE |
|
55 |
OP_REGEXP = constants.QLANG_OP_REGEXP |
|
56 |
OP_CONTAINS = constants.QLANG_OP_CONTAINS |
|
57 |
FILTER_DETECTION_CHARS = constants.QLANG_FILTER_DETECTION_CHARS |
|
58 |
GLOB_DETECTION_CHARS = constants.QLANG_GLOB_DETECTION_CHARS |
|
73 | 59 |
|
74 | 60 |
|
75 | 61 |
def MakeSimpleFilter(namefield, values): |
b/src/Ganeti/HsConstants.hs | ||
---|---|---|
4430 | 4430 |
-- | 'WaitForJobChange' timeout |
4431 | 4431 |
luxiWfjcTimeout :: Int |
4432 | 4432 |
luxiWfjcTimeout = (luxiDefRwto - 1) `div` 2 |
4433 |
|
|
4434 |
-- * Query language constants |
|
4435 |
|
|
4436 |
-- ** Logic operators with one or more operands, each of which is a |
|
4437 |
-- filter on its own |
|
4438 |
|
|
4439 |
qlangOpAnd :: String |
|
4440 |
qlangOpAnd = "&" |
|
4441 |
|
|
4442 |
qlangOpOr :: String |
|
4443 |
qlangOpOr = "|" |
|
4444 |
|
|
4445 |
-- ** Unary operators with exactly one operand |
|
4446 |
|
|
4447 |
qlangOpNot :: String |
|
4448 |
qlangOpNot = "!" |
|
4449 |
|
|
4450 |
qlangOpTrue :: String |
|
4451 |
qlangOpTrue = "?" |
|
4452 |
|
|
4453 |
-- ** Binary operators with exactly two operands, the field name and |
|
4454 |
-- an operator-specific value |
|
4455 |
|
|
4456 |
qlangOpContains :: String |
|
4457 |
qlangOpContains = "=[]" |
|
4458 |
|
|
4459 |
qlangOpEqual :: String |
|
4460 |
qlangOpEqual = "=" |
|
4461 |
|
|
4462 |
qlangOpGe :: String |
|
4463 |
qlangOpGe = ">=" |
|
4464 |
|
|
4465 |
qlangOpGt :: String |
|
4466 |
qlangOpGt = ">" |
|
4467 |
|
|
4468 |
qlangOpLe :: String |
|
4469 |
qlangOpLe = "<=" |
|
4470 |
|
|
4471 |
qlangOpLt :: String |
|
4472 |
qlangOpLt = "<" |
|
4473 |
|
|
4474 |
qlangOpNotEqual :: String |
|
4475 |
qlangOpNotEqual = "!=" |
|
4476 |
|
|
4477 |
qlangOpRegexp :: String |
|
4478 |
qlangOpRegexp = "=~" |
|
4479 |
|
|
4480 |
-- | Characters used for detecting user-written filters (see |
|
4481 |
-- L{_CheckFilter}) |
|
4482 |
|
|
4483 |
qlangFilterDetectionChars :: FrozenSet String |
|
4484 |
qlangFilterDetectionChars = |
|
4485 |
ConstantUtils.mkSet ["!", " ", "\"", "\'", |
|
4486 |
")", "(", "\x0b", "\n", |
|
4487 |
"\r", "\x0c", "/", "<", |
|
4488 |
"\t", ">", "=", "\\", "~"] |
|
4489 |
|
|
4490 |
-- | Characters used to detect globbing filters |
|
4491 |
qlangGlobDetectionChars :: FrozenSet String |
|
4492 |
qlangGlobDetectionChars = ConstantUtils.mkSet ["*", "?"] |
Also available in: Unified diff