Skip to content

Commit

Permalink
chore: remove Boolean constants
Browse files Browse the repository at this point in the history
  • Loading branch information
dodumosu committed Jun 19, 2021
1 parent 238991f commit e63a8b5
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions apollo/submissions/qa/query_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -30,10 +29,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)*
Expand Down Expand Up @@ -232,12 +229,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:
Expand Down Expand Up @@ -293,12 +284,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
Expand Down

0 comments on commit e63a8b5

Please sign in to comment.