Calculate row number of a sequence expression.

    :param expr: expression for calculation
    :param sort: name of the sort column
    :param ascending: whether to sort in ascending order
    :return: calculated column
504703
def row_number(expr, sort=None, ascending=True):
    
    return _rank_op(expr, RowNumber, types.int64, sort=sort, ascending=ascending)
293186
public static Object calculateGuess(JCExpression expr) {
		if (expr instanceof JCLiteral) {
			JCLiteral lit = (JCLiteral) expr;
			if (lit.getKind() == com.sun.source.tree.Tree.Kind.BOOLEAN_LITERAL) {
				return ((Number) lit.value).intValue() == 0 ? false : true;
			}
			return lit.value;
		}
		
		if (expr instanceof JCIdent || expr instanceof JCFieldAccess) {
			String x = expr.toString();
			if (x.endsWith(".class")) return new ClassLiteral(x.substring(0, x.length() - 6));
			int idx = x.lastIndexOf('.');
			if (idx > -1) x = x.substring(idx + 1);
			return new FieldSelect(x);
		}
		
		return null;
	}
618869
public static <S extends Sequence<S>> int calculateScore(S seq1, Range seq1Range, Mutations<S> mutations,
                                                             AlignmentScoring<S> scoring) {
        if (scoring instanceof LinearGapAlignmentScoring)
            return calculateScore(seq1, seq1Range, mutations, (LinearGapAlignmentScoring<S>) scoring);
        else if (scoring instanceof AffineGapAlignmentScoring)
            return calculateScore(seq1, seq1Range, mutations, (AffineGapAlignmentScoring<S>) scoring);
        else
            throw new IllegalArgumentException("Unknown scoring type");
    }
415831
function getKinesisSequenceNumber(record) {
  return record && record.kinesis && record.kinesis.sequenceNumber ? record.kinesis.sequenceNumber : '';
}
770990
def p_expr_list_assign(p):
    ''
    p[0] = ast.ListAssignment(p[3], p[6], lineno=p.lineno(1))
746863
def p_expression_greatereq(self, p):
        ''
        p[0] = GreaterEq(p[1], p[3], lineno=p.lineno(1))
        p.set_lineno(0, p.lineno(1))
407685
def preorder_iter_with_position(expression):
    
    yield expression, ()
    if isinstance(expression, Operation):
        for i, operand in enumerate(op_iter(expression)):
            for child, pos in preorder_iter_with_position(operand):
                yield child, (i, ) + pos
975164
def max_number(self, rows: List[Row], column: NumberColumn) -> Number:
        
        cell_values = [row.values[column.name] for row in rows]
        if not cell_values:
            return 0.0  # type: ignore
        if not all([isinstance(value, Number) for value in cell_values]):
            raise ExecutionError(f"Invalid values for number selection function: {cell_values}")
        return max(cell_values)
129735
def calc_columns_rows(n):
    
    num_columns = int(ceil(sqrt(n)))
    num_rows = int(ceil(n / float(num_columns)))
    return (num_columns, num_rows)
1036244
def sort_values(self, ascending=False):
        
        if self.index_type is not None:
            index_expr = grizzly_impl.get_field(self.expr, 0)
            column_expr = grizzly_impl.get_field(self.expr, 1)
            zip_expr = grizzly_impl.zip_columns([index_expr, column_expr])
            result_expr = grizzly_impl.sort(zip_expr, 1, self.weld_type, ascending)
            unzip_expr = grizzly_impl.unzip_columns(
                result_expr,
                [self.index_type, self.weld_type]
            )
            return SeriesWeld(
                unzip_expr,
                self.weld_type,
                self.df,
                self.column_name,
                self.index_type,
                self.index_name
            )
        else:
            result_expr = grizzly_impl.sort(self.expr)
296831
def parse_expr(tokens, options):
    """"""
    seq = parse_seq(tokens, options)
    if tokens.current() != '|':
        return seq
    result = [Required(*seq)] if len(seq) > 1 else seq
    while tokens.current() == '|':
        tokens.move()
        seq = parse_seq(tokens, options)
        result += [Required(*seq)] if len(seq) > 1 else seq
    return [Either(*result)] if len(result) > 1 else result
15906
def p_expr1(p):
    
    p[0] = node.expr(op=p[1], args=node.expr_list([p[2]]))
241743
def query(self, expr, **kwargs):
        
        columns = self.columns

        def query_builder(df, **kwargs):
            # This is required because of an Arrow limitation
            # TODO revisit for Arrow error
            df = df.copy()
            df.index = pandas.RangeIndex(len(df))
            df.columns = columns
            df.query(expr, inplace=True, **kwargs)
            df.columns = pandas.RangeIndex(len(df.columns))
            return df

        func = self._prepare_method(query_builder, **kwargs)
        new_data = self._map_across_full_axis(1, func)
        # Query removes rows, so we need to update the index
        new_index = self.compute_index(0, new_data, True)

        return self.__constructor__(new_data, new_index, self.columns, self.dtypes)
48155
public static <T extends Number & Comparable<?>> NumberExpression<T> asNumber(Expression<T> expr) {
        Expression<T> underlyingMixin = ExpressionUtils.extract(expr);
        if (underlyingMixin instanceof PathImpl) {
            return new NumberPath<T>((PathImpl<T>) underlyingMixin);
        } else if (underlyingMixin instanceof OperationImpl) {
            return new NumberOperation<T>((OperationImpl<T>) underlyingMixin);
        } else if (underlyingMixin instanceof TemplateExpressionImpl) {
            return new NumberTemplate<T>((TemplateExpressionImpl<T>) underlyingMixin);
        } else {
            return new NumberExpression<T>(underlyingMixin) {

                private static final long serialVersionUID = -8712299418891960222L;

                @Override
                public <R, C> R accept(Visitor<R, C> v, C context) {
                    return this.mixin.accept(v, context);
                }

            };
        }
    }
1065333
def sequence(values):
    
    import ibis.expr.operations as ops

    return ops.ValueList(values).to_expr()
1094090
def INIT_LIST_EXPR(self, cursor):
        """"""
        values = [self.parse_cursor(child)
                  for child in list(cursor.get_children())]
        return values
909674
def _isin(expr, values):
    

    from .merge import _make_different_sources

    if isinstance(values, SequenceExpr):
        expr, values = _make_different_sources(expr, values)

    if isinstance(expr, SequenceExpr):
        return IsIn(_input=expr, _values=values, _data_type=types.boolean)
    elif isinstance(expr, Scalar):
        return IsIn(_input=expr, _values=values, _value_type=types.boolean)