create the header of the CSV (column/method names)
 returns an array of strings for CSV header based on blackjack
976681
def block_and_tackle
      self.blackjack.map do |k,v|
        case k
          #Joining is only relevant when the booty contains a nested hash of method calls as at least one of the booty array elements
          #Use the booty (methods) as the column headers
          when :join then self.binnacle(v, false)
          #Use the humanized booty (methods) as the column headers
          when :humanize then self.binnacle(v, true)
          when :array then v
        end
      end.first
    end
247643
def create_csv_file(keys, strings, comments = nil)
      raise "csv_filename must not be nil" unless @csv_filename
      CSV.open(@csv_filename, "wb") do |csv|
        @headers << "Comments" if !comments.nil? && !comments.empty?
        csv << @headers
        keys.each do |key|
          line = [key]
          default_val = strings[@default_lang][key] if strings[@default_lang]
          @filenames.each do |fname|
            lang = fname
            current_val = (lang != default_lang && strings[lang][key] == default_val) ? '' : strings[lang][key]
            line << current_val
          end
          line << comments[key] if comments && comments[key]
          csv << line
        end
        puts "Done"
      end
    end
652560
def header_output(self):
        '''
        '''
        result = []
        for key in self.keys():
            result.append(key + '=' + self.get(key).value)
        return '; '.join(result)
570542
function tableHead () {
  var args = arrayify(arguments)
  var data = args.shift()
  if (!data) return
  args.pop()
  var cols = args
  var colHeaders = cols.map(function (col) {
    var spl = col.split('|')
    return spl[1] || spl[0]
  })
  cols = cols.map(function (col) {
    return col.split('|')[0]
  })
  var toSplice = []
  cols = cols.filter(function (col, index) {
    var hasValue = data.some(function (row) {
      return typeof row[col] !== 'undefined'
    })
    if (!hasValue) toSplice.push(index)
    return hasValue
  })
  toSplice.reverse().forEach(function (index) {
    colHeaders.splice(index, 1)
  })

  var table = '| ' + colHeaders.join(' | ') + ' |\n'
  table += cols.reduce(function (p) { return p + ' --- |' }, '|') + '\n'
  return table
}
580650
def to_csvline(self, with_header=False):
        """"""
        string = ""

        if with_header:
            string += "# " + " ".join(at for at in AbinitTimerSection.FIELDS) + "\n"

        string += ", ".join(str(v) for v in self.to_tuple()) + "\n"
        return string
951474
def to_csv(columns: nil)
      attributes = members
      attributes = columns & attributes if columns

      row = attributes.map! { |column| to_csv_value(column) }

      ::CSV.generate_line(row)
    end
326548
def encode_csv(data_dict, column_names):
  
  import csv
  import six
  values = [str(data_dict[x]) for x in column_names]
  str_buff = six.StringIO()
  writer = csv.writer(str_buff, lineterminator='')
  writer.writerow(values)
  return str_buff.getvalue()
1104133
function gatherHeaders(item) {
    var ret, i, l;
    if (isHashArray(item)) {
        //lets assume a multidimesional array with item 0 bing the title
        i = -1;
        l = item.length;
        ret = [];
        while (++i < l) {
            ret[i] = item[i][0];
        }
    } else if (isArray(item)) {
        ret = item;
    } else {
        ret = keys(item);
    }
    return ret;
}
691004
def headers(self, serialize_cell=None):
    """"""
    if serialize_cell is None:
      serialize_cell = self.get_cell_value
    return [serialize_cell(cell) for cell in self.rows[0]]
884292
def _create_from_csv(self):
        
       
        import aikif.dataTools.cls_datatable as cl
        fle = cl.DataTable(self.input_data, ',')
        fle.load_to_array()
        self.content['data'] = fle.arr
        
        
        lg.record_process('_create_from_csv', 'read ' + self._calc_size_stats() + ' from ' + self.input_data)
710078
private String[] selectColumnNames(List<String> names, ColumnType[] types) {
        List<String> header = new ArrayList<>();
        for (int i = 0; i < types.length; i++) {
            if (types[i] != SKIP) {
                String name = names.get(i);
                name = name.trim();
                header.add(name);
            }
        }
        String[] result = new String[header.size()];
        return header.toArray(result);
    }
166754
def gen_csv(sc, filename):
    '''
    '''

    # First thing we need to do is initialize the csvfile and build the header
    # for the file.
    datafile = open(filename, 'wb')
    csvfile = csv.writer(datafile)
    csvfile.writerow(['Software Package Name', 'Count'])

    debug.write('Generating %s: ' % filename)
    # Next we will run the Security Center query.  because this could be a
    # potentially very large dataset that is returned, we don't want to run out
    # of memory.  To get around this, we will pass the query function the writer
    # function with the appropriate fields so that it is parsed inline.
    fparams = {'fobj': csvfile}
    sc.query('listsoftware', func=writer, func_params=fparams)
    debug.write('\n')

    # Lastly we need to close the datafile.
    datafile.close()
921127
def get_row_headers(rows, row_headers_count_value=0, column_headers_count=1):
    
    # TODO: REFACTOR ALGORITHM NEEDED
    partial_headers = []

    if row_headers_count_value:

        # Take partial data
        for k_index in range(0, len(rows) - column_headers_count):
            header = rows[k_index + column_headers_count][
                :row_headers_count_value]
            partial_headers.append(remove_list_duplicates(force_list(header)))

        # Populate headers
        populated_headers = populate_csv_headers(
            rows,
            partial_headers,
            column_headers_count)

        return populated_headers
464144
function tableFromMethods(methodsArr) {
  const headers = ["Method Name", "Type", "Parameters", "Description"]
  let rows = []

  // construct rows of table array of methods
  methodsArr.forEach((method) => {
    let cols = []

    cols.push(method["name"]) // method name
    let paramList = ''
    method["params"].forEach((param) => {
      paramList += `${param["name"]}: ${param["type"]["name"]} - ${param["description"]}\n`
    })
    cols.push(paramList) // list of method parameters
    cols.push(`${method["description"]}`) // description of the method

    rows.push(cols);
  })
  
  return rows.length > 0 ? {table: {headers, rows}} : null
}
156773
function (rawHeaders) {
            var headers = {},
                headerList,
                key,
                h,
                i;

            headerList = rawHeaders.split("\n");
            for (i = 0; i < headerList.length; i += 1) {
                h = headerList[i].split(":", 2);

                if (h[1] !== null) {
                    headers[h[0]] = h[1].replace(/^\s+|\s+$/g, "");

                    key = h[0];
                }
                else {
                    if (h[0].substring(0, 1) === "\t") {
                        headers[h[0]] = h[1].replace(/^\s+|\s+$/g, "");
                    }
                }
            }

            return headers;
        }
174446
function headersToString(headers){
  var lines = [];
  for(var name in headers){
    lines.push(name + ': ' + headers[name]);
  }
  return lines.join('\n');
}
853825
function headersToString(headers) {
  let ret = [];
  headers.forEach(function(value, name) {
    ret.push(`${name.toLowerCase()}: ${value}`);
  });
  return ret.join('\n');
}