def flush(self):
        """
        Attempt to immediately write any internally buffered data to the
        channel without waiting for a write event.

        This method can be fairly expensive to call and should be used
        sparingly.

        Calling :meth:`flush()` on a closed or disconnected channel will
        raise a :exc:`RuntimeError`.
        """
        if self._closed or self._closing:
            raise RuntimeError("flush() called on closed %r." % self)

        if not self.connected:
            raise RuntimeError(self % "flush() called on disconnected %r.")

        if not self._send_buffer:
            return

        self._stop_waiting_for_write_event()
        self._process_send_buffer()

    ##### Public Event Handlers ###############################################
dataset/ETHPy150Open ecdavis/pants/pants/stream.py/Stream.flush/swapped operands of `%`