Appends an empty entry at the end of the CSV and returns it
194773
def newEntry(self, ident = "", seq = "", plus = "", qual = "") :
		""""""
		e = FastqEntry()
		self.data.append(e)
		return e
1272760
public long append(Entry entry) {
    Assert.notNull(entry, "entry");
    Assert.stateNot(isFull(), "segment is full");

    long index = nextIndex();
    Assert.index(index == entry.getIndex(), "inconsistent index: %s", entry.getIndex());

    // Calculate the offset of the entry.
    long offset = relativeOffset(index);

    // Get the term from the entry.
    long term = entry.getTerm();

    // Get the highest term in the index.
    long lastTerm = termIndex.term();

    // The entry term must be positive and >= the last term in the segment.
    Assert.arg(term > 0 && term >= lastTerm, "term must be monotonically increasing");

    // Mark the starting position of the record and record the starting position of the new entry.
    long position = buffer.position();

    // Determine whether to skip writing the term to the segment.
    boolean skipTerm = term == lastTerm;

    // Calculate the length of the entry header bytes.
    int headerLength = INTEGER + LONG + BOOLEAN + (skipTerm ? 0 : LONG);

    // Clear the memory and skip the size and header.
    memory.clear().skip(headerLength);

    // Serialize the object into the in-memory buffer.
    serializer.writeObject(entry, memory);

    // Flip the in-memory buffer indexes.
    memory.flip();

    // The total length of the entry is the in-memory buffer limit.
    int totalLength = (int) memory.limit();

    // Calculate the length of the serialized bytes based on the in-memory buffer limit and header length.
    int entryLength = totalLength - headerLength;

    // Set the entry size.
    entry.setSize(totalLength);

    // Compute the checksum for the entry.
    Checksum crc32 = new CRC32();
    crc32.update(memory.array(), headerLength, entryLength);
    long checksum = crc32.getValue();

    // Rewind the in-memory buffer and write the length, checksum, and offset.
    memory.rewind()
      .writeUnsignedInt(checksum)
      .writeLong(offset);

    // If the term has not yet been written, write the term to this entry.
    if (skipTerm) {
      memory.writeBoolean(false);
    } else {
      memory.writeBoolean(true).writeLong(term);
    }

    // Write the entry length and entry to the segment.
    buffer.writeInt(totalLength)
      .write(memory.rewind());

    // Index the offset, position, and length.
    offsetIndex.index(offset, position);

    // If the entry term is greater than the last indexed term, index the term.
    if (term > lastTerm) {
      termIndex.index(offset, term);
    }

    // Reset skip to zero since we wrote a new entry.
    skip = 0;

    return index;
  }
611412
def _remove_empty_output(self):
        
        output = []
        for key in self.output_dict:
            if self.output_dict[key] is not None and 'full_text' in self.output_dict[key]:
                output.append(self.output_dict[key])
        return output
1225254
def _init_append(self):
        
        # Require to load the full file content in buffer
        self._write_buffer[:] = self._readall()

        # Make initial seek position to current end of file
        self._seek = self._size
1160084
def as_csv(self):
        """"""

        from io import StringIO

        s = StringIO()
        w = csv.writer(s)
        for row in self.rows:
            w.writerow(row)

        return s.getvalue()
779641
function append (value, string) {
  if (
    value === null || value === undefined || value === '' ||
    string === null || string === undefined
  ) {
    return value
  }
  return value + string
}
646317
public RowIndexEntry tryAppend(AbstractCompactedRow row)
    {
        writer.mark();
        try
        {
            return append(row);
        }
        catch (Throwable t)
        {
            writer.resetAndTruncate();
            throw t;
        }
    }
713876
def insert_empty_columns(self, x: int, amount: int = 1) -> None:
        """"""
        def transform_columns(
                column: Union[int, float],
                row: Union[int, float]
        ) -> Tuple[Union[int, float], Union[int, float]]:
            return column + (amount if column >= x else 0), row
        self._transform_coordinates(transform_columns)
637179
function append_newstr() {
	if (newstr.length>0) {
		console.log('Writing '+newstr.length+' entries');
		entry_str = '';
		for (var i in newstr) {
			entry_str += newstr[i]+'\n';
		}
		dlh_fh = fs.openSync(dlh_locn,'a');
		fs.appendFileSync(dlh_locn, entry_str, 'utf8');
		fs.closeSync(dlh_fh);
	}
}
224420
def dump(self, indentation=0):
        """"""
        
        dump = []
        
        dump.append('[%s]' % self.name)
        
        # Refer to the __set_format__ method for an explanation
        # of the following construct.
        for keys in self.__keys__:
            for key in keys:
                
                val = getattr(self, key)
                if isinstance(val, int) or isinstance(val, long):
                    val_str = '0x%-8X' % (val)
                    if key == 'TimeDateStamp' or key == 'dwTimeStamp':
                        try:
                            val_str += ' [%s UTC]' % time.asctime(time.gmtime(val))
                        except exceptions.ValueError, e:
                            val_str += ' [INVALID TIME]'
                else:
                    val_str = ''.join(filter(lambda c:c != '\0', str(val)))
                
                dump.append('0x%-8X 0x%-3X %-30s %s' % (
                    self.__field_offsets__[key] + self.__file_offset__, 
                    self.__field_offsets__[key], key+':', val_str))
        
        return dump
9208
def insert_empty_rows(self, y: int, amount: int = 1) -> None:
        """"""
        def transform_rows(
                column: Union[int, float],
                row: Union[int, float]
        ) -> Tuple[Union[int, float], Union[int, float]]:
            return column, row + (amount if row >= y else 0)
        self._transform_coordinates(transform_rows)
663644
def populate_csv_headers(rows,
                         partial_headers,
                         column_headers_count=1):
    

    result = [''] * (len(rows) - column_headers_count)

    for i_index in range(0, len(partial_headers)):
        for k_index in range(0, len(partial_headers[i_index])):

            # missing field find for a value in upper rows
            if not partial_headers[i_index][k_index] and i_index - 1 >= 0:

                # TODO: It's necesary a for or only taking the
                # inmediate latest row works well??
                for t_index in range(i_index - 1, -1, -1):
                    # TODO: could suposse that allways a value exists
                    partial_value = partial_headers[t_index][k_index]
                    if partial_value:
                        partial_headers[i_index][k_index] = partial_value
                        break

        result[i_index] = " ".join(map(str, partial_headers[i_index]))

    return result
1074642
function cleanUpFalsyCsvValue(rows) {
  for (let i = 0; i < rows.length; i++) {
    for (let j = 0; j < rows[i].length; j++) {
      // analyzer will set any fields to 'string' if there are empty values
      // which will be parsed as '' by d3.csv
      // here we parse empty data as null
      // TODO: create warning when deltect `CSV_NULLS` in the data
      if (!rows[i][j] || CSV_NULLS.includes(rows[i][j])) {
        rows[i][j] = null;
      }
    }
  }
}
853288
def next(self):
        
        try:
            entry = {}
            row = self._csv_reader.next()
            for i in range(0, len(row)):
                entry[self._headers[i]] = row[i]

            return entry
        except Exception as e:
            # close our file when we're done reading.
            self._file.close()
            raise e
856348
def write(self):
        
        csv_file = os.path.join(self.outdir, 'search_results.csv')
        txt_file = os.path.join(self.outdir, 'unresolved.txt')
        headers = self.key_terms
        unresolved = []
        with open(csv_file, 'w') as file:
            writer = csv.writer(file)
            writer.writerow(headers)
            for key in list(self._store.keys()):
                results = self._store[key]
                if len(results) == 0:
                    unresolved.append(key)
                else:
                    row = [key]
                    for key_term in headers[1:]:
                        element = results[0][key_term]
                        # GNR returns UTF-8, csv requires ascii
                        #
                        # *** Note ***
                        # According to all docs for csv versions >= 2.6, csv
                        # can handle either UTF-8 or ascii, just not Unicode.
                        # In py3, the following two lines result in csv printing
                        # the element with a bitstring. If GNR is actually
                        # returning UTF-8, it seems easiest to just drop these

                        # if 'encode' in dir(element):
                        #     element = element.encode('ascii')
                        row.append(element)
                    writer.writerow(row)
        if len(unresolved) > 0:
            with open(txt_file, 'w') as file:
                for name in unresolved:
                    file.write("{0}\n".format(name))
6973
def _AppendRecord(self):
    """"""

    # If no Values then don't output.
    if not self.values:
      return

    cur_record = []
    for value in self.values:
      try:
        value.OnSaveRecord()
      except SkipRecord:
        self._ClearRecord()
        return
      except SkipValue:
        continue

      # Build current record into a list.
      cur_record.append(value.value)

    # If no Values in template or whole record is empty then don't output.
    if len(cur_record) == (cur_record.count(None) + cur_record.count([])):
      return

    # Replace any 'None' entries with null string ''.
    while None in cur_record:
      cur_record[cur_record.index(None)] = ''

    self._result.append(cur_record)
    self._ClearRecord()
1137149
def convert(name = @csv_filename)
      rowIndex     = 0
      excludedCols = []
      defaultCol   = 0

      CSV.foreach(name, :quote_char => '"', :col_sep => @csv_separator, :row_sep => :auto) do |row|

        if rowIndex == 0
          #check there's at least two columns
          return unless row.count > 1
        else
          #skip empty lines (or sections)
          next if row == nil or row[@keys_column].nil?
        end

        # go through columns
        row.size.times do |i|
          next if excludedCols.include? i

          #header
          if rowIndex == 0
            # defaultCol can be the keyValue
            defaultCol = i if self.default_lang == row[i]
            # ignore all headers not listed in langs to create files
            (excludedCols << i and next) unless @langs.has_key?(row[i])

            language = Language.new(row[i])
            if @langs[row[i]].is_a?(Array)
              @langs[row[i]].each do |id|
                language.add_language_id(id.to_s)
              end
            else
              language.add_language_id(@langs[row[i]].to_s)
            end
            @languages[i] = language
          elsif !@state_column || (row[@state_column].nil? || row[@state_column] == '' || !@excluded_states.include?(row[@state_column]))
            key = row[@keys_column]
            comment = @comments_column ? row[@comments_column] : nil
            key.strip! if @stripping
            default_value =  self.default_lang ? row[defaultCol] : nil
            value = self.process_value(row[i], default_value)
            @comments[key] = comment
            @languages[i].add_content_pair(key, value)
          end
        end

        rowIndex += 1
      end

      write_content
    end