Parses a cell according to its cell.value_type.
353984
def parse_cell(self, cell, coords, cell_mode=CellMode.cooked):
    """"""
    # pylint: disable=too-many-return-statements
    if cell_mode == CellMode.cooked:
      if cell.covered or cell.value_type is None or cell.value is None:
        return None

      vtype = cell.value_type

      if vtype == 'string':
        return cell.value

      if vtype == 'float' or vtype == 'percentage' or vtype == 'currency':
        return cell.value

      if vtype == 'boolean':
        return cell.value

      if vtype == 'date':
        date_tuple = tuple([int(i) if i is not None else 0 \
                            for i in _DATE_REGEX.match(cell.value).groups()])
        return self.tuple_to_datetime(date_tuple)

      if vtype == 'time':
        hour, minute, second = _TIME_REGEX.match(cell.value).groups()
        # TODO: This kills off the microseconds
        date_tuple = (0, 0, 0, int(hour), int(minute), round(float(second)))
        return self.tuple_to_datetime(date_tuple)

      raise ValueError("Unhandled cell type: {0}".format(vtype))
    else:
      return cell
669165
def _convert_value(self, column, value):
        ''''''

        if isinstance(value, GObject.Value):
            return value
        return GObject.Value(self.get_column_type(column), value)
817631
private short getCellType(String value)
    {
        short ret = STRING_TYPE;

        if(value.equals("number"))
            ret = NUMBER_TYPE;
        else if(value.equals("datetime"))
            ret = DATETIME_TYPE;
        else if(value.equals("boolean"))
            ret = BOOLEAN_TYPE;

        return ret;
    }
426499
def value_type(value):
    
    try:
        keys = list(value.keys())
    except AttributeError:
        return "simple"
    if keys in [["lookup"], ["re_lookup"], ["interval"]]:
        return keys[0]
    raise ValueError("Type of `value` could not be determined")
1099475
def ParseCellSpec (spec):
        """"""
        m = __specRe.match(spec)
        (column, row) = m.groups()
        return (int(row), ColumnToIndex(column))
1269961
function parseValueOfType(value, type, options) {
  switch (type) {
    case String:
      return { value }

    case Number:
    case 'Integer':
    case Integer:
      // The global isFinite() function determines
      // whether the passed value is a finite number.
      // If  needed, the parameter is first converted to a number.
      if (!isFinite(value)) {
        return { error: 'invalid' }
      }
      if (type === Integer && !isInteger(value)) {
        return { error: 'invalid' }
      }
      // Convert strings to numbers.
      // Just an additional feature.
      // Won't happen when called from `readXlsx()`.
      if (typeof value === 'string') {
        value = parseFloat(value)
      }
      return { value }

    case 'URL':
    case URL:
      if (!isURL(value)) {
        return { error: 'invalid' }
      }
      return { value }

    case 'Email':
    case Email:
      if (!isEmail(value)) {
        return { error: 'invalid' }
      }
      return { value }

    case Date:
      // XLSX has no specific format for dates.
      // Sometimes a date can be heuristically detected.
      // https://github.com/catamphetamine/read-excel-file/issues/3#issuecomment-395770777
      if (value instanceof Date) {
        return { value }
      }
      if (typeof value === 'number') {
        if (!isFinite(value)) {
          return { error: 'invalid' }
        }
        value = parseInt(value)
        const date = parseDate(value, options.properties)
        if (!date) {
          return { error: 'invalid' }
        }
        return { value: date }
      }
      return { error: 'invalid' }

    case Boolean:
      if (typeof value === 'boolean') {
        return { value }
      }
      return { error: 'invalid' }

    default:
      throw new Error(`Unknown schema type: ${type && type.name || type}`)
  }
}
963731
def parse_value(self, sn: "DataNode") -> ScalarValue:
        """"""
        res = sn.type.parse_value(self.value)
        if res is None:
            raise InvalidKeyValue(self.value)
        return res
1159639
@SuppressWarnings("unchecked")
	private <T> T toType(String cell,DataType  dataType)
	{
		
		switch(dataType)
		{
			case Long: return cell != null && cell.length() > 0 ? (T)Long.valueOf(cell) : (T)Long.valueOf(-1); 
			default: return (T)cell;
		}
	}
472468
def parse_primative_type(value, return_type)
    return value.to_i if return_type == Fixnum
    return value.to_d if return_type == Float
    return parse_date(value.to_s) if return_type == Time
    return value.to_s
  end
942474
def value(self, value):
        """"""
        dtype = TYPES[type(value)] if self._type is None else self._type

        lib.set_data_type(self._data, dtype)
        lib.set_data_value(self._data, self.clips_value(value))
529900
def check_cell_type(cell, cell_type):
    '''
    
    '''
    if cell_type == None or cell_type == type(None):
        return cell == None or (isinstance(cell, basestring) and not cell)
    else:
        return isinstance(cell, cell_type)
1235615
def _parse_bool(self, value):
        """"""
        if isinstance(value, string_types):
            return value.strip().lower() in ['true', '1', 't', 'y', 'yes']
        return bool(value)
839702
def _parse_phone(self, val):
        

        ret = {
            'type': None,
            'value': None
        }

        try:

            ret['type'] = val[1]['type']

        except (IndexError, KeyError, ValueError, TypeError):

                pass

        ret['value'] = val[3].strip()

        try:

            self.vars['phone'].append(ret)

        except AttributeError:

            self.vars['phone'] = []
            self.vars['phone'].append(ret)
738415
def parse_row(self):
        
        fields = self.mapping
        for i, cell in enumerate(self.row[0:len(fields)]):
            field_name, field_type = fields[str(i)]
            parsed_cell = self.clean_cell(cell, field_type)
            self.parsed_row[field_name] = parsed_cell
1216461
def parse_value(self, value):
        """"""
        parsed = super(IntField, self).parse_value(value)
        if parsed is None:
            return parsed
        return int(parsed)
646010
def get_value(self, spec, row):
        
        column = spec.get('column')
        default = spec.get('default')
        if column is None:
            if default is not None:
                return self.convert_type(default, spec)
            return
        value = row.get(column)
        if is_empty(value):
            if default is not None:
                return self.convert_type(default, spec)
            return None
        return self.convert_type(value, spec)
392412
public TypeBindException newTypeBindExceptionOnParse(final Exception error,  final Cell cell, final Object cellValue) {

        final String message = MessageBuilder.create("cell.typeBind.failParse")
                .var("property", field.getNameWithClass())
                .var("cellAddress", POIUtils.formatCellAddress(cell))
                .var("cellValue", cellValue.toString())
                .varWithClass("type", field.getType())
                .format();

        final TypeBindException bindException = new TypeBindException(error, message, field.getType(), cellValue);
        if(error instanceof TextParseException) {
            bindException.addAllMessageVars(((TextParseException)error).getErrorVariables());
        }

        return bindException;

    }