Evaluates one cell and returns its result
198679
def _eval_cell(self, key, code):
        """"""

        # Flatten helper function
        def nn(val):
            """Returns flat numpy arraz without None values"""
            try:
                return numpy.array(filter(None, val.flat))

            except AttributeError:
                # Probably no numpy array
                return numpy.array(filter(None, val))

        # Set up environment for evaluation

        env_dict = {'X': key[0], 'Y': key[1], 'Z': key[2], 'bz2': bz2,
                    'base64': base64, 'charts': charts, 'nn': nn,
                    'R': key[0], 'C': key[1], 'T': key[2], 'S': self,
                    'vlcpanel_factory': vlcpanel_factory}
        env = self._get_updated_environment(env_dict=env_dict)

        #_old_code = self(key)

        # Return cell value if in safe mode

        if self.safe_mode:
            return code

        # If cell is not present return None

        if code is None:
            return

        elif is_generator_like(code):
            # We have a generator object

            return numpy.array(self._make_nested_list(code), dtype="O")

        # If only 1 term in front of the "=" --> global

        try:
            assignment_target_error = None
            module = ast.parse(code)
            assignment_target_end = self._get_assignment_target_end(module)

        except ValueError, err:
            assignment_target_error = ValueError(err)

        except AttributeError, err:
            # Attribute Error includes RunTimeError
            assignment_target_error = AttributeError(err)

        except Exception, err:
            assignment_target_error = Exception(err)

        if assignment_target_error is None and assignment_target_end != -1:
            glob_var = code[:assignment_target_end]
            expression = code.split("=", 1)[1]
            expression = expression.strip()

            # Delete result cache because assignment changes results
            self.result_cache.clear()

        else:
            glob_var = None
            expression = code

        if assignment_target_error is not None:
            result = assignment_target_error

        else:

            try:
                import signal

                signal.signal(signal.SIGALRM, self.handler)
                signal.alarm(config["timeout"])

            except:
                # No POSIX system
                pass

            try:
                result = eval(expression, env, {})

            except AttributeError, err:
                # Attribute Error includes RunTimeError
                result = AttributeError(err)

            except RuntimeError, err:
                result = RuntimeError(err)

            except Exception, err:
                result = Exception(err)

            finally:
                try:
                    signal.alarm(0)
                except:
                    # No POSIX system
                    pass

        # Change back cell value for evaluation from other cells
        #self.dict_grid[key] = _old_code

        if glob_var is not None:
            globals().update({glob_var: result})

        return result
488657
static String toValue(Cell cell, List<CellProcessor> cellProcessors) {
    String value;
    switch (cell.getCellTypeEnum()) {
      case BLANK:
        value = null;
        break;
      case STRING:
        value = cell.getStringCellValue();
        break;
      case NUMERIC:
        if (DateUtil.isCellDateFormatted(cell)) {
          try {
            // Excel dates are LocalDateTime, stored without timezone.
            // Interpret them as UTC to prevent ambiguous DST overlaps which happen in other
            // timezones.
            LocaleUtil.setUserTimeZone(LocaleUtil.TIMEZONE_UTC);
            Date dateCellValue = cell.getDateCellValue();
            value = formatUTCDateAsLocalDateTime(dateCellValue);
          } finally {
            LocaleUtil.resetUserTimeZone();
          }
        } else {
          // excel stores integer values as double values
          // read an integer if the double value equals the
          // integer value
          double x = cell.getNumericCellValue();
          if (x == Math.rint(x) && !Double.isNaN(x) && !Double.isInfinite(x))
            value = String.valueOf((long) x);
          else value = String.valueOf(x);
        }
        break;
      case BOOLEAN:
        value = String.valueOf(cell.getBooleanCellValue());
        break;
      case FORMULA:
        // evaluate formula
        FormulaEvaluator evaluator =
            cell.getSheet().getWorkbook().getCreationHelper().createFormulaEvaluator();
        CellValue cellValue;
        try {
          cellValue = evaluator.evaluate(cell);
        } catch (StackOverflowError e) {
          LOG.error("StackOverflowError evaluating formula", e);
          throw new RuntimeException(
              "Error evaluating formula, possibly due to deep formula nesting.");
        }
        switch (cellValue.getCellTypeEnum()) {
          case BOOLEAN:
            value = String.valueOf(cellValue.getBooleanValue());
            break;
          case NUMERIC:
            if (DateUtil.isCellDateFormatted(cell)) {
              try {
                // Excel dates are LocalDateTime, stored without timezone.
                // Interpret them as UTC to prevent ambiguous DST overlaps which happen in other
                // timezones.
                LocaleUtil.setUserTimeZone(LocaleUtil.TIMEZONE_UTC);
                Date javaDate = DateUtil.getJavaDate(cellValue.getNumberValue(), false);
                value = formatUTCDateAsLocalDateTime(javaDate);

              } finally {
                LocaleUtil.resetUserTimeZone();
              }
            } else {
              // excel stores integer values as double values
              // read an integer if the double value equals the
              // integer value
              double x = cellValue.getNumberValue();
              if (x == Math.rint(x) && !Double.isNaN(x) && !Double.isInfinite(x))
                value = String.valueOf((long) x);
              else value = String.valueOf(x);
            }
            break;
          case STRING:
            value = cellValue.getStringValue();
            break;
          case BLANK:
            value = null;
            break;
          default:
            throw new MolgenisDataException(
                "unsupported cell type: " + cellValue.getCellTypeEnum());
        }
        break;
      default:
        throw new MolgenisDataException("unsupported cell type: " + cell.getCellTypeEnum());
    }

    return AbstractCellProcessor.processCell(value, false, cellProcessors);
  }
506348
public static function COUNT()
    {
        $returnValue = 0;

        // Loop through arguments
        $aArgs = PHPExcel_Calculation_Functions::flattenArrayIndexed(func_get_args());
        foreach ($aArgs as $k => $arg) {
            if ((is_bool($arg)) &&
                ((!PHPExcel_Calculation_Functions::isCellValue($k)) || (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE))) {
                $arg = (integer) $arg;
            }
            // Is it a numeric value?
            if ((is_numeric($arg)) && (!is_string($arg))) {
                ++$returnValue;
            }
        }

        return $returnValue;
    }
1093849
def run_cell(self):
        """"""
        text, line = self.get_current_editor().get_cell_as_executable_code()
        self._run_cell_text(text, line)
690314
def evaluate(self, m):
        """"""

        g = m.groupdict()
        if g["strings"]:
            self.line_num += g['strings'].count('\n')
        elif g["code"]:
            self.line_num += g["code"].count('\n')
        else:
            if g['block']:
                self.evaluate_block(g)
            elif self.stylesheets != CSS:
                if g['start'] is None:
                    self.evaluate_inline_tail(g)
                else:
                    self.evaluate_inline(g)
            self.line_num += g['comments'].count('\n')
917083
def cells_diff(before_cells, after_cells, check_modified=False):
    ''''''
    before_comps = [
        CellComparator(cell, check_modified=check_modified)
        for cell in before_cells
    ]
    after_comps = [
        CellComparator(cell, check_modified=check_modified)
        for cell in after_cells
    ]
    diff_result = diff(
        before_comps,
        after_comps,
        check_modified=check_modified
    )
    return diff_result
163101
function(){
		this.decodeCell( function(cell,ca){
			if     (ca==="+"){ cell.qsub = 1;}
			else if(ca==="-"){ cell.qsub = 2;}
			else if(ca==="="){ cell.qsub = 3;}
			else if(ca==="%"){ cell.qsub = 4;}
			else if(ca!=="."){ cell.qans = +ca;}
		});
	}
77843
def arithm_expr_eval(cell, expr):
    
    if isinstance(expr, tuple):
        (left, op, right) = expr
        lval = arithm_expr_eval(cell, left)
        rval = arithm_expr_eval(cell, right)
        if op == '+':
            return lval + rval
        if op == '-':
            return lval - rval
        if op == '*':
            return lval * rval
        if op == '/':
            return lval // rval
    elif isinstance(expr, int):
        return expr
    else:
        cell[expr] = arithm_expr_eval(cell, cell[expr])
        return cell[expr]
60623
def pop_cell(self, idy=None, idx=None, tags=False):
        """"""
        idy = idy if idy is not None else len(self.body) - 1
        idx = idx if idx is not None else len(self.body[idy]) - 1
        cell = self.body[idy].pop(idx)
        return cell if tags else cell.childs[0]
140390
public static function COUNTBLANK()
    {
        $returnValue = 0;

        // Loop through arguments
        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
        foreach ($aArgs as $arg) {
            // Is it a blank cell?
            if ((is_null($arg)) || ((is_string($arg)) && ($arg == ''))) {
                ++$returnValue;
            }
        }

        return $returnValue;
    }
857420
def _get_column_cell_val(self, obj, column):
        
        name = column['name']
        return self._get_formatted_val(obj, name, column)
695177
function(){
		this.decodeCell( function(cell,ca){
			if     (ca==="-"){ cell.qnum = -2;}
			else if(ca!=="."){ cell.qnum = +ca;}
		});
	}
529912
def get_cell(self, coords, cell_mode=CellMode.cooked):
    
    return self.parse_cell(self.get_row(coords[1])[coords[0]], coords, cell_mode)
259823
void cell(Cell cell) {
        int left = cell.getLeft();
        int right = cell.getRight();
        // first see if we've got a cell past the last col
        if (right > realColumnCount) {
            // are we past last col entirely?
            if (left == realColumnCount) {
                // single col?
                if (left + 1 != right) {
                    appendColumnRange(new ColumnRange(cell.elementName(), cell, left + 1, right));
                }
                realColumnCount = right;
                return;
            } else {
                // not past entirely
                appendColumnRange(new ColumnRange(cell.elementName(), cell, realColumnCount, right));                
                realColumnCount = right;
            }
        }
        while (currentColRange != null) {
            int hit = currentColRange.hits(left);
            if (hit == 0) {
                ColumnRange newRange = currentColRange.removeColumn(left);
                if (newRange == null) {
                    // zap a list item
                    if (previousColRange != null) {
                        previousColRange.setNext(currentColRange.getNext());
                    }
                    if (first == currentColRange) {
                        first = currentColRange.getNext();
                    }
                    if (last == currentColRange) {
                        last = previousColRange;
                    }
                    currentColRange = currentColRange.getNext();
                } else {
                    if (last == currentColRange) {
                        last = newRange;
                    }
                    currentColRange = newRange;
                }
                return;
            } else if (hit == -1) {
                return;
            } else if (hit == 1) {
                previousColRange = currentColRange;
                currentColRange = currentColRange.getNext();                                
            }
        }
    }
820594
function(){
		var piece = this.getcell_excell(); /* piece : cell or excell */
		if(piece.isnull || (this.mouseCell===piece && !this.mouseend)){ return;}

		if(this.mousestart && (piece!==this.cursor.getobj() || piece.ques!==51)){
			this.setcursor(piece);
			this.mousereset();
		}
		else if((this.mousestart && this.cursor.getNumOfTarget(piece)<2) || this.mouseend){
			this.inputqnum_main(piece);
			this.mousereset();
		}
		else{
			this.mouseCell = piece;
			this.inputselect_cell51(piece);
		}
	}
1169246
function(name, value) {
    this.style[name] = value;
    this.eachCell(function(cell) {
      cell[name] = value;
    });
    return value;
  }
1158389
def get_cell(self, index, column):
        
        i = sorted_index(self._index, index) if self._sort else self._index.index(index)
        c = self._columns.index(column)
        return self._data[c][i]