

def get_bool_var(self):
    '\n        Returns either a variable by itself or a non-boolean operation (such as\n        ``x == 0`` or ``x < 0``).\n\n        This is needed to keep correct precedence for boolean operations (i.e.\n        ``x or x == 0`` should be ``x or (x == 0)``, not ``(x or x) == 0``).\n        '
    var = self.get_var()
    if (not self.at_end()):
        op_token = self.get_token(lookahead=True)[0]
        if (isinstance(op_token, basestring) and (op_token not in BOOL_OPERATORS)):
            (op, negate) = self.get_operator()
            return op(var, self.get_var(), negate=negate)
    return var

dataset/ETHPy150Open aehlke/manabi/apps/utils/templatetags/smartif.py IfParser.get_bool_var/original