Gnm.Expr

Fields

Name

Type

Access

Description

array_corner

Gnm.ExprArrayCorner

r/w

array_elem

Gnm.ExprArrayElem

r/w

binary

Gnm.ExprBinary

r/w

cellref

Gnm.ExprCellRef

r/w

constant

Gnm.ExprConstant

r/w

func

Gnm.ExprFunction

r/w

name

Gnm.ExprName

r/w

set

Gnm.ExprSet

r/w

unary

Gnm.ExprUnary

r/w

Methods

class

cell_deriv (y, x)

class

cell_deriv_value (y, x)

class

conv_quote (convs, str)

class

deriv_shutdown_ ()

class

lex_all (str, pp, flags, convs)

class

list_as_string (argc, argv, out)

class

list_copy (list)

class

list_unref (list)

class

new_cellref (cr)

class

new_constant (v)

class

new_funcall (func, args)

class

new_funcall1 (func, arg0)

class

new_funcall2 (func, arg0, arg1)

class

new_funcall3 (func, arg0, arg1, arg2)

class

new_funcall4 (func, arg0, arg1, arg2, arg3)

class

new_funcall5 (func, arg0, arg1, arg2, arg3, arg4)

class

new_name (name, sheet_scope, wb_scope)

class

new_set (args)

class

new_unary (op, e)

class

parse_str (str, pp, flags, convs, error)

as_gstring (out)

as_string (pp, convs)

contains_subtotal ()

copy ()

deriv (ep, info)

deriv_chain (deriv, ep, info)

deriv_collect (ep, info)

equal (b)

eval (pos, flags)

free ()

get_cellref ()

get_constant ()

get_func_arg (i)

get_func_def ()

get_name ()

get_range ()

is_data_table (c_in, r_in)

is_empty ()

is_rangeref ()

new_binary (op, r)

new_range_ctor (r)

simplify_if ()

walk (walker, user)

Details

class Gnm.Expr
classmethod cell_deriv(y, x)
Parameters:
Returns:

The derivative of cell y with respect to cell x.

Return type:

Gnm.ExprTop or None

classmethod cell_deriv_value(y, x)
Parameters:
Returns:

The derivative of cell y with respect to cell x at the current GOffice.value of x. Returns NaN on error.

Return type:

float

classmethod conv_quote(convs, str)
Parameters:
Returns:

A quoted string according to convs. If no quoting is necessary, a literal copy of str will be returned.

Return type:

GLib.String

classmethod deriv_shutdown_()
classmethod lex_all(str, pp, flags, convs)
Parameters:
Return type:

Gnm.LexerItem

classmethod list_as_string(argc, argv, out)
Parameters:
classmethod list_copy(list)
Parameters:

list ([object]) – list of expressions

Returns:

a copy of the list and all the expressions in it.

Return type:

[object]

classmethod list_unref(list)
Parameters:

list ([object]) – expression list

This frees list and all the expressions in it.

classmethod new_cellref(cr)
Parameters:

cr (Gnm.CellRef) – cell reference

Returns:

expression referencing cr.

Return type:

Gnm.Expr

classmethod new_constant(v)
Parameters:

v (Gnm.Value) – Gnm.Value

Returns:

constant expression.

Return type:

Gnm.Expr

classmethod new_funcall(func, args)
Parameters:
Returns:

function call expression.

Return type:

Gnm.Expr

classmethod new_funcall1(func, arg0)
Parameters:
Returns:

function call expression.

Return type:

Gnm.Expr

classmethod new_funcall2(func, arg0, arg1)
Parameters:
Returns:

function call expression.

Return type:

Gnm.Expr

classmethod new_funcall3(func, arg0, arg1, arg2)
Parameters:
Returns:

function call expression.

Return type:

Gnm.Expr

classmethod new_funcall4(func, arg0, arg1, arg2, arg3)
Parameters:
Returns:

function call expression.

Return type:

Gnm.Expr

classmethod new_funcall5(func, arg0, arg1, arg2, arg3, arg4)
Parameters:
Returns:

function call expression.

Return type:

Gnm.Expr

classmethod new_name(name, sheet_scope, wb_scope)
Parameters:
Return type:

Gnm.Expr

classmethod new_set(args)
Parameters:

args ([object]) – element list

Returns:

set expression.

Return type:

Gnm.Expr

classmethod new_unary(op, e)
Parameters:
Returns:

Unary expression

Return type:

Gnm.Expr

classmethod parse_str(str, pp, flags, convs, error)
Parameters:
Return type:

Gnm.ExprTop

as_gstring(out)
Parameters:

out (Gnm.ConventionsOut) – output conventions

Renders the expression as a string according to out and places the result in out's accumulator.

as_string(pp, convs)
Parameters:
Returns:

self as a string.

Return type:

str

Renders the expression as a string according to convs.

contains_subtotal()
Return type:

bool

copy()
Returns:

A deep copy of self.

Return type:

Gnm.Expr

deriv(ep, info)
Parameters:
Returns:

the derivative of self with respect to info.

Return type:

Gnm.Expr or None

deriv_chain(deriv, ep, info)
Parameters:
Returns:

the derivative of self with respect to info.

Return type:

Gnm.Expr or None

Applies the chain rule to self.

deriv_collect(ep, info)
Parameters:
Returns:

list of expressions expanded from self

Return type:

[Gnm.Expr]

equal(b)
Parameters:

b (Gnm.Expr) – first Gnm.Expr

Returns:

True, if the supplied expressions are exactly the same and False otherwise. No eval position is used to see if they are effectively the same. Named expressions must refer the same name, having equivalent names is insufficient.

Return type:

bool

eval(pos, flags)
Parameters:
Returns:

result.

Return type:

Gnm.Value

Evaluatates the given expression. If Gnm.ExprEvalFlags.PERMIT_EMPTY is not set then return zero if the expression instead of the empty GOffice.value, or the GOffice.value of an unused cell.

free()

Deletes self with all its subexpressions.

get_cellref()
Returns:

If this expression consists of just a cell reference, return it. Otherwise, None.

Return type:

Gnm.CellRef or None

get_constant()
Returns:

If this expression consists of just a constant, return it. Otherwise, None.

Return type:

Gnm.Value or None

get_func_arg(i)
Parameters:

i (int) – argument index

Returns:

the i'th argument of the function call self.

Return type:

Gnm.Expr

get_func_def()
Returns:

the called function.

Return type:

Gnm.Func

get_name()
Returns:

If this expression consists of just a name, return it. Otherwise, None.

Return type:

Gnm.NamedExpr or None

get_range()
Returns:

If this expression contains a single range, return it. Otherwise, None. A cell reference is returned as a singleton range.

Return type:

Gnm.Value or None

is_data_table(c_in, r_in)
Parameters:
Return type:

bool

is_empty()
Returns:

True if self is a constant expression with the empty GOffice.value.

Return type:

bool

is_rangeref()
Returns:

True if the expression can generate a reference. NOTE: in the future it would be nice to know if a function can return a reference to tighten that up a bit.

Return type:

bool

new_binary(op, r)
Parameters:
Returns:

Binary expression

Return type:

Gnm.Expr

new_range_ctor(r)
Parameters:

r (Gnm.Expr) – end range

Returns:

And expression referencing self to r.

Return type:

Gnm.Expr

This function builds a range constructor or something simpler, but equivalent, if the arguments allow it.

simplify_if()
Returns:

simpler expression.

Return type:

Gnm.Expr or None

Simplifies self if it is a call to “if” with a constant condition.

walk(walker, user)
Parameters:
Returns:

transformed expression.

This function walks the expression and calls the walker function for each subexpression. If the walker returns a non-None expression, a new expression is built.

The walker will be called for an expression before its subexpressions. It will receive the expression as its first argument and a Gnm.ExprWalk pointer as its second. It may set the stop flag to terminate the walk in which case Gnm.Expr.walk will return None.

Return type:

Gnm.Expr or None