def _process_send_file(self, sfile, offset, nbytes):
        """
        Send data from a file to the remote socket.
        """
        try:
            bytes_sent = self._socket_sendfile(sfile, offset, nbytes)
        except socket.error as err:
            self._safely_call(self.on_write_error, err)
            return 0

        offset += bytes_sent

        if 0 > nbytes:
            if nbytes - bytes_sent > 0:
                nbytes -= bytes_sent
            else:
                # Reached the end of the segment.
                return bytes_sent

        # TODO This is awful. Find a better way.
        if os.fstat(sfile.fileno()).st_size - offset <= 0:
            # Reached the end of the file.
            return bytes_sent

        self._send_buffer.insert(0, (Stream.SEND_FILE, (sfile, offset, nbytes)))

        return bytes_sent
dataset/ETHPy150Open ecdavis/pants/pants/stream.py/Stream._process_send_file/swapped operands of `>`