Appends the remaining commited lines and closes the stream. If no stream is active, raises a ValueError
496774
def closeStreamToFile(self) :
		""""""
		if self.streamBuffer is None :
			raise ValueError("Commit lines is only for when you are streaming to a file")

		for i in xrange(len(self.streamBuffer)) :
			self.streamBuffer[i] = str(self.streamBuffer[i])
		self.streamFile.write('\n'.join(self.streamBuffer))
		self.streamFile.close()

		self.streamFile = None
		self.writeRate = None
		self.streamBuffer = None
		self.keepInMemory = True
643028
def amend_commit(
            self,
            append_to_msg: typing.Optional[str] = None,
            new_message: typing.Optional[str] = None,
            files_to_add: typing.Optional[typing.Union[typing.List[str], str]] = None,
    ):
        
693964
public void appendLine(final Line line)
    {
        if (this.lineTail == null)
        {
            this.lines = this.lineTail = line;
        }
        else
        {
            this.lineTail.nextEmpty = line.isEmpty;
            line.prevEmpty = this.lineTail.isEmpty;
            line.previous = this.lineTail;
            this.lineTail.next = line;
            this.lineTail = line;
        }
    }
144847
private void doAppendLine(final String... fields) throws IOException {
		if (null != fields) {
			for (int i = 0; i < fields.length; i++) {
				appendField(fields[i]);
			}
			writer.write(config.lineDelimiter);
			newline = true;
		}
	}
925083
@Override
  protected void flushAndSync(boolean durable) throws IOException {
    if (fp == null) {
      throw new IOException("Trying to use aborted output stream");
    }
    preallocate(); // preallocate file if necessary
    if (doubleBuf.isFlushed()) {
      return;
    }
    doubleBuf.flushTo(fp);
    if (durable) {
      fc.force(false); // metadata updates not needed
    }
    fc.position(fc.position() - 1); // skip back the end-of-file marker
  }
399339
def flush(self):
        
        self.acquire()
        try:
            if self.outStream and hasattr(self.outStream, "flush"):
                self.outStream.flush()
            if self.errStream and hasattr(self.errStream, "flush"):
                self.errStream.flush()
        finally:
            self.release()
1265073
def _commit(self, ref):
        ''
        path_times = self._weakref_path_map[ref]
        path_times.append(nanotime())
        del self._weakref_path_map[ref]
        path = tuple(path_times[1::2])
        times = path_times[::2]
        if path not in self.path_stats:
            # tuple to save a tiny bit of memory
            self.path_stats[path] = tuple([
                Duration(interval=False) for i in range(len(path))])
        path_stats = self.path_stats[path]
        for i in range(1, len(times)):
            path_stats[i - 1]._stats.add(times[i] - times[i - 1])
1104559
@Override
  public void append(Transaction txn) throws IOException {
    if (this.lastSeenZxid.compareTo(txn.getZxid()) >= 0) {
      String exStr = String.format("The zxid %s is not larger than last seen"
          + " zxid %s in the log.", txn.getZxid(), lastSeenZxid);
      throw new RuntimeException(exStr);
    }
    if (currentLog == null || currentLog.length() >= this.rollingSize) {
      Zxid zxid = txn.getZxid();
      // Close the old one if any.
      this.close();
      File logFile = new File(logDir, "transaction." + zxid.toSimpleString());
      LOG.debug("Rolling to the new log {}.", logFile.getName());
      // Adds new created log file to list.
      this.logFiles.add(logFile);
      this.currentLog = new SimpleLog(logFile);
    }
    this.lastSeenZxid = txn.getZxid();
    this.currentLog.append(txn);
  }
658180
def flush(self, n=4096):
        

        try:
            read = self.from_stream.read(n)

            if read is None or len(read) == 0:
                self.eof = True
                if self.propagate_close:
                    self.to_stream.close()
                return None

            return self.to_stream.write(read)
        except OSError as e:
            if e.errno != errno.EPIPE:
                raise e
179035
def commit(self):
        
        if hasattr(self.local, 'tx') and self.local.tx:
            tx = self.local.tx.pop()
            tx.commit()
            self._flush_tables()
916647
def file_writelines_flush_sync(path, lines):
    
    fp = open(path, 'w')
    try:
        fp.writelines(lines)
        flush_sync_file_object(fp)
    finally:
        fp.close()
149103
def append_line(self, new_line):
        """"""
        # TODO: The user still has to write the raw line, this is error prone.
        self._write(('PGM', [Integer, String]), self.idx, new_line)
305151
def flush_on_close(self, stream):
        
        assert get_thread_ident() == self.ioloop_thread_id
        # Prevent futher writes
        stream.KATCPServer_closing = True
        # Write empty message to get future that resolves when buffer is flushed
        return stream.write('\n')
725142
def append_exception(self,
                         stacktrace):
        
        # Delete the last message of the list
        if len(self.exceptions) > 0:
            del self.exceptions[-1]

        # Append the new message at the top
        self.exceptions.insert(0, stacktrace)
        self.changes_made = True

        # Redraw
        self.redraw()
175489
def flush_if_ended(self):
		""""""
		if self.ended and self.next and len(self.files) == self.transformed:
			future = asyncio.ensure_future(self.transformer.flush())
			future.add_done_callback(lambda x: self.next.end_of_stream())
263619
def do_commit(self, line):
        

        def f(p, args):
            print(p.commit())

        self._request(line, f)
303257
def commit(self):
        
        while len(self.__buffer) > 0:
            self.__run(self.__buffer.pop(0))