Returns code for relational operator
           relop - relational operator
           operands_type - int or unsigned
359691
def relop_code(self, relop, operands_type):
        
        code = self.RELATIONAL_DICT[relop]
        offset = 0 if operands_type == SharedData.TYPES.INT else len(SharedData.RELATIONAL_OPERATORS)
        return code + offset
645772
def get_retcode(ret):
    '''
    
    '''
    retcode = 0
    # if there is a dict with retcode, use that
    if isinstance(ret, dict) and ret.get('retcode', 0) != 0:
        return ret['retcode']
    # if its a boolean, False means 1
    elif isinstance(ret, bool) and not ret:
        return 1
    return retcode
141858
def get_loc(data, attr={'lr_mult':'0.01'}):
    
    loc = mx.symbol.Convolution(data=data, num_filter=30, kernel=(5, 5), stride=(2,2))
    loc = mx.symbol.Activation(data = loc, act_type='relu')
    loc = mx.symbol.Pooling(data=loc, kernel=(2, 2), stride=(2, 2), pool_type='max')
    loc = mx.symbol.Convolution(data=loc, num_filter=60, kernel=(3, 3), stride=(1,1), pad=(1, 1))
    loc = mx.symbol.Activation(data = loc, act_type='relu')
    loc = mx.symbol.Pooling(data=loc, global_pool=True, kernel=(2, 2), pool_type='avg')
    loc = mx.symbol.Flatten(data=loc)
    loc = mx.symbol.FullyConnected(data=loc, num_hidden=6, name="stn_loc", attr=attr)
    return loc
1022111
def relation_operation(self):
        
        if len(self.nodes) > 0:
            rel_op = self.nodes[-1].relation_operation
        else:
            rel_op = None
        return rel_op
1316634
def _func_addrs_from_symbols(self):
        

        return {sym.rebased_addr for sym in self._binary.symbols if sym.is_function}
561850
def _operator_handling(self, cursor):
        """"""
        values = self._literal_handling(cursor)
        retval = ''.join([str(val) for val in values])
        return retval
1310955
function narrowType(type, expr, assumeTrue) {
                switch (expr.kind) {
                    case 69 /* Identifier */:
                    case 97 /* ThisKeyword */:
                    case 172 /* PropertyAccessExpression */:
                        return narrowTypeByTruthiness(type, expr, assumeTrue);
                    case 174 /* CallExpression */:
                        return narrowTypeByTypePredicate(type, expr, assumeTrue);
                    case 178 /* ParenthesizedExpression */:
                        return narrowType(type, expr.expression, assumeTrue);
                    case 187 /* BinaryExpression */:
                        return narrowTypeByBinaryExpression(type, expr, assumeTrue);
                    case 185 /* PrefixUnaryExpression */:
                        if (expr.operator === 49 /* ExclamationToken */) {
                            return narrowType(type, expr.operand, !assumeTrue);
                        }
                        break;
                }
                return type;
            }
645373
def unary_operator(op):
    
    # Only negate is currently supported.
    valid_ops = {'-'}
    if op not in valid_ops:
        raise ValueError("Invalid unary operator %s." % op)

    @with_doc("Unary Operator: '%s'" % op)
    @with_name(unary_op_name(op))
    def unary_operator(self):
        if self.dtype != float64_dtype:
            raise TypeError(
                "Can't apply unary operator {op!r} to instance of "
                "{typename!r} with dtype {dtypename!r}.\n"
                "{op!r} is only supported for Factors of dtype "
                "'float64'.".format(
                    op=op,
                    typename=type(self).__name__,
                    dtypename=self.dtype.name,
                )
            )

        # This can't be hoisted up a scope because the types returned by
        # unary_op_return_type aren't defined when the top-level function is
        # invoked.
        if isinstance(self, NumericalExpression):
            return NumExprFactor(
                "{op}({expr})".format(op=op, expr=self._expr),
                self.inputs,
                dtype=float64_dtype,
            )
        else:
            return NumExprFactor(
                "{op}x_0".format(op=op),
                (self,),
                dtype=float64_dtype,
            )
    return unary_operator
273288
static Object doubleBinaryOperation(double lhs, double rhs, int kind)
        throws UtilEvalError
    {
        switch(kind)
        {
            // arithmetic
            case PLUS:
                if ( lhs > 0d && (Double.MAX_VALUE - lhs) < rhs )
                    break;
                return lhs + rhs;

            case MINUS:
                if ( lhs < 0d && (-Double.MAX_VALUE - lhs) > -rhs )
                    break;
                return lhs - rhs;

            case STAR:
                if ( lhs != 0 && Double.MAX_VALUE / lhs < rhs )
                    break;
                return lhs * rhs;

            case SLASH:
                return lhs / rhs;

            case MOD:
            case MODX:
                return lhs % rhs;

            case POWER:
            case POWERX:
                double check = Math.pow(lhs, rhs);
                if ( Double.isInfinite(check) )
                    break;
                return check;

            // can't shift floating-point values
            case LSHIFT:
            case LSHIFTX:
            case RSIGNEDSHIFT:
            case RSIGNEDSHIFTX:
            case RUNSIGNEDSHIFT:
            case RUNSIGNEDSHIFTX:
                throw new UtilEvalError("Can't shift floatingpoint values");

        }
        if ( OVERFLOW_OPS.contains(kind) )
            return bigDecimalBinaryOperation(BigDecimal.valueOf(lhs), BigDecimal.valueOf(rhs), kind);

        throw new InterpreterError(
                "Unimplemented binary double operator");
    }
631299
def rem_or(self, start, end, instr, target=None, include_beyond_target=False):
        
        assert(start >= 0 and end <= len(self.code) and start <= end)

        # Find all offsets of requested instructions
        instr_offsets = self.inst_matches(start, end, instr, target,
                                          include_beyond_target)
        # Get all POP_JUMP_IF_TRUE (or) offsets
        if self.version == 3.0:
            jump_true_op = self.opc.JUMP_IF_TRUE
        else:
            jump_true_op = self.opc.POP_JUMP_IF_TRUE
        pjit_offsets = self.inst_matches(start, end, jump_true_op)
        filtered = []
        for pjit_offset in pjit_offsets:
            pjit_tgt = self.get_target(pjit_offset) - 3
            for instr_offset in instr_offsets:
                if instr_offset <= pjit_offset or instr_offset >= pjit_tgt:
                    filtered.append(instr_offset)
            instr_offsets = filtered
            filtered = []
        return instr_offsets
666728
def binary_operator(op):
    
    # When combining a Factor with a NumericalExpression, we use this
    # attrgetter instance to defer to the commuted implementation of the
    # NumericalExpression operator.
    commuted_method_getter = attrgetter(method_name_for_op(op, commute=True))

    @with_doc("Binary Operator: '%s'" % op)
    @with_name(method_name_for_op(op))
    @coerce_numbers_to_my_dtype
    def binary_operator(self, other):
        # This can't be hoisted up a scope because the types returned by
        # binop_return_type aren't defined when the top-level function is
        # invoked in the class body of Factor.
        return_type = binop_return_type(op)
        if isinstance(self, NumExprFactor):
            self_expr, other_expr, new_inputs = self.build_binary_op(
                op, other,
            )
            return return_type(
                "({left}) {op} ({right})".format(
                    left=self_expr,
                    op=op,
                    right=other_expr,
                ),
                new_inputs,
                dtype=binop_return_dtype(op, self.dtype, other.dtype),
            )
        elif isinstance(other, NumExprFactor):
            # NumericalExpression overrides ops to correctly handle merging of
            # inputs.  Look up and call the appropriate reflected operator with
            # ourself as the input.
            return commuted_method_getter(other)(self)
        elif isinstance(other, Term):
            if self is other:
                return return_type(
                    "x_0 {op} x_0".format(op=op),
                    (self,),
                    dtype=binop_return_dtype(op, self.dtype, other.dtype),
                )
            return return_type(
                "x_0 {op} x_1".format(op=op),
                (self, other),
                dtype=binop_return_dtype(op, self.dtype, other.dtype),
            )
        elif isinstance(other, Number):
            return return_type(
                "x_0 {op} ({constant})".format(op=op, constant=other),
                binds=(self,),
                # .dtype access is safe here because coerce_numbers_to_my_dtype
                # will convert any input numbers to numpy equivalents.
                dtype=binop_return_dtype(op, self.dtype, other.dtype)
            )
        raise BadBinaryOperator(op, self, other)

    return binary_operator
385250
def binary_operator(op):
    
    # When combining a Filter with a NumericalExpression, we use this
    # attrgetter instance to defer to the commuted interpretation of the
    # NumericalExpression operator.
    commuted_method_getter = attrgetter(method_name_for_op(op, commute=True))

    def binary_operator(self, other):
        if isinstance(self, NumericalExpression):
            self_expr, other_expr, new_inputs = self.build_binary_op(
                op, other,
            )
            return NumExprFilter.create(
                "({left}) {op} ({right})".format(
                    left=self_expr,
                    op=op,
                    right=other_expr,
                ),
                new_inputs,
            )
        elif isinstance(other, NumericalExpression):
            # NumericalExpression overrides numerical ops to correctly handle
            # merging of inputs.  Look up and call the appropriate
            # right-binding operator with ourself as the input.
            return commuted_method_getter(other)(self)
        elif isinstance(other, Term):
            if other.dtype != bool_dtype:
                raise BadBinaryOperator(op, self, other)
            if self is other:
                return NumExprFilter.create(
                    "x_0 {op} x_0".format(op=op),
                    (self,),
                )
            return NumExprFilter.create(
                "x_0 {op} x_1".format(op=op),
                (self, other),
            )
        elif isinstance(other, int):  # Note that this is true for bool as well
            return NumExprFilter.create(
                "x_0 {op} {constant}".format(op=op, constant=int(other)),
                binds=(self,),
            )
        raise BadBinaryOperator(op, self, other)

    binary_operator.__doc__ = "Binary Operator: '%s'" % op
    return binary_operator
991775
def _reverse_operator(self, op):
        
        op = copy.copy(op)
        op.reverse()
        # check that we can map it
        if not str(op) in self.MONGO_OPS:
            raise ValueError('unknown operator: {}'.format(op))
        return op
661300
def p_code(p):
    

    def asc(x):
        if len(x):
            return ord(x[0])

        return 0

    if p[2] is None:
        p[0] = None
        return

    if p[2].type_ != TYPE.string:
        api.errmsg.syntax_error_expected_string(p.lineno(1), TYPE.to_string(p[2].type_))
        p[0] = None
    else:
        p[0] = make_builtin(p.lineno(1), 'CODE', p[2], lambda x: asc(x), type_=TYPE.ubyte)
591016
def unary_set_expr(self, ctx, oper, postoper=False):
        
        if self.readonly:
            raise MuvError(
                "Cannot increment or decrement constant '%s'." % self.varname,
                position=self.position
            )
        varname = ctx.lookup_variable(self.varname)
        if varname is None:
            raise MuvError(
                "Undeclared identifier '%s'." % self.varname,
                position=self.position
            )
        if len(self.indexing) == 0:
            if postoper:
                fmt = "{var} @ {var} {oper}"
            else:
                fmt = "{var} dup {oper} @"
            return fmt.format(var=varname, oper=oper)
        if len(self.indexing) == 1:
            if ctx.target in ['fb7']:
                if postoper:
                    fmt = (
                        "{idx} {var} @ "
                        "dup 3 pick [] "
                        "dup -4 rotate {oper} "
                        "swap rot ->[] pop"
                    )
                else:
                    fmt = (
                        "{idx} {var} @ "
                        "dup 3 pick [] {oper} "
                        "dup -4 rotate "
                        "swap rot ->[] pop"
                    )
            else:
                if postoper:
                    fmt = (
                        "{idx} {var} @ "
                        "dup 3 pick [] "
                        "dup -4 rotate {oper} "
                        "swap rot ->[] {var} !"
                    )
                else:
                    fmt = (
                        "{idx} {var} @ "
                        "dup 3 pick [] {oper} "
                        "dup -4 rotate "
                        "swap rot ->[] {var} !"
                    )
            return fmt.format(
                var=varname,
                oper=oper,
                idx=self.indexing[0].generate_code(ctx),
            )
        if ctx.target in ['fb7']:
            if postoper:
                fmt = (
                    "{{ {idx} }}list {var} @ "
                    "dup 3 pick array_nested_get "
                    "dup -4 rotate {oper} "
                    "swap rot array_nested_set pop"
                )
            else:
                fmt = (
                    "{{ {idx} }}list {var} @ "
                    "dup 3 pick array_nested_get {oper} "
                    "dup -4 rotate "
                    "swap rot array_nested_set pop"
                )
        else:
            if postoper:
                fmt = (
                    "{{ {idx} }}list {var} @ "
                    "dup 3 pick array_nested_get "
                    "dup -4 rotate {oper} "
                    "swap rot array_nested_set {var} !"
                )
            else:
                fmt = (
                    "{{ {idx} }}list {var} @ "
                    "dup 3 pick array_nested_get {oper} "
                    "dup -4 rotate "
                    "swap rot array_nested_set {var} !"
                )
        return fmt.format(
            var=varname,
            oper=oper,
            idx=" ".join(
                x.generate_code(ctx)
                for x in self.indexing
            )
        )
13070
def p_expr_unary_op(p):
    ''''''
    p[0] = ast.UnaryOp(p[1], p[2], lineno=p.lineno(1))
839439
def convert_relational(relational):
    
    rel = relational.rel_op
    if rel in ['==', '>=', '>']:
        return relational.lhs-relational.rhs
    elif rel in ['<=', '<']:
        return relational.rhs-relational.lhs
    else:
        raise Exception("The relational operation ' + rel + ' is not "
                        "implemented!")