def onAutoIndentTriggered(self):
        """Indent current line or selected lines
        """
        cursor = self._qpart.textCursor()

        startBlock = self._qpart.document().findBlock(cursor.selectionStart())
        endBlock = self._qpart.document().findBlock(cursor.selectionEnd())

        if startBlock != endBlock:  # indent multiply lines
            stopBlock = endBlock.next()

            block = startBlock

            with self._qpart:
                while block != stopBlock:
                    self.autoIndentBlock(block, '')
                    block = block.next()
        else:  # indent 1 line
            self.autoIndentBlock(startBlock, '')
def update_cost_model(self, x, cost_x):
        """
        Updates the GP used to handle the cost.

        param x: input of the GP for the cost model.
        param x_cost: values of the time cost at the input locations.
        """

        if self.cost_type == 'evaluation_time':
            cost_evals = np.log(np.atleast_2d(np.asarray(cost_x)).T)

            if self.num_updates == 0:
                X_all = x
                costs_all = cost_evals
            else:
                X_all = np.vstack((self.cost_model.model.X,x))
                costs_all = np.vstack((self.cost_model.model.Y,cost_evals))

            self.num_updates += 1
            self.cost_model.updateModel(X_all, costs_all, None, None)