Sanity check for csv parser
        :param row
        :param length
        :return:None
435674
def _check_list_len(row, length):
        
        if len(row) != length:
            raise Exception(
                "row length does not match expected length of " +
                str(length) + "\nrow: " + str(row))
496735
def pretty_format_row(self, row, filler=" ", splitter="|"):
        
        return self.get_pretty_row(
            row,
            filler,
            splitter
        )
1107293
def parse
      response  = { errors: 0, status: 200, total_rows: 0, error_rows: []}
      index = 0
      batch = []

      begin
        CSV.foreach("#{@file_path}/#{@csv_file_name}", :encoding => 'iso-8859-1:UTF-8', headers: true) do |row|
          index += 1
          row_hash = row.to_hash
          response[:total_rows] += 1
          begin
            record, response[:errors], error_row = validate_record(response[:errors], row_hash, index)
            response[:error_rows] << error_row if error_row
              
            if @batch_process
              batch = add_to_batch(batch, record)
            else
              record.save!
            end
          rescue Exception => e
            response[:errors] +=1
            response[:error_rows] << log_and_return_error(row_hash, e, index)
          end
        end
        import_from_batch(batch)
      rescue Exception => e
        response[:errors] = 1
        response[:error_rows] = log_and_return_error({}, e, '')
        response[:status] = 500
      end

      if response[:error_rows].blank?
        post_parse_success_calls 
      elsif @error_file_needed
        error_in_upload(response[:error_rows])
      end

      response
    end
399451
def parse_csv_response(data, unit_handler):
    """"""
    return squish([parse_csv_dataset(d, unit_handler) for d in data.split(b'\n\n')])
100377
def verify_row(self, row):
        
        param = self._parameters[row]
        if param['parameter'] == '':
            return "Auto-parameter type undefined"
        if len(param['selection']) == 0:
            return "At least one component must be selected for each auto-parameter"
        if param['parameter'] not in self._selectionParameters(param):
            return 'Parameter {} not present in all selected components'.format(param['parameter'])
        if param['parameter'] == 'filename':
            if len(param['names']) < 1:
                return "No filenames in file auto-parameter list"
        else:
            if param['step'] == 0 and param['start'] != param['stop']:
                return "Auto-parameter step size of 0 not allowed"
            if abs(param['stop'] - param['start']) < param['step']:
                return "Auto-parameter step size larger than range"
            if not self.checkLimits(row, param['start']):
                return "Auto-parameter start value invalid"
            if not self.checkLimits(row, param['stop']):
                return "Auto-parameter stop value invalid"
        return 0
936190
def length(self, rows=None):
    
    rows = tf.range(self._capacity) if rows is None else rows
    return tf.gather(self._length, rows)
1052561
def csv_format(csv_data, c_headers=None, r_headers=None, rows=None, **kwargs):
    
    result = None
    c_headers = [] if c_headers is None else c_headers
    r_headers = [] if r_headers is None else r_headers
    rows = [] if rows is None else rows

    result_format = kwargs.get('result_format', ARRAY_RAW_FORMAT)

    # DICT FORMAT
    if result_format == DICT_FORMAT:
        result = csv_dict_format(csv_data, c_headers, r_headers)

    # ARRAY_RAW_FORMAT
    elif result_format == ARRAY_RAW_FORMAT:
        result = rows

    # ARRAY_CLEAN_FORMAT
    elif result_format == ARRAY_CLEAN_FORMAT:
        result = csv_array_clean_format(csv_data, c_headers, r_headers)

    else:
        result = None

    # DEFAULT
    if result and result_format < DICT_FORMAT:
        result = [result]

    return result
1100365
def parse_csv_file(url, res):
    """"""
    response = requests.get(url, stream=True)
    reader = csv.reader(response.iter_lines())
    first_row = True
    for row in reader:
        if first_row:
            # skip first row
            first_row = False
        else:
            scheme, template, description, reference = row
            res[scheme] = description
356559
function(line) {
    line = line.toString();
    var colCount = _.size(transactionFields);
    var possibleRow = row + line;
    var possibleFields = possibleRow.slice(1, possibleRow.length - 1).split("\",\"");

    // Unfortunately there are some fields that have new line characters in them
    // and there could be exta commas
    if (line.slice(-1) !== "\"" || possibleFields.length < colCount) {
      row = row + line;
      return false;
    }
    // Otherwise just use what we have
    else {
      line = row + line;
      row = "";
    }

    // Parse and match with headers
    var fields = line.slice(1, line.length - 1).split("\",\"");
    var parsed = {};
    _.each(_.keys(transactionFields), function(h, hi) {
      parsed[h] = fields[hi];
    });

    // Use auto parser to coerce the types
    parsed = this.autoParser(parsed, this.options.models, {
      dateFormat: this.options.dateFormat,
      datetimeFormat: this.options.datetimeFormat
    });

    //checkFieldLength(parsed, "other_receipt_code");

    return parsed;
  }
233917
def load_csv(file, shape=None, normalize=False):
    
    value_list = []
    if six.PY2:
        for row in csv.reader(file):
            value_list.append(list(map(float, row)))
    elif six.PY34:
        for row in csv.reader([l.decode('utf-8') for l in file.readlines()]):
            value_list.append(list(map(float, row)))
    if shape is None:
        return numpy.array(value_list)
    else:
        return numpy.array(value_list).reshape(shape)
165981
def is_csv_file(inputfile):
    
    try:
        stream = open(inputfile)
        row = stream.readline()
    except (IOError, UnicodeDecodeError):  # pragma: no cover
        return False
    finally:
        stream.close()
    content = row.strip().split(',')
    return inputfile.endswith('.csv') and len(content) >= 4
544351
private static RowData parseDataRow(String line, GenMunger munger) {
      if( line.isEmpty() || line.equals("") )
        return null;
      String[] inputData = line.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)|(,)", -1);
      for(int i=0;i<inputData.length;++i)
        inputData[i]=inputData[i]==null?"":inputData[i];
    if( inputData.length != munger.inNames().length )
      return null;
    return munger.fillDefault(inputData);
  }
195487
def _parse_row(row):
        

        data = []

        labels = HtmlTable._get_row_tag(row, "th")
        if labels:
            data += labels

        columns = HtmlTable._get_row_tag(row, "td")
        if columns:
            data += columns

        return data
1141451
def _parsecsv(x):
        
        for line in x:
            # decode as utf-8, whitespace-strip and split on delimiter
            yield line.decode('utf-8').strip().split(config.DELIMITER)
594909
void validateBlock(Row row)
  {
    if (! row.getDatabase().isValidate()) {
      return;
    }
    
    int rowHead = _rowHead;
    int blobTail = _blobTail;
        
    if (rowHead < blobTail) {
      throw new IllegalStateException(this 
                                      + " rowHead:" + rowHead
                                      + " blobTail:" + blobTail); 
    }
    
    int rowOffset = _rowHead;
    
    byte []buffer = _buffer;

    while (rowOffset < BLOCK_SIZE) {
      int code = buffer[rowOffset] & CODE_MASK;
      
      switch (code) {
      case INSERT:
        row.validate(buffer, rowOffset, rowHead, blobTail);
        break;
        
      case INSERT_DEAD:
      case REMOVE:
        break;
        
      default:
        throw new IllegalStateException(this + " " + rowOffset + " " + code + " unknown code");
      }
      
      int len = getLength(code, row);
      
      if (len < 0 || len + rowOffset > BLOCK_SIZE) {
        throw new IllegalStateException(this + " " + rowOffset + " code:" + code + " len:" + len + " invalid len");
      }
      
      rowOffset += len;
    }  
  }
845564
def retrieve_csv_data(rows, row_header=0, column_header=0, limit_column=0):
    
    return [row[row_header:limit_column] for row in rows[column_header:]]
722456
def nested_row(self, obj, nested):
        ''''''
        row = self.to_row(obj)
        for name, getter in self.get_nested_fields():
            content = ''
            if getter is not None:
                try:
                    content = safestr(getter(nested))
                except Exception, e:  # Catch all errors intentionally.
                    log.error('Error exporting CSV for {name}: {error}'.format(
                        name=self.__class__.__name__, error=e))
            row.append(content)
        return row