Fix problem with pyparsing.operatorPrecedence method

Pyparsing library was recently updated in golab requiremnts [1].
Since version 3.0.0 operatorPrecedence method was renamed to infixNotation [2].

[1]62f92c0187
[2]16b766b97c/CHANGES (L598)

Change-Id: I3bfefe5b9bc601f383e0b9d80046de387e420fd8
This commit is contained in:
Adrian Czarnecki 2021-12-08 09:11:02 -08:00
parent 95747eec73
commit 0b63819ff1
4 changed files with 6 additions and 6 deletions

View File

@ -77,7 +77,7 @@ pycparser==2.18
Pygments==2.2.0
pyinotify==0.9.6
PyMySQL==0.8.0
pyparsing==2.1.0
pyparsing==3.0.6
pyperclip==1.5.27
python-dateutil==2.5.3
python-editor==1.0.3

View File

@ -300,9 +300,9 @@ sub_expression = ((function_and_metric | metric) + relational_op + threshold +
sub_expression.setParseAction(SubExpr)
expression = (
pyparsing.operatorPrecedence(sub_expression,
[(AND, 2, pyparsing.opAssoc.LEFT, AndSubExpr),
(OR, 2, pyparsing.opAssoc.LEFT, OrSubExpr)]))
pyparsing.infixNotation(sub_expression,
[(AND, 2, pyparsing.opAssoc.LEFT, AndSubExpr),
(OR, 2, pyparsing.opAssoc.LEFT, OrSubExpr)]))
class AlarmExprParser(object):

View File

@ -73,7 +73,7 @@ class TestAlarmExpression(base.BaseTestCase):
sub_exprs = alarm_expr_parser.AlarmExprParser(expression).sub_expr_list
print([x.dimensions_as_list for x in sub_exprs].__str__())
self.assertEqual([x.dimensions_as_list for x in sub_exprs].__str__(),
"[(['hostname=fred'], {}), [], []]")
"[ParseResults(['hostname=fred'], {}), [], []]")
def test_operator(self):
expression = self.good_simple_expression

View File

@ -19,7 +19,7 @@ Paste>=2.0.2 # MIT
PasteDeploy>=1.5.0 # MIT
pbr!=2.1.0,>=2.0.0 # Apache-2.0
six>=1.12.0 # MIT
pyparsing>=2.1.0 # MIT
pyparsing>=3.0.6 # MIT
voluptuous>=0.11.1 # BSD License
eventlet!=0.18.3,!=0.20.1,!=0.21.0,!=0.23.0,!=0.25.0,>=0.18.2 # MIT
monasca-common>=2.16.0 # Apache-2.0