From 7b10ce7df857f4910d32814b0178492eb420f2c3 Mon Sep 17 00:00:00 2001 From: Odumosu 'Dipo Date: Mon, 25 May 2020 13:40:06 +0100 Subject: [PATCH] chore: remove Boolean constants --- apollo/submissions/qa/query_builder.py | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/apollo/submissions/qa/query_builder.py b/apollo/submissions/qa/query_builder.py index 1ac4fe730..9b6f3fb95 100644 --- a/apollo/submissions/qa/query_builder.py +++ b/apollo/submissions/qa/query_builder.py @@ -6,8 +6,7 @@ from arpeggio import PTNodeVisitor, visit_parse_tree from arpeggio.cleanpeg import ParserPEG -from sqlalchemy import ( - Integer, String, and_, case, false, func, null, or_, true) +from sqlalchemy import Integer, String, and_, case, false, func, null, or_ from sqlalchemy.dialects.postgresql import array from sqlalchemy.sql.operators import concat_op @@ -29,10 +28,8 @@ name = r'[a-zA-Z_][a-zA-Z0-9_]*' lookup = "$" ("location" / "participant" / "submission") ("." / "@") name null = "NULL" -true = "TRUE" -false = "FALSE" factor = ("+" / "-")? (number / variable / lookup / "(" expression ")") -value = null / true / false / factor +value = null / factor exponent = value (("^") value)* product = exponent (("*" / "/") exponent)* sum = product (("+" / "-") product)* @@ -230,12 +227,6 @@ def __init__(self, defaults=True, **kwargs): self.submission = kwargs.pop('submission') super().__init__(defaults, **kwargs) - def visit_false(self, node, children): - return False, OperandType.BOOLEAN - - def visit_true(self, node, children): - return True, OperandType.BOOLEAN - def visit_variable(self, node, children): var_name = node.value if var_name not in self.form.tags: @@ -291,12 +282,6 @@ def __init__(self, defaults=True, **kwargs): self.variables = set() super().__init__(defaults, **kwargs) - def visit_false(self, node, children): - return false(), OperandType.BOOLEAN - - def visit_true(self, node, children): - return true(), OperandType.BOOLEAN - def visit_lookup(self, node, children): top_level_attr, symbol, name = children op_type = OperandType.NUMERIC