Implementation of :py:func:`pynspect.traversers.RuleTreeTraverser.binary_operation_logical` interface.
439145
def binary_operation_logical(self, rule, left, right, **kwargs):
        
        return LogicalBinOpRule(rule.operation, left, right)
1144007
def _and(ctx, *logical):
    
    for arg in logical:
        if not conversions.to_boolean(arg, ctx):
            return False
    return True
223762
def visit_BinaryOperation(self, node):
        """"""
        self.visit(node.left)
        self.visit(node.right)
616230
def visit_BinOp(self, node: ast.BinOp) -> Any:
        """"""
        # pylint: disable=too-many-branches
        left = self.visit(node=node.left)
        right = self.visit(node=node.right)

        if isinstance(node.op, ast.Add):
            result = left + right
        elif isinstance(node.op, ast.Sub):
            result = left - right
        elif isinstance(node.op, ast.Mult):
            result = left * right
        elif isinstance(node.op, ast.Div):
            result = left / right
        elif isinstance(node.op, ast.FloorDiv):
            result = left // right
        elif isinstance(node.op, ast.Mod):
            result = left % right
        elif isinstance(node.op, ast.Pow):
            result = left**right
        elif isinstance(node.op, ast.LShift):
            result = left << right
        elif isinstance(node.op, ast.RShift):
            result = left >> right
        elif isinstance(node.op, ast.BitOr):
            result = left | right
        elif isinstance(node.op, ast.BitXor):
            result = left ^ right
        elif isinstance(node.op, ast.BitAnd):
            result = left & right
        elif isinstance(node.op, ast.MatMult):
            result = left @ right
        else:
            raise NotImplementedError("Unhandled op of {}: {}".format(node, node.op))

        self.recomputed_values[node] = result
        return result
958229
def logical_operator(self, operation, word):
        
        word = self._parse_filter_word(word)
        self._add_filter(
            *self._prepare_sentence(self._attribute, operation, word,
                                    self._negation))
        return self
965412
def conditions(self):
        
        return operatorPrecedence(
            baseExpr=self.condition,
            opList=[(self.not_op, 1, opAssoc.RIGHT),
                    (self.logical_binary_op, 2, opAssoc.LEFT)],
            lpar=self.syntax.paren_left,
            rpar=self.syntax.paren_right)
373628
public static Object toBoolean(byte t_logical) {
		if (t_logical == 'Y' || t_logical == 'y' || t_logical == 'T' || t_logical == 't') {
			return Boolean.TRUE;
		} else if (t_logical == 'N' || t_logical == 'n' || t_logical == 'F' || t_logical == 'f') {
			return Boolean.FALSE;
		}
		return null;
	}
1071481
def _calculate_operation_math(self, rule, left, right):
        

        # Attempt to keep integer data type for the result, when possible.
        if isinstance(left, IntegerRule) and isinstance(right, IntegerRule):
            result = self.evaluate_binop_math(rule.operation, left.value, right.value)
            if isinstance(result, list):
                return ListRule([IntegerRule(r) for r in result])
            return IntegerRule(result)

        # Otherwise the result is float.
        if isinstance(left, NumberRule) and isinstance(right, NumberRule):
            result = self.evaluate_binop_math(rule.operation, left.value, right.value)
            if isinstance(result, list):
                return ListRule([FloatRule(r) for r in result])
            return FloatRule(result)

        # This point should never be reached.
        raise Exception()
279567
def binary_operation_math(self, rule, left, right, **kwargs):
        
        if isinstance(left, NumberRule) and isinstance(right, NumberRule):
            return self._calculate_operation_math(rule, left, right)
        return self._compile_operation_rule(
            rule,
            left,
            right,
            MathBinOpRule
        )
143162
def parse_negation_operation(operation: str) -> Tuple[bool, str]:
    """"""
    _operation = operation.strip()
    if not _operation:
        raise QueryParserException('Operation is not valid: {}'.format(operation))
    negation = False
    if _operation[0] == '~':
        negation = True
        _operation = _operation[1:]

    return negation, _operation.strip()
608606
@Nonnull
	public static LLogicalOperator logicalOperatorFrom(Consumer<LLogicalOperatorBuilder> buildingFunction) {
		LLogicalOperatorBuilder builder = new LLogicalOperatorBuilder();
		buildingFunction.accept(builder);
		return builder.build();
	}
928192
def logical_and_expr(self):
        
        node = self.logical_not_expr()

        while self.token.nature == Nature.AND:
            token = self.token
            self._process(Nature.AND)

            node = BinaryOperation(left=node, op=token, right=self.logical_not_expr())

        return node
60153
def _process_binary_trigger(trigger_value, condition):
    """"""

    ops = {
        0: ">",
        1: "<",
        2: ">=",
        3: "<=",
        4: "==",
        5: 'always'
    }

    sources = {
        0: 'value',
        1: 'count'
    }

    encoded_source = condition & 0b1
    encoded_op = condition >> 1

    oper = ops.get(encoded_op, None)
    source = sources.get(encoded_source, None)

    if oper is None:
        raise ArgumentError("Unknown operation in binary trigger", condition=condition, operation=encoded_op, known_ops=ops)
    if source is None:
        raise ArgumentError("Unknown value source in binary trigger", source=source, known_sources=sources)

    if oper == 'always':
        return TrueTrigger()

    return InputTrigger(source, oper, trigger_value)
761417
private SemanticType checkIntegerOperator(Expr.BinaryOperator expr, Environment environment) {
		checkOperand(Type.Int, expr.getFirstOperand(), environment);
		checkOperand(Type.Int, expr.getSecondOperand(), environment);
		return Type.Int;
	}
596728
def t_op(self, s):
        '

        # Operators need to be further classified since the grammar requires this
        if s in ('<', '>', '==', '>=', '<=', '<>', '!='):
            self.add_token('COMP_OP', s)
        elif s in ('+=', '-=', '*=', '/=', '%=', '&=', '|=', '^=', '<<=', '>>=', '**=',
                   '//='):
            self.add_token('AUGASSIGN', s)
        elif s in self.UNOP2NAME.keys():
            self.add_token(self.UNOP2NAME[s], s)
        elif s in ('|', '^', '&', '<<', '>>', '**', '/', '%', '//'):
            # These are  *ONLY* binary operators. Operators which are exclusively or
            # can be unary operators were handled previously
            self.add_token('BINOP', s)
        elif s == '=':
            self.add_token('EQUAL', s)
        else:
            print("Internal error: Unknown operator %s" % s)
            raise SystemExit
1188534
def visit_BinOp(self, node: AST, dfltChaining: bool = True) -> str:
        """"""
        op = node.op
        with self.op_man(op):
            if isinstance(op, ast.Pow):
                # Pow chains right-to-left
                src = self.visit(op).join((self.visit(node.left,
                                                      dfltChaining=False),
                                           self.visit(node.right)))
            else:
                src = self.visit(op).join((self.visit(node.left),
                                           self.visit(node.right,
                                                      dfltChaining=False)))
            return self.wrap_expr(src, dfltChaining)
758112
def logical_binary_op(self):
        
        return (CaselessKeyword(self.syntax.and_op) |
                CaselessKeyword(self.syntax.or_op))