oslo_utils.specs_matcher.
make_grammar
()¶Creates the grammar to be used by a spec matcher.
The grammar created supports the following operations.
= :
equal to or greater than. This is equivalent to >=
and is
supported for legacy reasons!= :
Float/integer value not equal<= :
Float/integer value less than or equal< :
Float/integer value less than== :
Float/integer value equal>= :
Float/integer value greater than or equal> :
Float/integer value greaters!= :
Not equals< :
Less thans<= :
Less than or equals== :
Equals> :
Greater thans>= :
Greater than or equal<all-in> :
All items ‘in’ value<in> :
Item ‘in’ value, like a substring in a string.<or> :
Logical ‘or’If no operator is specified the default is s==
(string equality comparison)
">= 60"
Is the numerical value greater than or equal to 60"<or> spam <or> eggs"
Does the value contain spam
or eggs
"s== 2.1.0"
Is the string value equal to 2.1.0
"<in> gcc"
Is the string gcc
contained in the value string"<all-in> aes mmx"
Are both aes
and mmx
in the valueReturns: | A pyparsing.MatchFirst object. See https://pythonhosted.org/pyparsing/ for details on pyparsing. |
---|
oslo_utils.specs_matcher.
match
(cmp_value, spec)¶Match a given value to a given spec DSL.
This uses the grammar defined by make_grammar()
Parameters: |
|
---|---|
Returns: | True if cmp_value is a match for spec. False otherwise. |
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.