{
    "file_diffs": [
        {
            "old_file_content": "import sys\nimport threading\nimport itertools\nimport concurrent.futures\n\nfrom collections import OrderedDict, namedtuple\n\nfrom math import isnan\n\nimport numpy\nfrom scipy.sparse import issparse\n\nfrom AnyQt.QtWidgets import (\n    QTableView, QHeaderView, QAbstractButton, QApplication, QStyleOptionHeader,\n    QStyle, QStylePainter, QStyledItemDelegate\n)\nfrom AnyQt.QtGui import QColor, QClipboard\nfrom AnyQt.QtCore import (\n    Qt, QSize, QEvent, QObject, QMetaObject,\n    QAbstractProxyModel, QIdentityProxyModel, QModelIndex,\n    QItemSelectionModel, QItemSelection, QItemSelectionRange,\n)\nfrom AnyQt.QtCore import pyqtSlot as Slot\n\nimport Orange.data\nfrom Orange.data.storage import Storage\nfrom Orange.data.table import Table\nfrom Orange.data.sql.table import SqlTable\nfrom Orange.statistics import basic_stats\n\nfrom Orange.widgets import gui\nfrom Orange.widgets.settings import Setting\nfrom Orange.widgets.utils.itemselectionmodel import (\n    BlockSelectionModel, ranges, selection_blocks\n)\nfrom Orange.widgets.utils.tableview import TableView, \\\n    table_selection_to_mime_data\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\nfrom Orange.widgets.widget import OWWidget, Input, Output\nfrom Orange.widgets.utils import datacaching\nfrom Orange.widgets.utils.annotated_data import (create_annotated_table,\n                                                 ANNOTATED_DATA_SIGNAL_NAME)\nfrom Orange.widgets.utils.itemmodels import TableModel\nfrom Orange.widgets.utils.state_summary import format_summary_details\n\n\nclass RichTableModel(TableModel):\n    \"\"\"A TableModel with some extra bells and whistles/\n\n    (adds support for gui.BarRole, include variable labels and icons\n    in the header)\n    \"\"\"\n    #: Rich header data flags.\n    Name, Labels, Icon = 1, 2, 4\n\n    def __init__(self, sourcedata, parent=None):\n        super().__init__(sourcedata, parent)\n\n        self._header_flags = RichTableModel.Name\n        self._continuous = [var.is_continuous for var in self.vars]\n        labels = []\n        for var in self.vars:\n            if isinstance(var, Orange.data.Variable):\n                labels.extend(var.attributes.keys())\n        self._labels = list(sorted(\n            {label for label in labels if not label.startswith(\"_\")}))\n\n    def data(self, index, role=Qt.DisplayRole,\n             # for faster local lookup\n             _BarRole=gui.TableBarItem.BarRole):\n        # pylint: disable=arguments-differ\n        if role == _BarRole and self._continuous[index.column()]:\n            val = super().data(index, TableModel.ValueRole)\n            if val is None or isnan(val):\n                return None\n\n            dist = super().data(index, TableModel.VariableStatsRole)\n            if dist is not None and dist.max > dist.min:\n                return (val - dist.min) / (dist.max - dist.min)\n            else:\n                return None\n        elif role == Qt.TextAlignmentRole and self._continuous[index.column()]:\n            return Qt.AlignRight | Qt.AlignVCenter\n        else:\n            return super().data(index, role)\n\n    def headerData(self, section, orientation, role):\n        if orientation == Qt.Horizontal and role == Qt.DisplayRole:\n            var = super().headerData(\n                section, orientation, TableModel.VariableRole)\n            if var is None:\n                return super().headerData(\n                    section, orientation, Qt.DisplayRole)\n\n            lines = []\n            if self._header_flags & RichTableModel.Name:\n                lines.append(var.name)\n            if self._header_flags & RichTableModel.Labels:\n                lines.extend(str(var.attributes.get(label, \"\"))\n                             for label in self._labels)\n            return \"\\n\".join(lines)\n        elif orientation == Qt.Horizontal and role == Qt.DecorationRole and \\\n                self._header_flags & RichTableModel.Icon:\n            var = super().headerData(\n                section, orientation, TableModel.VariableRole)\n            if var is not None:\n                return gui.attributeIconDict[var]\n            else:\n                return None\n        else:\n            return super().headerData(section, orientation, role)\n\n    def setRichHeaderFlags(self, flags):\n        if flags != self._header_flags:\n            self._header_flags = flags\n            self.headerDataChanged.emit(\n                Qt.Horizontal, 0, self.columnCount() - 1)\n\n    def richHeaderFlags(self):\n        return self._header_flags\n\n\nclass TableSliceProxy(QIdentityProxyModel):\n    def __init__(self, parent=None, rowSlice=slice(0, -1), **kwargs):\n        super().__init__(parent, **kwargs)\n        self.__rowslice = rowSlice\n\n    def setRowSlice(self, rowslice):\n        if rowslice.step is not None and rowslice.step != 1:\n            raise ValueError(\"invalid stride\")\n\n        if self.__rowslice != rowslice:\n            self.beginResetModel()\n            self.__rowslice = rowslice\n            self.endResetModel()\n\n    def mapToSource(self, proxyindex):\n        model = self.sourceModel()\n        if model is None or not proxyindex.isValid():\n            return QModelIndex()\n\n        row, col = proxyindex.row(), proxyindex.column()\n        row = row + self.__rowslice.start\n        assert 0 <= row < model.rowCount()\n        return model.createIndex(row, col, proxyindex.internalPointer())\n\n    def mapFromSource(self, sourceindex):\n        model = self.sourceModel()\n        if model is None or not sourceindex.isValid():\n            return QModelIndex()\n        row, col = sourceindex.row(), sourceindex.column()\n        row = row - self.__rowslice.start\n        assert 0 <= row < self.rowCount()\n        return self.createIndex(row, col, sourceindex.internalPointer())\n\n    def rowCount(self, parent=QModelIndex()):\n        if parent.isValid():\n            return 0\n        count = super().rowCount()\n        start, stop, step = self.__rowslice.indices(count)\n        assert step == 1\n        return stop - start\n\n\nTableSlot = namedtuple(\"TableSlot\", [\"input_id\", \"table\", \"summary\", \"view\"])\n\n\nclass DataTableView(gui.HScrollStepMixin, TableView):\n    dataset: Table\n    input_slot: TableSlot\n\n\nclass OWDataTable(OWWidget):\n    name = \"Data Table\"\n    description = \"View the dataset in a spreadsheet.\"\n    icon = \"icons/Table.svg\"\n    priority = 50\n    keywords = []\n\n    buttons_area_orientation = Qt.Vertical\n\n    class Inputs:\n        data = Input(\"Data\", Table, multiple=True)\n\n    class Outputs:\n        selected_data = Output(\"Selected Data\", Table, default=True)\n        annotated_data = Output(ANNOTATED_DATA_SIGNAL_NAME, Table)\n\n    show_distributions = Setting(False)\n    dist_color_RGB = Setting((220, 220, 220, 255))\n    show_attribute_labels = Setting(True)\n    select_rows = Setting(True)\n    auto_commit = Setting(True)\n\n    color_by_class = Setting(True)\n    selected_rows = Setting([], schema_only=True)\n    selected_cols = Setting([], schema_only=True)\n\n    def __init__(self):\n        super().__init__()\n\n        self._inputs = OrderedDict()\n\n        self.__pending_selected_rows = self.selected_rows\n        self.selected_rows = None\n        self.__pending_selected_cols = self.selected_cols\n        self.selected_cols = None\n\n        self.dist_color = QColor(*self.dist_color_RGB)\n\n        info_box = gui.vBox(self.controlArea, \"Info\")\n        self.info_text = gui.widgetLabel(info_box)\n        self._set_input_summary(None)\n        self._set_output_summary(None)\n        gui.separator(self.controlArea)\n\n        box = gui.vBox(self.controlArea, \"Variables\")\n        self.c_show_attribute_labels = gui.checkBox(\n            box, self, \"show_attribute_labels\",\n            \"Show variable labels (if present)\",\n            callback=self._on_show_variable_labels_changed)\n\n        gui.checkBox(box, self, \"show_distributions\",\n                     'Visualize numeric values',\n                     callback=self._on_distribution_color_changed)\n        gui.checkBox(box, self, \"color_by_class\", 'Color by instance classes',\n                     callback=self._on_distribution_color_changed)\n\n        box = gui.vBox(self.controlArea, \"Selection\")\n\n        gui.checkBox(box, self, \"select_rows\", \"Select full rows\",\n                     callback=self._on_select_rows_changed)\n\n        gui.rubber(self.controlArea)\n\n        reset = gui.button(\n            None, self, \"Restore Original Order\", callback=self.restore_order,\n            tooltip=\"Show rows in the original order\", autoDefault=False)\n        self.buttonsArea.layout().insertWidget(0, reset)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n        # GUI with tabs\n        self.tabs = gui.tabWidget(self.mainArea)\n        self.tabs.currentChanged.connect(self._on_current_tab_changed)\n\n    def copy_to_clipboard(self):\n        self.copy()\n\n    @staticmethod\n    def sizeHint():\n        return QSize(800, 500)\n\n    @Inputs.data\n    def set_dataset(self, data, tid=None):\n        \"\"\"Set the input dataset.\"\"\"\n        if data is not None:\n            datasetname = getattr(data, \"name\", \"Data\")\n            if tid in self._inputs:\n                # update existing input slot\n                slot = self._inputs[tid]\n                view = slot.view\n                # reset the (header) view state.\n                view.setModel(None)\n                view.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)\n                assert self.tabs.indexOf(view) != -1\n                self.tabs.setTabText(self.tabs.indexOf(view), datasetname)\n            else:\n                view = DataTableView()\n                view.setSortingEnabled(True)\n\n                if self.select_rows:\n                    view.setSelectionBehavior(QTableView.SelectRows)\n\n                header = view.horizontalHeader()\n                header.setSectionsMovable(True)\n                header.setSectionsClickable(True)\n                header.setSortIndicatorShown(True)\n                header.setSortIndicator(-1, Qt.AscendingOrder)\n\n                # QHeaderView does not 'reset' the model sort column,\n                # because there is no guaranty (requirement) that the\n                # models understand the -1 sort column.\n                def sort_reset(index, order):\n                    if view.model() is not None and index == -1:\n                        view.model().sort(index, order)\n\n                header.sortIndicatorChanged.connect(sort_reset)\n                self.tabs.addTab(view, datasetname)\n\n            view.dataset = data\n            self.tabs.setCurrentWidget(view)\n\n            self._setup_table_view(view, data)\n            slot = TableSlot(tid, data, table_summary(data), view)\n            view.input_slot = slot\n            self._inputs[tid] = slot\n\n            self.tabs.setCurrentIndex(self.tabs.indexOf(view))\n\n            self._set_input_summary(slot)\n\n            if isinstance(slot.summary.len, concurrent.futures.Future):\n                def update(_):\n                    QMetaObject.invokeMethod(\n                        self, \"_update_info\", Qt.QueuedConnection)\n\n                slot.summary.len.add_done_callback(update)\n\n        elif tid in self._inputs:\n            slot = self._inputs.pop(tid)\n            view = slot.view\n            view.hide()\n            view.deleteLater()\n            self.tabs.removeTab(self.tabs.indexOf(view))\n\n            current = self.tabs.currentWidget()\n            if current is not None:\n                self._set_input_summary(current.input_slot)\n        else:\n            self._set_input_summary(None)\n\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n\n        if data and self.__pending_selected_rows is not None:\n            self.selected_rows = self.__pending_selected_rows\n            self.__pending_selected_rows = None\n        else:\n            self.selected_rows = []\n\n        if data and self.__pending_selected_cols is not None:\n            self.selected_cols = self.__pending_selected_cols\n            self.__pending_selected_cols = None\n        else:\n            self.selected_cols = []\n\n        self.set_selection()\n        self.unconditional_commit()\n\n    def _setup_table_view(self, view, data):\n        \"\"\"Setup the `view` (QTableView) with `data` (Orange.data.Table)\n        \"\"\"\n        if data is None:\n            view.setModel(None)\n            return\n\n        datamodel = RichTableModel(data)\n\n        rowcount = data.approx_len()\n\n        if self.color_by_class and data.domain.has_discrete_class:\n            color_schema = [\n                QColor(*c) for c in data.domain.class_var.colors]\n        else:\n            color_schema = None\n        if self.show_distributions:\n            view.setItemDelegate(\n                gui.TableBarItem(\n                    self, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(QStyledItemDelegate(self))\n\n        # Enable/disable view sorting based on data's type\n        view.setSortingEnabled(is_sortable(data))\n        header = view.horizontalHeader()\n        header.setSectionsClickable(is_sortable(data))\n        header.setSortIndicatorShown(is_sortable(data))\n        header.sortIndicatorChanged.connect(self.update_selection)\n\n        view.setModel(datamodel)\n\n        vheader = view.verticalHeader()\n        option = view.viewOptions()\n        size = view.style().sizeFromContents(\n            QStyle.CT_ItemViewItem, option,\n            QSize(20, 20), view)\n\n        vheader.setDefaultSectionSize(size.height() + 2)\n        vheader.setMinimumSectionSize(5)\n        vheader.setSectionResizeMode(QHeaderView.Fixed)\n\n        # Limit the number of rows displayed in the QTableView\n        # (workaround for QTBUG-18490 / QTBUG-28631)\n        maxrows = (2 ** 31 - 1) // (vheader.defaultSectionSize() + 2)\n        if rowcount > maxrows:\n            sliceproxy = TableSliceProxy(\n                parent=view, rowSlice=slice(0, maxrows))\n            sliceproxy.setSourceModel(datamodel)\n            # First reset the view (without this the header view retains\n            # it's state - at this point invalid/broken)\n            view.setModel(None)\n            view.setModel(sliceproxy)\n\n        assert view.model().rowCount() <= maxrows\n        assert vheader.sectionSize(0) > 1 or datamodel.rowCount() == 0\n\n        # update the header (attribute names)\n        self._update_variable_labels(view)\n\n        selmodel = BlockSelectionModel(\n            view.model(), parent=view, selectBlocks=not self.select_rows)\n        view.setSelectionModel(selmodel)\n        view.selectionFinished.connect(self.update_selection)\n\n    #noinspection PyBroadException\n    def set_corner_text(self, table, text):\n        \"\"\"Set table corner text.\"\"\"\n        # As this is an ugly hack, do everything in\n        # try - except blocks, as it may stop working in newer Qt.\n        # pylint: disable=broad-except\n        if not hasattr(table, \"btn\") and not hasattr(table, \"btnfailed\"):\n            try:\n                btn = table.findChild(QAbstractButton)\n\n                class Efc(QObject):\n                    @staticmethod\n                    def eventFilter(o, e):\n                        if (isinstance(o, QAbstractButton) and\n                                e.type() == QEvent.Paint):\n                            # paint by hand (borrowed from QTableCornerButton)\n                            btn = o\n                            opt = QStyleOptionHeader()\n                            opt.initFrom(btn)\n                            state = QStyle.State_None\n                            if btn.isEnabled():\n                                state |= QStyle.State_Enabled\n                            if btn.isActiveWindow():\n                                state |= QStyle.State_Active\n                            if btn.isDown():\n                                state |= QStyle.State_Sunken\n                            opt.state = state\n                            opt.rect = btn.rect()\n                            opt.text = btn.text()\n                            opt.position = QStyleOptionHeader.OnlyOneSection\n                            painter = QStylePainter(btn)\n                            painter.drawControl(QStyle.CE_Header, opt)\n                            return True     # eat event\n                        return False\n                table.efc = Efc()\n                # disconnect default handler for clicks and connect a new one, which supports\n                # both selection and deselection of all data\n                btn.clicked.disconnect()\n                btn.installEventFilter(table.efc)\n                btn.clicked.connect(self._on_select_all)\n                table.btn = btn\n\n                if sys.platform == \"darwin\":\n                    btn.setAttribute(Qt.WA_MacSmallSize)\n\n            except Exception:\n                table.btnfailed = True\n\n        if hasattr(table, \"btn\"):\n            try:\n                btn = table.btn\n                btn.setText(text)\n                opt = QStyleOptionHeader()\n                opt.text = btn.text()\n                s = btn.style().sizeFromContents(\n                    QStyle.CT_HeaderSection,\n                    opt, QSize(),\n                    btn).expandedTo(QApplication.globalStrut())\n                if s.isValid():\n                    table.verticalHeader().setMinimumWidth(s.width())\n            except Exception:\n                pass\n\n    def _set_input_summary(self, slot):\n        def format_summary(summary):\n            if isinstance(summary, ApproxSummary):\n                length = summary.len.result() if summary.len.done() else \\\n                    summary.approx_len\n            elif isinstance(summary, Summary):\n                length = summary.len\n            return length\n\n        summary, details = self.info.NoInput, \"\"\n        if slot:\n            summary = format_summary(slot.summary)\n            details = format_summary_details(slot.table)\n        self.info.set_input_summary(summary, details)\n\n        self.info_text.setText(\"\\n\".join(self._info_box_text(slot)))\n\n    @staticmethod\n    def _info_box_text(slot):\n        def format_part(part):\n            if isinstance(part, DenseArray):\n                if not part.nans:\n                    return \"\"\n                perc = 100 * part.nans / (part.nans + part.non_nans)\n                return f\" ({perc:.1f} % missing data)\"\n\n            if isinstance(part, SparseArray):\n                tag = \"sparse\"\n            elif isinstance(part, SparseBoolArray):\n                tag = \"tags\"\n            else:  # isinstance(part, NotAvailable)\n                return \"\"\n            dens = 100 * part.non_nans / (part.nans + part.non_nans)\n            return f\" ({tag}, density {dens:.2f} %)\"\n\n        def desc(n, part):\n            if n == 0:\n                return f\"No {part}s\"\n            elif n == 1:\n                return f\"1 {part}\"\n            else:\n                return f\"{n} {part}s\"\n\n        if slot is None:\n            return [\"No data.\"]\n        summary = slot.summary\n        text = []\n        if isinstance(summary, ApproxSummary):\n            if summary.len.done():\n                text.append(f\"{summary.len.result()} instances\")\n            else:\n                text.append(f\"~{summary.approx_len} instances\")\n        elif isinstance(summary, Summary):\n            text.append(f\"{summary.len} instances\")\n            if sum(p.nans for p in [summary.X, summary.Y, summary.M]) == 0:\n                text[-1] += \" (no missing data)\"\n\n        text.append(desc(len(summary.domain.attributes), \"feature\")\n                    + format_part(summary.X))\n\n        if not summary.domain.class_vars:\n            text.append(\"No target variable.\")\n        else:\n            if len(summary.domain.class_vars) > 1:\n                c_text = desc(len(summary.domain.class_vars), \"outcome\")\n            elif summary.domain.has_continuous_class:\n                c_text = \"Numeric outcome\"\n            else:\n                c_text = \"Target with \" \\\n                    + desc(len(summary.domain.class_var.values), \"value\")\n            text.append(c_text + format_part(summary.Y))\n\n        text.append(desc(len(summary.domain.metas), \"meta attribute\")\n                    + format_part(summary.M))\n        return text\n\n    def _set_output_summary(self, output):\n        summary = len(output) if output else self.info.NoOutput\n        details = format_summary_details(output) if output else \"\"\n        self.info.set_output_summary(summary, details)\n\n    def _on_select_all(self, _):\n        data_info = self.tabs.currentWidget().input_slot.summary\n        if len(self.selected_rows) == data_info.len \\\n                and len(self.selected_cols) == len(data_info.domain):\n            self.tabs.currentWidget().clearSelection()\n        else:\n            self.tabs.currentWidget().selectAll()\n\n    def _on_current_tab_changed(self, index):\n        \"\"\"Update the status bar on current tab change\"\"\"\n        view = self.tabs.widget(index)\n        if view is not None and view.model() is not None:\n            self._set_input_summary(view.input_slot)\n            self.update_selection()\n        else:\n            self._set_input_summary(None)\n\n    def _update_variable_labels(self, view):\n        \"Update the variable labels visibility for `view`\"\n        model = view.model()\n        if isinstance(model, TableSliceProxy):\n            model = model.sourceModel()\n\n        if self.show_attribute_labels:\n            model.setRichHeaderFlags(\n                RichTableModel.Labels | RichTableModel.Name)\n\n            labelnames = set()\n            domain = model.source.domain\n            for a in itertools.chain(domain.metas, domain.variables):\n                labelnames.update(a.attributes.keys())\n            labelnames = sorted(\n                [label for label in labelnames if not label.startswith(\"_\")])\n            self.set_corner_text(view, \"\\n\".join([\"\"] + labelnames))\n        else:\n            model.setRichHeaderFlags(RichTableModel.Name)\n            self.set_corner_text(view, \"\")\n\n    def _on_show_variable_labels_changed(self):\n        \"\"\"The variable labels (var.attribues) visibility was changed.\"\"\"\n        for slot in self._inputs.values():\n            self._update_variable_labels(slot.view)\n\n    def _on_distribution_color_changed(self):\n        for ti in range(self.tabs.count()):\n            widget = self.tabs.widget(ti)\n            model = widget.model()\n            while isinstance(model, QAbstractProxyModel):\n                model = model.sourceModel()\n            data = model.source\n            class_var = data.domain.class_var\n            if self.color_by_class and class_var and class_var.is_discrete:\n                color_schema = [QColor(*c) for c in class_var.colors]\n            else:\n                color_schema = None\n            if self.show_distributions:\n                delegate = gui.TableBarItem(self, color=self.dist_color,\n                                            color_schema=color_schema)\n            else:\n                delegate = QStyledItemDelegate(self)\n            widget.setItemDelegate(delegate)\n        tab = self.tabs.currentWidget()\n        if tab:\n            tab.reset()\n\n    def _on_select_rows_changed(self):\n        for slot in self._inputs.values():\n            selection_model = slot.view.selectionModel()\n            selection_model.setSelectBlocks(not self.select_rows)\n            if self.select_rows:\n                slot.view.setSelectionBehavior(QTableView.SelectRows)\n                # Expand the current selection to full row selection.\n                selection_model.select(\n                    selection_model.selection(),\n                    QItemSelectionModel.Select | QItemSelectionModel.Rows\n                )\n            else:\n                slot.view.setSelectionBehavior(QTableView.SelectItems)\n\n    def restore_order(self):\n        \"\"\"Restore the original data order of the current view.\"\"\"\n        table = self.tabs.currentWidget()\n        if table is not None:\n            table.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)\n\n    @Slot()\n    def _update_info(self):\n        current = self.tabs.currentWidget()\n        if current is not None and current.model() is not None:\n            self._set_input_summary(current.input_slot)\n\n    def update_selection(self, *_):\n        self.commit()\n\n    def set_selection(self):\n        if self.selected_rows and self.selected_cols:\n            view = self.tabs.currentWidget()\n            model = view.model()\n            if model.rowCount() <= self.selected_rows[-1] or \\\n                    model.columnCount() <= self.selected_cols[-1]:\n                return\n\n            selection = QItemSelection()\n            rowranges = list(ranges(self.selected_rows))\n            colranges = list(ranges(self.selected_cols))\n\n            for rowstart, rowend in rowranges:\n                for colstart, colend in colranges:\n                    selection.append(\n                        QItemSelectionRange(\n                            view.model().index(rowstart, colstart),\n                            view.model().index(rowend - 1, colend - 1)\n                        )\n                    )\n            view.selectionModel().select(\n                selection, QItemSelectionModel.ClearAndSelect)\n\n    @staticmethod\n    def get_selection(view):\n        \"\"\"\n        Return the selected row and column indices of the selection in view.\n        \"\"\"\n        selmodel = view.selectionModel()\n\n        selection = selmodel.selection()\n        model = view.model()\n        # map through the proxies into input table.\n        while isinstance(model, QAbstractProxyModel):\n            selection = model.mapSelectionToSource(selection)\n            model = model.sourceModel()\n\n        assert isinstance(selmodel, BlockSelectionModel)\n        assert isinstance(model, TableModel)\n\n        row_spans, col_spans = selection_blocks(selection)\n        rows = list(itertools.chain.from_iterable(itertools.starmap(range, row_spans)))\n        cols = list(itertools.chain.from_iterable(itertools.starmap(range, col_spans)))\n        rows = numpy.array(rows, dtype=numpy.intp)\n        # map the rows through the applied sorting (if any)\n        rows = model.mapToSourceRows(rows)\n        rows = rows.tolist()\n        return rows, cols\n\n    @staticmethod\n    def _get_model(view):\n        model = view.model()\n        while isinstance(model, QAbstractProxyModel):\n            model = model.sourceModel()\n        return model\n\n    def commit(self):\n        \"\"\"\n        Commit/send the current selected row/column selection.\n        \"\"\"\n        selected_data = table = rowsel = None\n        view = self.tabs.currentWidget()\n        if view and view.model() is not None:\n            model = self._get_model(view)\n            table = model.source  # The input data table\n\n            # Selections of individual instances are not implemented\n            # for SqlTables\n            if isinstance(table, SqlTable):\n                self._set_output_summary(selected_data)\n                self.Outputs.selected_data.send(selected_data)\n                self.Outputs.annotated_data.send(None)\n                return\n\n            rowsel, colsel = self.get_selection(view)\n            self.selected_rows, self.selected_cols = rowsel, colsel\n\n            domain = table.domain\n\n            if len(colsel) < len(domain) + len(domain.metas):\n                # only a subset of the columns is selected\n                allvars = domain.class_vars + domain.metas + domain.attributes\n                columns = [(c, model.headerData(c, Qt.Horizontal,\n                                                TableModel.DomainRole))\n                           for c in colsel]\n                assert all(role is not None for _, role in columns)\n\n                def select_vars(role):\n                    \"\"\"select variables for role (TableModel.DomainRole)\"\"\"\n                    return [allvars[c] for c, r in columns if r == role]\n\n                attrs = select_vars(TableModel.Attribute)\n                if attrs and issparse(table.X):\n                    # for sparse data you can only select all attributes\n                    attrs = table.domain.attributes\n                class_vars = select_vars(TableModel.ClassVar)\n                metas = select_vars(TableModel.Meta)\n                domain = Orange.data.Domain(attrs, class_vars, metas)\n\n            # Avoid a copy if none rows are selected.\n            if not rowsel:\n                selected_data = None\n            else:\n                selected_data = table.from_table(domain, table, rowsel)\n\n        self._set_output_summary(selected_data)\n        self.Outputs.selected_data.send(selected_data)\n        self.Outputs.annotated_data.send(create_annotated_table(table, rowsel))\n\n    def copy(self):\n        \"\"\"\n        Copy current table selection to the clipboard.\n        \"\"\"\n        view = self.tabs.currentWidget()\n        if view is not None:\n            mime = table_selection_to_mime_data(view)\n            QApplication.clipboard().setMimeData(\n                mime, QClipboard.Clipboard\n            )\n\n    def send_report(self):\n        view = self.tabs.currentWidget()\n        if not view or not view.model():\n            return\n        model = self._get_model(view)\n        self.report_data_brief(model.source)\n        self.report_table(view)\n\n\n# Table Summary\n\n# Basic statistics for X/Y/metas arrays\nDenseArray = namedtuple(\n    \"DenseArray\", [\"nans\", \"non_nans\", \"stats\"])\nSparseArray = namedtuple(\n    \"SparseArray\", [\"nans\", \"non_nans\", \"stats\"])\nSparseBoolArray = namedtuple(\n    \"SparseBoolArray\", [\"nans\", \"non_nans\", \"stats\"])\nNotAvailable = namedtuple(\"NotAvailable\", [])\n\n#: Orange.data.Table summary\nSummary = namedtuple(\n    \"Summary\",\n    [\"len\", \"domain\", \"X\", \"Y\", \"M\"])\n\n#: Orange.data.sql.table.SqlTable summary\nApproxSummary = namedtuple(\n    \"ApproxSummary\",\n    [\"approx_len\", \"len\", \"domain\", \"X\", \"Y\", \"M\"])\n\n\ndef table_summary(table):\n    if isinstance(table, SqlTable):\n        approx_len = table.approx_len()\n        len_future = concurrent.futures.Future()\n\n        def _len():\n            len_future.set_result(len(table))\n        threading.Thread(target=_len).start()  # KILL ME !!!\n\n        return ApproxSummary(approx_len, len_future, table.domain,\n                             NotAvailable(), NotAvailable(), NotAvailable())\n    else:\n        domain = table.domain\n        n_instances = len(table)\n        # dist = basic_stats.DomainBasicStats(table, include_metas=True)\n        bstats = datacaching.getCached(\n            table, basic_stats.DomainBasicStats, (table, True)\n        )\n\n        dist = bstats.stats\n        # pylint: disable=unbalanced-tuple-unpacking\n        X_dist, Y_dist, M_dist = numpy.split(\n            dist, numpy.cumsum([len(domain.attributes),\n                                len(domain.class_vars)]))\n\n        def parts(array, density, col_dist):\n            array = numpy.atleast_2d(array)\n            nans = sum([dist.nans for dist in col_dist])\n            non_nans = sum([dist.non_nans for dist in col_dist])\n            if density == Storage.DENSE:\n                return DenseArray(nans, non_nans, col_dist)\n            elif density == Storage.SPARSE:\n                return SparseArray(nans, non_nans, col_dist)\n            elif density == Storage.SPARSE_BOOL:\n                return SparseBoolArray(nans, non_nans, col_dist)\n            elif density == Storage.MISSING:\n                return NotAvailable()\n            else:\n                assert False\n                return None\n\n        X_part = parts(table.X, table.X_density(), X_dist)\n        Y_part = parts(table.Y, table.Y_density(), Y_dist)\n        M_part = parts(table.metas, table.metas_density(), M_dist)\n        return Summary(n_instances, domain, X_part, Y_part, M_part)\n\n\ndef is_sortable(table):\n    if isinstance(table, SqlTable):\n        return False\n    elif isinstance(table, Orange.data.Table):\n        return True\n    else:\n        return False\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    WidgetPreview(OWDataTable).run(\n        [(Table(\"iris\"), \"iris\"),\n         (Table(\"brown-selected\"), \"brown-selected\"),\n         (Table(\"housing\"), \"housing\")])\n",
            "new_file_content": "import sys\nimport threading\nimport itertools\nimport concurrent.futures\n\nfrom collections import OrderedDict, namedtuple\n\nfrom math import isnan\n\nimport numpy\nfrom scipy.sparse import issparse\n\nfrom AnyQt.QtWidgets import (\n    QTableView, QHeaderView, QAbstractButton, QApplication, QStyleOptionHeader,\n    QStyle, QStylePainter, QStyledItemDelegate\n)\nfrom AnyQt.QtGui import QColor, QClipboard\nfrom AnyQt.QtCore import (\n    Qt, QSize, QEvent, QObject, QMetaObject,\n    QAbstractProxyModel, QIdentityProxyModel, QModelIndex,\n    QItemSelectionModel, QItemSelection, QItemSelectionRange,\n)\nfrom AnyQt.QtCore import pyqtSlot as Slot\n\nimport Orange.data\nfrom Orange.data.storage import Storage\nfrom Orange.data.table import Table\nfrom Orange.data.sql.table import SqlTable\nfrom Orange.statistics import basic_stats\n\nfrom Orange.widgets import gui\nfrom Orange.widgets.settings import Setting\nfrom Orange.widgets.utils.itemselectionmodel import (\n    BlockSelectionModel, ranges, selection_blocks\n)\nfrom Orange.widgets.utils.tableview import TableView, \\\n    table_selection_to_mime_data\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\nfrom Orange.widgets.widget import OWWidget, Input, Output\nfrom Orange.widgets.utils import datacaching\nfrom Orange.widgets.utils.annotated_data import (create_annotated_table,\n                                                 ANNOTATED_DATA_SIGNAL_NAME)\nfrom Orange.widgets.utils.itemmodels import TableModel\nfrom Orange.widgets.utils.state_summary import format_summary_details\n\n\nclass RichTableModel(TableModel):\n    \"\"\"A TableModel with some extra bells and whistles/\n\n    (adds support for gui.BarRole, include variable labels and icons\n    in the header)\n    \"\"\"\n    #: Rich header data flags.\n    Name, Labels, Icon = 1, 2, 4\n\n    def __init__(self, sourcedata, parent=None):\n        super().__init__(sourcedata, parent)\n\n        self._header_flags = RichTableModel.Name\n        self._continuous = [var.is_continuous for var in self.vars]\n        labels = []\n        for var in self.vars:\n            if isinstance(var, Orange.data.Variable):\n                labels.extend(var.attributes.keys())\n        self._labels = list(sorted(\n            {label for label in labels if not label.startswith(\"_\")}))\n\n    def data(self, index, role=Qt.DisplayRole,\n             # for faster local lookup\n             _BarRole=gui.TableBarItem.BarRole):\n        # pylint: disable=arguments-differ\n        if role == _BarRole and self._continuous[index.column()]:\n            val = super().data(index, TableModel.ValueRole)\n            if val is None or isnan(val):\n                return None\n\n            dist = super().data(index, TableModel.VariableStatsRole)\n            if dist is not None and dist.max > dist.min:\n                return (val - dist.min) / (dist.max - dist.min)\n            else:\n                return None\n        elif role == Qt.TextAlignmentRole and self._continuous[index.column()]:\n            return Qt.AlignRight | Qt.AlignVCenter\n        else:\n            return super().data(index, role)\n\n    def headerData(self, section, orientation, role):\n        if orientation == Qt.Horizontal and role == Qt.DisplayRole:\n            var = super().headerData(\n                section, orientation, TableModel.VariableRole)\n            if var is None:\n                return super().headerData(\n                    section, orientation, Qt.DisplayRole)\n\n            lines = []\n            if self._header_flags & RichTableModel.Name:\n                lines.append(var.name)\n            if self._header_flags & RichTableModel.Labels:\n                lines.extend(str(var.attributes.get(label, \"\"))\n                             for label in self._labels)\n            return \"\\n\".join(lines)\n        elif orientation == Qt.Horizontal and role == Qt.DecorationRole and \\\n                self._header_flags & RichTableModel.Icon:\n            var = super().headerData(\n                section, orientation, TableModel.VariableRole)\n            if var is not None:\n                return gui.attributeIconDict[var]\n            else:\n                return None\n        else:\n            return super().headerData(section, orientation, role)\n\n    def setRichHeaderFlags(self, flags):\n        if flags != self._header_flags:\n            self._header_flags = flags\n            self.headerDataChanged.emit(\n                Qt.Horizontal, 0, self.columnCount() - 1)\n\n    def richHeaderFlags(self):\n        return self._header_flags\n\n\nclass TableSliceProxy(QIdentityProxyModel):\n    def __init__(self, parent=None, rowSlice=slice(0, -1), **kwargs):\n        super().__init__(parent, **kwargs)\n        self.__rowslice = rowSlice\n\n    def setRowSlice(self, rowslice):\n        if rowslice.step is not None and rowslice.step != 1:\n            raise ValueError(\"invalid stride\")\n\n        if self.__rowslice != rowslice:\n            self.beginResetModel()\n            self.__rowslice = rowslice\n            self.endResetModel()\n\n    def mapToSource(self, proxyindex):\n        model = self.sourceModel()\n        if model is None or not proxyindex.isValid():\n            return QModelIndex()\n\n        row, col = proxyindex.row(), proxyindex.column()\n        row = row + self.__rowslice.start\n        assert 0 <= row < model.rowCount()\n        return model.createIndex(row, col, proxyindex.internalPointer())\n\n    def mapFromSource(self, sourceindex):\n        model = self.sourceModel()\n        if model is None or not sourceindex.isValid():\n            return QModelIndex()\n        row, col = sourceindex.row(), sourceindex.column()\n        row = row - self.__rowslice.start\n        assert 0 <= row < self.rowCount()\n        return self.createIndex(row, col, sourceindex.internalPointer())\n\n    def rowCount(self, parent=QModelIndex()):\n        if parent.isValid():\n            return 0\n        count = super().rowCount()\n        start, stop, step = self.__rowslice.indices(count)\n        assert step == 1\n        return stop - start\n\n\nTableSlot = namedtuple(\"TableSlot\", [\"input_id\", \"table\", \"summary\", \"view\"])\n\n\nclass DataTableView(gui.HScrollStepMixin, TableView):\n    dataset: Table\n    input_slot: TableSlot\n\n\nclass OWDataTable(OWWidget):\n    name = \"Data Table\"\n    description = \"View the dataset in a spreadsheet.\"\n    icon = \"icons/Table.svg\"\n    priority = 50\n    keywords = []\n\n    buttons_area_orientation = Qt.Vertical\n\n    class Inputs:\n        data = Input(\"Data\", Table, multiple=True)\n\n    class Outputs:\n        selected_data = Output(\"Selected Data\", Table, default=True)\n        annotated_data = Output(ANNOTATED_DATA_SIGNAL_NAME, Table)\n\n    show_distributions = Setting(False)\n    dist_color_RGB = Setting((220, 220, 220, 255))\n    show_attribute_labels = Setting(True)\n    select_rows = Setting(True)\n    auto_commit = Setting(True)\n\n    color_by_class = Setting(True)\n    selected_rows = Setting([], schema_only=True)\n    selected_cols = Setting([], schema_only=True)\n\n    settings_version = 2\n\n    def __init__(self):\n        super().__init__()\n\n        self._inputs = OrderedDict()\n\n        self.__pending_selected_rows = self.selected_rows\n        self.selected_rows = None\n        self.__pending_selected_cols = self.selected_cols\n        self.selected_cols = None\n\n        self.dist_color = QColor(*self.dist_color_RGB)\n\n        info_box = gui.vBox(self.controlArea, \"Info\")\n        self.info_text = gui.widgetLabel(info_box)\n        self._set_input_summary(None)\n        self._set_output_summary(None)\n        gui.separator(self.controlArea)\n\n        box = gui.vBox(self.controlArea, \"Variables\")\n        self.c_show_attribute_labels = gui.checkBox(\n            box, self, \"show_attribute_labels\",\n            \"Show variable labels (if present)\",\n            callback=self._on_show_variable_labels_changed)\n\n        gui.checkBox(box, self, \"show_distributions\",\n                     'Visualize numeric values',\n                     callback=self._on_distribution_color_changed)\n        gui.checkBox(box, self, \"color_by_class\", 'Color by instance classes',\n                     callback=self._on_distribution_color_changed)\n\n        box = gui.vBox(self.controlArea, \"Selection\")\n\n        gui.checkBox(box, self, \"select_rows\", \"Select full rows\",\n                     callback=self._on_select_rows_changed)\n\n        gui.rubber(self.controlArea)\n\n        reset = gui.button(\n            None, self, \"Restore Original Order\", callback=self.restore_order,\n            tooltip=\"Show rows in the original order\", autoDefault=False)\n        self.buttonsArea.layout().insertWidget(0, reset)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n        # GUI with tabs\n        self.tabs = gui.tabWidget(self.mainArea)\n        self.tabs.currentChanged.connect(self._on_current_tab_changed)\n\n    def copy_to_clipboard(self):\n        self.copy()\n\n    @staticmethod\n    def sizeHint():\n        return QSize(800, 500)\n\n    @Inputs.data\n    def set_dataset(self, data, tid=None):\n        \"\"\"Set the input dataset.\"\"\"\n        if data is not None:\n            datasetname = getattr(data, \"name\", \"Data\")\n            if tid in self._inputs:\n                # update existing input slot\n                slot = self._inputs[tid]\n                view = slot.view\n                # reset the (header) view state.\n                view.setModel(None)\n                view.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)\n                assert self.tabs.indexOf(view) != -1\n                self.tabs.setTabText(self.tabs.indexOf(view), datasetname)\n            else:\n                view = DataTableView()\n                view.setSortingEnabled(True)\n\n                if self.select_rows:\n                    view.setSelectionBehavior(QTableView.SelectRows)\n\n                header = view.horizontalHeader()\n                header.setSectionsMovable(True)\n                header.setSectionsClickable(True)\n                header.setSortIndicatorShown(True)\n                header.setSortIndicator(-1, Qt.AscendingOrder)\n\n                # QHeaderView does not 'reset' the model sort column,\n                # because there is no guaranty (requirement) that the\n                # models understand the -1 sort column.\n                def sort_reset(index, order):\n                    if view.model() is not None and index == -1:\n                        view.model().sort(index, order)\n\n                header.sortIndicatorChanged.connect(sort_reset)\n                self.tabs.addTab(view, datasetname)\n\n            view.dataset = data\n            self.tabs.setCurrentWidget(view)\n\n            self._setup_table_view(view, data)\n            slot = TableSlot(tid, data, table_summary(data), view)\n            view.input_slot = slot\n            self._inputs[tid] = slot\n\n            self.tabs.setCurrentIndex(self.tabs.indexOf(view))\n\n            self._set_input_summary(slot)\n\n            if isinstance(slot.summary.len, concurrent.futures.Future):\n                def update(_):\n                    QMetaObject.invokeMethod(\n                        self, \"_update_info\", Qt.QueuedConnection)\n\n                slot.summary.len.add_done_callback(update)\n\n        elif tid in self._inputs:\n            slot = self._inputs.pop(tid)\n            view = slot.view\n            view.hide()\n            view.deleteLater()\n            self.tabs.removeTab(self.tabs.indexOf(view))\n\n            current = self.tabs.currentWidget()\n            if current is not None:\n                self._set_input_summary(current.input_slot)\n        else:\n            self._set_input_summary(None)\n\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n\n        if data and self.__pending_selected_rows is not None:\n            self.selected_rows = self.__pending_selected_rows\n            self.__pending_selected_rows = None\n        else:\n            self.selected_rows = []\n\n        if data and self.__pending_selected_cols is not None:\n            self.selected_cols = self.__pending_selected_cols\n            self.__pending_selected_cols = None\n        else:\n            self.selected_cols = []\n\n        self.set_selection()\n        self.unconditional_commit()\n\n    def _setup_table_view(self, view, data):\n        \"\"\"Setup the `view` (QTableView) with `data` (Orange.data.Table)\n        \"\"\"\n        if data is None:\n            view.setModel(None)\n            return\n\n        datamodel = RichTableModel(data)\n\n        rowcount = data.approx_len()\n\n        if self.color_by_class and data.domain.has_discrete_class:\n            color_schema = [\n                QColor(*c) for c in data.domain.class_var.colors]\n        else:\n            color_schema = None\n        if self.show_distributions:\n            view.setItemDelegate(\n                gui.TableBarItem(\n                    self, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(QStyledItemDelegate(self))\n\n        # Enable/disable view sorting based on data's type\n        view.setSortingEnabled(is_sortable(data))\n        header = view.horizontalHeader()\n        header.setSectionsClickable(is_sortable(data))\n        header.setSortIndicatorShown(is_sortable(data))\n        header.sortIndicatorChanged.connect(self.update_selection)\n\n        view.setModel(datamodel)\n\n        vheader = view.verticalHeader()\n        option = view.viewOptions()\n        size = view.style().sizeFromContents(\n            QStyle.CT_ItemViewItem, option,\n            QSize(20, 20), view)\n\n        vheader.setDefaultSectionSize(size.height() + 2)\n        vheader.setMinimumSectionSize(5)\n        vheader.setSectionResizeMode(QHeaderView.Fixed)\n\n        # Limit the number of rows displayed in the QTableView\n        # (workaround for QTBUG-18490 / QTBUG-28631)\n        maxrows = (2 ** 31 - 1) // (vheader.defaultSectionSize() + 2)\n        if rowcount > maxrows:\n            sliceproxy = TableSliceProxy(\n                parent=view, rowSlice=slice(0, maxrows))\n            sliceproxy.setSourceModel(datamodel)\n            # First reset the view (without this the header view retains\n            # it's state - at this point invalid/broken)\n            view.setModel(None)\n            view.setModel(sliceproxy)\n\n        assert view.model().rowCount() <= maxrows\n        assert vheader.sectionSize(0) > 1 or datamodel.rowCount() == 0\n\n        # update the header (attribute names)\n        self._update_variable_labels(view)\n\n        selmodel = BlockSelectionModel(\n            view.model(), parent=view, selectBlocks=not self.select_rows)\n        view.setSelectionModel(selmodel)\n        view.selectionFinished.connect(self.update_selection)\n\n    #noinspection PyBroadException\n    def set_corner_text(self, table, text):\n        \"\"\"Set table corner text.\"\"\"\n        # As this is an ugly hack, do everything in\n        # try - except blocks, as it may stop working in newer Qt.\n        # pylint: disable=broad-except\n        if not hasattr(table, \"btn\") and not hasattr(table, \"btnfailed\"):\n            try:\n                btn = table.findChild(QAbstractButton)\n\n                class Efc(QObject):\n                    @staticmethod\n                    def eventFilter(o, e):\n                        if (isinstance(o, QAbstractButton) and\n                                e.type() == QEvent.Paint):\n                            # paint by hand (borrowed from QTableCornerButton)\n                            btn = o\n                            opt = QStyleOptionHeader()\n                            opt.initFrom(btn)\n                            state = QStyle.State_None\n                            if btn.isEnabled():\n                                state |= QStyle.State_Enabled\n                            if btn.isActiveWindow():\n                                state |= QStyle.State_Active\n                            if btn.isDown():\n                                state |= QStyle.State_Sunken\n                            opt.state = state\n                            opt.rect = btn.rect()\n                            opt.text = btn.text()\n                            opt.position = QStyleOptionHeader.OnlyOneSection\n                            painter = QStylePainter(btn)\n                            painter.drawControl(QStyle.CE_Header, opt)\n                            return True     # eat event\n                        return False\n                table.efc = Efc()\n                # disconnect default handler for clicks and connect a new one, which supports\n                # both selection and deselection of all data\n                btn.clicked.disconnect()\n                btn.installEventFilter(table.efc)\n                btn.clicked.connect(self._on_select_all)\n                table.btn = btn\n\n                if sys.platform == \"darwin\":\n                    btn.setAttribute(Qt.WA_MacSmallSize)\n\n            except Exception:\n                table.btnfailed = True\n\n        if hasattr(table, \"btn\"):\n            try:\n                btn = table.btn\n                btn.setText(text)\n                opt = QStyleOptionHeader()\n                opt.text = btn.text()\n                s = btn.style().sizeFromContents(\n                    QStyle.CT_HeaderSection,\n                    opt, QSize(),\n                    btn).expandedTo(QApplication.globalStrut())\n                if s.isValid():\n                    table.verticalHeader().setMinimumWidth(s.width())\n            except Exception:\n                pass\n\n    def _set_input_summary(self, slot):\n        def format_summary(summary):\n            if isinstance(summary, ApproxSummary):\n                length = summary.len.result() if summary.len.done() else \\\n                    summary.approx_len\n            elif isinstance(summary, Summary):\n                length = summary.len\n            return length\n\n        summary, details = self.info.NoInput, \"\"\n        if slot:\n            summary = format_summary(slot.summary)\n            details = format_summary_details(slot.table)\n        self.info.set_input_summary(summary, details)\n\n        self.info_text.setText(\"\\n\".join(self._info_box_text(slot)))\n\n    @staticmethod\n    def _info_box_text(slot):\n        def format_part(part):\n            if isinstance(part, DenseArray):\n                if not part.nans:\n                    return \"\"\n                perc = 100 * part.nans / (part.nans + part.non_nans)\n                return f\" ({perc:.1f} % missing data)\"\n\n            if isinstance(part, SparseArray):\n                tag = \"sparse\"\n            elif isinstance(part, SparseBoolArray):\n                tag = \"tags\"\n            else:  # isinstance(part, NotAvailable)\n                return \"\"\n            dens = 100 * part.non_nans / (part.nans + part.non_nans)\n            return f\" ({tag}, density {dens:.2f} %)\"\n\n        def desc(n, part):\n            if n == 0:\n                return f\"No {part}s\"\n            elif n == 1:\n                return f\"1 {part}\"\n            else:\n                return f\"{n} {part}s\"\n\n        if slot is None:\n            return [\"No data.\"]\n        summary = slot.summary\n        text = []\n        if isinstance(summary, ApproxSummary):\n            if summary.len.done():\n                text.append(f\"{summary.len.result()} instances\")\n            else:\n                text.append(f\"~{summary.approx_len} instances\")\n        elif isinstance(summary, Summary):\n            text.append(f\"{summary.len} instances\")\n            if sum(p.nans for p in [summary.X, summary.Y, summary.M]) == 0:\n                text[-1] += \" (no missing data)\"\n\n        text.append(desc(len(summary.domain.attributes), \"feature\")\n                    + format_part(summary.X))\n\n        if not summary.domain.class_vars:\n            text.append(\"No target variable.\")\n        else:\n            if len(summary.domain.class_vars) > 1:\n                c_text = desc(len(summary.domain.class_vars), \"outcome\")\n            elif summary.domain.has_continuous_class:\n                c_text = \"Numeric outcome\"\n            else:\n                c_text = \"Target with \" \\\n                    + desc(len(summary.domain.class_var.values), \"value\")\n            text.append(c_text + format_part(summary.Y))\n\n        text.append(desc(len(summary.domain.metas), \"meta attribute\")\n                    + format_part(summary.M))\n        return text\n\n    def _set_output_summary(self, output):\n        summary = len(output) if output else self.info.NoOutput\n        details = format_summary_details(output) if output else \"\"\n        self.info.set_output_summary(summary, details)\n\n    def _on_select_all(self, _):\n        data_info = self.tabs.currentWidget().input_slot.summary\n        if len(self.selected_rows) == data_info.len \\\n                and len(self.selected_cols) == len(data_info.domain):\n            self.tabs.currentWidget().clearSelection()\n        else:\n            self.tabs.currentWidget().selectAll()\n\n    def _on_current_tab_changed(self, index):\n        \"\"\"Update the status bar on current tab change\"\"\"\n        view = self.tabs.widget(index)\n        if view is not None and view.model() is not None:\n            self._set_input_summary(view.input_slot)\n            self.update_selection()\n        else:\n            self._set_input_summary(None)\n\n    def _update_variable_labels(self, view):\n        \"Update the variable labels visibility for `view`\"\n        model = view.model()\n        if isinstance(model, TableSliceProxy):\n            model = model.sourceModel()\n\n        if self.show_attribute_labels:\n            model.setRichHeaderFlags(\n                RichTableModel.Labels | RichTableModel.Name)\n\n            labelnames = set()\n            domain = model.source.domain\n            for a in itertools.chain(domain.metas, domain.variables):\n                labelnames.update(a.attributes.keys())\n            labelnames = sorted(\n                [label for label in labelnames if not label.startswith(\"_\")])\n            self.set_corner_text(view, \"\\n\".join([\"\"] + labelnames))\n        else:\n            model.setRichHeaderFlags(RichTableModel.Name)\n            self.set_corner_text(view, \"\")\n\n    def _on_show_variable_labels_changed(self):\n        \"\"\"The variable labels (var.attribues) visibility was changed.\"\"\"\n        for slot in self._inputs.values():\n            self._update_variable_labels(slot.view)\n\n    def _on_distribution_color_changed(self):\n        for ti in range(self.tabs.count()):\n            widget = self.tabs.widget(ti)\n            model = widget.model()\n            while isinstance(model, QAbstractProxyModel):\n                model = model.sourceModel()\n            data = model.source\n            class_var = data.domain.class_var\n            if self.color_by_class and class_var and class_var.is_discrete:\n                color_schema = [QColor(*c) for c in class_var.colors]\n            else:\n                color_schema = None\n            if self.show_distributions:\n                delegate = gui.TableBarItem(self, color=self.dist_color,\n                                            color_schema=color_schema)\n            else:\n                delegate = QStyledItemDelegate(self)\n            widget.setItemDelegate(delegate)\n        tab = self.tabs.currentWidget()\n        if tab:\n            tab.reset()\n\n    def _on_select_rows_changed(self):\n        for slot in self._inputs.values():\n            selection_model = slot.view.selectionModel()\n            selection_model.setSelectBlocks(not self.select_rows)\n            if self.select_rows:\n                slot.view.setSelectionBehavior(QTableView.SelectRows)\n                # Expand the current selection to full row selection.\n                selection_model.select(\n                    selection_model.selection(),\n                    QItemSelectionModel.Select | QItemSelectionModel.Rows\n                )\n            else:\n                slot.view.setSelectionBehavior(QTableView.SelectItems)\n\n    def restore_order(self):\n        \"\"\"Restore the original data order of the current view.\"\"\"\n        table = self.tabs.currentWidget()\n        if table is not None:\n            table.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)\n\n    @Slot()\n    def _update_info(self):\n        current = self.tabs.currentWidget()\n        if current is not None and current.model() is not None:\n            self._set_input_summary(current.input_slot)\n\n    def update_selection(self, *_):\n        self.commit()\n\n    def set_selection(self):\n        if self.selected_rows and self.selected_cols:\n            view = self.tabs.currentWidget()\n            model = view.model()\n            if model.rowCount() <= self.selected_rows[-1] or \\\n                    model.columnCount() <= self.selected_cols[-1]:\n                return\n\n            selection = QItemSelection()\n            rowranges = list(ranges(self.selected_rows))\n            colranges = list(ranges(self.selected_cols))\n\n            for rowstart, rowend in rowranges:\n                for colstart, colend in colranges:\n                    selection.append(\n                        QItemSelectionRange(\n                            view.model().index(rowstart, colstart),\n                            view.model().index(rowend - 1, colend - 1)\n                        )\n                    )\n            view.selectionModel().select(\n                selection, QItemSelectionModel.ClearAndSelect)\n\n    @staticmethod\n    def get_selection(view):\n        \"\"\"\n        Return the selected row and column indices of the selection in view.\n        \"\"\"\n        selmodel = view.selectionModel()\n\n        selection = selmodel.selection()\n        model = view.model()\n        # map through the proxies into input table.\n        while isinstance(model, QAbstractProxyModel):\n            selection = model.mapSelectionToSource(selection)\n            model = model.sourceModel()\n\n        assert isinstance(selmodel, BlockSelectionModel)\n        assert isinstance(model, TableModel)\n\n        row_spans, col_spans = selection_blocks(selection)\n        rows = list(itertools.chain.from_iterable(itertools.starmap(range, row_spans)))\n        cols = list(itertools.chain.from_iterable(itertools.starmap(range, col_spans)))\n        rows = numpy.array(rows, dtype=numpy.intp)\n        # map the rows through the applied sorting (if any)\n        rows = model.mapToSourceRows(rows)\n        rows = rows.tolist()\n        return rows, cols\n\n    @staticmethod\n    def _get_model(view):\n        model = view.model()\n        while isinstance(model, QAbstractProxyModel):\n            model = model.sourceModel()\n        return model\n\n    def commit(self):\n        \"\"\"\n        Commit/send the current selected row/column selection.\n        \"\"\"\n        selected_data = table = rowsel = None\n        view = self.tabs.currentWidget()\n        if view and view.model() is not None:\n            model = self._get_model(view)\n            table = model.source  # The input data table\n\n            # Selections of individual instances are not implemented\n            # for SqlTables\n            if isinstance(table, SqlTable):\n                self._set_output_summary(selected_data)\n                self.Outputs.selected_data.send(selected_data)\n                self.Outputs.annotated_data.send(None)\n                return\n\n            rowsel, colsel = self.get_selection(view)\n            self.selected_rows, self.selected_cols = rowsel, colsel\n\n            domain = table.domain\n\n            if len(colsel) < len(domain) + len(domain.metas):\n                # only a subset of the columns is selected\n                allvars = domain.class_vars + domain.metas + domain.attributes\n                columns = [(c, model.headerData(c, Qt.Horizontal,\n                                                TableModel.DomainRole))\n                           for c in colsel]\n                assert all(role is not None for _, role in columns)\n\n                def select_vars(role):\n                    \"\"\"select variables for role (TableModel.DomainRole)\"\"\"\n                    return [allvars[c] for c, r in columns if r == role]\n\n                attrs = select_vars(TableModel.Attribute)\n                if attrs and issparse(table.X):\n                    # for sparse data you can only select all attributes\n                    attrs = table.domain.attributes\n                class_vars = select_vars(TableModel.ClassVar)\n                metas = select_vars(TableModel.Meta)\n                domain = Orange.data.Domain(attrs, class_vars, metas)\n\n            # Send all data by default\n            if not rowsel:\n                selected_data = table\n            else:\n                selected_data = table.from_table(domain, table, rowsel)\n\n        self._set_output_summary(selected_data)\n        self.Outputs.selected_data.send(selected_data)\n        self.Outputs.annotated_data.send(create_annotated_table(table, rowsel))\n\n    def copy(self):\n        \"\"\"\n        Copy current table selection to the clipboard.\n        \"\"\"\n        view = self.tabs.currentWidget()\n        if view is not None:\n            mime = table_selection_to_mime_data(view)\n            QApplication.clipboard().setMimeData(\n                mime, QClipboard.Clipboard\n            )\n\n    def send_report(self):\n        view = self.tabs.currentWidget()\n        if not view or not view.model():\n            return\n        model = self._get_model(view)\n        self.report_data_brief(model.source)\n        self.report_table(view)\n\n\n# Table Summary\n\n# Basic statistics for X/Y/metas arrays\nDenseArray = namedtuple(\n    \"DenseArray\", [\"nans\", \"non_nans\", \"stats\"])\nSparseArray = namedtuple(\n    \"SparseArray\", [\"nans\", \"non_nans\", \"stats\"])\nSparseBoolArray = namedtuple(\n    \"SparseBoolArray\", [\"nans\", \"non_nans\", \"stats\"])\nNotAvailable = namedtuple(\"NotAvailable\", [])\n\n#: Orange.data.Table summary\nSummary = namedtuple(\n    \"Summary\",\n    [\"len\", \"domain\", \"X\", \"Y\", \"M\"])\n\n#: Orange.data.sql.table.SqlTable summary\nApproxSummary = namedtuple(\n    \"ApproxSummary\",\n    [\"approx_len\", \"len\", \"domain\", \"X\", \"Y\", \"M\"])\n\n\ndef table_summary(table):\n    if isinstance(table, SqlTable):\n        approx_len = table.approx_len()\n        len_future = concurrent.futures.Future()\n\n        def _len():\n            len_future.set_result(len(table))\n        threading.Thread(target=_len).start()  # KILL ME !!!\n\n        return ApproxSummary(approx_len, len_future, table.domain,\n                             NotAvailable(), NotAvailable(), NotAvailable())\n    else:\n        domain = table.domain\n        n_instances = len(table)\n        # dist = basic_stats.DomainBasicStats(table, include_metas=True)\n        bstats = datacaching.getCached(\n            table, basic_stats.DomainBasicStats, (table, True)\n        )\n\n        dist = bstats.stats\n        # pylint: disable=unbalanced-tuple-unpacking\n        X_dist, Y_dist, M_dist = numpy.split(\n            dist, numpy.cumsum([len(domain.attributes),\n                                len(domain.class_vars)]))\n\n        def parts(array, density, col_dist):\n            array = numpy.atleast_2d(array)\n            nans = sum([dist.nans for dist in col_dist])\n            non_nans = sum([dist.non_nans for dist in col_dist])\n            if density == Storage.DENSE:\n                return DenseArray(nans, non_nans, col_dist)\n            elif density == Storage.SPARSE:\n                return SparseArray(nans, non_nans, col_dist)\n            elif density == Storage.SPARSE_BOOL:\n                return SparseBoolArray(nans, non_nans, col_dist)\n            elif density == Storage.MISSING:\n                return NotAvailable()\n            else:\n                assert False\n                return None\n\n        X_part = parts(table.X, table.X_density(), X_dist)\n        Y_part = parts(table.Y, table.Y_density(), Y_dist)\n        M_part = parts(table.metas, table.metas_density(), M_dist)\n        return Summary(n_instances, domain, X_part, Y_part, M_part)\n\n\ndef is_sortable(table):\n    if isinstance(table, SqlTable):\n        return False\n    elif isinstance(table, Orange.data.Table):\n        return True\n    else:\n        return False\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    WidgetPreview(OWDataTable).run(\n        [(Table(\"iris\"), \"iris\"),\n         (Table(\"brown-selected\"), \"brown-selected\"),\n         (Table(\"housing\"), \"housing\")])\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/data/owtable.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "505145276",
                "new_commit_hash": "4e13adf4e",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/data/owtable.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/data/owtable.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 196,
                            "length": 6
                        },
                        "new_range": {
                            "start": 196,
                            "length": 8
                        },
                        "section": "class OWDataTable(OWWidget):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "    selected_rows = Setting([], schema_only=True)",
                                "type": "context"
                            },
                            {
                                "content": "    selected_cols = Setting([], schema_only=True)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    settings_version = 2",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def __init__(self):",
                                "type": "context"
                            },
                            {
                                "content": "        super().__init__()",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/owtable.py",
                            "type": "class",
                            "name": "OWDataTable",
                            "content": "class OWDataTable(OWWidget):\n    name = \"Data Table\"\n    description = \"View the dataset in a spreadsheet.\"\n    icon = \"icons/Table.svg\"\n    priority = 50\n    keywords = []\n\n    buttons_area_orientation = Qt.Vertical\n\n    class Inputs:\n        data = Input(\"Data\", Table, multiple=True)\n\n    class Outputs:\n        selected_data = Output(\"Selected Data\", Table, default=True)\n        annotated_data = Output(ANNOTATED_DATA_SIGNAL_NAME, Table)\n\n    show_distributions = Setting(False)\n    dist_color_RGB = Setting((220, 220, 220, 255))\n    show_attribute_labels = Setting(True)\n    select_rows = Setting(True)\n    auto_commit = Setting(True)\n\n    color_by_class = Setting(True)\n    selected_rows = Setting([], schema_only=True)\n    selected_cols = Setting([], schema_only=True)\n\n    settings_version = 2\n\n    def __init__(self):\n        super().__init__()\n\n        self._inputs = OrderedDict()\n\n        self.__pending_selected_rows = self.selected_rows\n        self.selected_rows = None\n        self.__pending_selected_cols = self.selected_cols\n        self.selected_cols = None\n\n        self.dist_color = QColor(*self.dist_color_RGB)\n\n        info_box = gui.vBox(self.controlArea, \"Info\")\n        self.info_text = gui.widgetLabel(info_box)\n        self._set_input_summary(None)\n        self._set_output_summary(None)\n        gui.separator(self.controlArea)\n\n        box = gui.vBox(self.controlArea, \"Variables\")\n        self.c_show_attribute_labels = gui.checkBox(\n            box, self, \"show_attribute_labels\",\n            \"Show variable labels (if present)\",\n            callback=self._on_show_variable_labels_changed)\n\n        gui.checkBox(box, self, \"show_distributions\",\n                     'Visualize numeric values',\n                     callback=self._on_distribution_color_changed)\n        gui.checkBox(box, self, \"color_by_class\", 'Color by instance classes',\n                     callback=self._on_distribution_color_changed)\n\n        box = gui.vBox(self.controlArea, \"Selection\")\n\n        gui.checkBox(box, self, \"select_rows\", \"Select full rows\",\n                     callback=self._on_select_rows_changed)\n\n        gui.rubber(self.controlArea)\n\n        reset = gui.button(\n            None, self, \"Restore Original Order\", callback=self.restore_order,\n            tooltip=\"Show rows in the original order\", autoDefault=False)\n        self.buttonsArea.layout().insertWidget(0, reset)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n        # GUI with tabs\n        self.tabs = gui.tabWidget(self.mainArea)\n        self.tabs.currentChanged.connect(self._on_current_tab_changed)\n\n    def copy_to_clipboard(self):\n        self.copy()\n\n    @staticmethod\n    def sizeHint():\n        return QSize(800, 500)\n\n    @Inputs.data\n    def set_dataset(self, data, tid=None):\n        \"\"\"Set the input dataset.\"\"\"\n        if data is not None:\n            datasetname = getattr(data, \"name\", \"Data\")\n            if tid in self._inputs:\n                # update existing input slot\n                slot = self._inputs[tid]\n                view = slot.view\n                # reset the (header) view state.\n                view.setModel(None)\n                view.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)\n                assert self.tabs.indexOf(view) != -1\n                self.tabs.setTabText(self.tabs.indexOf(view), datasetname)\n            else:\n                view = DataTableView()\n                view.setSortingEnabled(True)\n\n                if self.select_rows:\n                    view.setSelectionBehavior(QTableView.SelectRows)\n\n                header = view.horizontalHeader()\n                header.setSectionsMovable(True)\n                header.setSectionsClickable(True)\n                header.setSortIndicatorShown(True)\n                header.setSortIndicator(-1, Qt.AscendingOrder)\n\n                # QHeaderView does not 'reset' the model sort column,\n                # because there is no guaranty (requirement) that the\n                # models understand the -1 sort column.\n                def sort_reset(index, order):\n                    if view.model() is not None and index == -1:\n                        view.model().sort(index, order)\n\n                header.sortIndicatorChanged.connect(sort_reset)\n                self.tabs.addTab(view, datasetname)\n\n            view.dataset = data\n            self.tabs.setCurrentWidget(view)\n\n            self._setup_table_view(view, data)\n            slot = TableSlot(tid, data, table_summary(data), view)\n            view.input_slot = slot\n            self._inputs[tid] = slot\n\n            self.tabs.setCurrentIndex(self.tabs.indexOf(view))\n\n            self._set_input_summary(slot)\n\n            if isinstance(slot.summary.len, concurrent.futures.Future):\n                def update(_):\n                    QMetaObject.invokeMethod(\n                        self, \"_update_info\", Qt.QueuedConnection)\n\n                slot.summary.len.add_done_callback(update)\n\n        elif tid in self._inputs:\n            slot = self._inputs.pop(tid)\n            view = slot.view\n            view.hide()\n            view.deleteLater()\n            self.tabs.removeTab(self.tabs.indexOf(view))\n\n            current = self.tabs.currentWidget()\n            if current is not None:\n                self._set_input_summary(current.input_slot)\n        else:\n            self._set_input_summary(None)\n\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n\n        if data and self.__pending_selected_rows is not None:\n            self.selected_rows = self.__pending_selected_rows\n            self.__pending_selected_rows = None\n        else:\n            self.selected_rows = []\n\n        if data and self.__pending_selected_cols is not None:\n            self.selected_cols = self.__pending_selected_cols\n            self.__pending_selected_cols = None\n        else:\n            self.selected_cols = []\n\n        self.set_selection()\n        self.unconditional_commit()\n\n    def _setup_table_view(self, view, data):\n        \"\"\"Setup the `view` (QTableView) with `data` (Orange.data.Table)\n        \"\"\"\n        if data is None:\n            view.setModel(None)\n            return\n\n        datamodel = RichTableModel(data)\n\n        rowcount = data.approx_len()\n\n        if self.color_by_class and data.domain.has_discrete_class:\n            color_schema = [\n                QColor(*c) for c in data.domain.class_var.colors]\n        else:\n            color_schema = None\n        if self.show_distributions:\n            view.setItemDelegate(\n                gui.TableBarItem(\n                    self, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(QStyledItemDelegate(self))\n\n        # Enable/disable view sorting based on data's type\n        view.setSortingEnabled(is_sortable(data))\n        header = view.horizontalHeader()\n        header.setSectionsClickable(is_sortable(data))\n        header.setSortIndicatorShown(is_sortable(data))\n        header.sortIndicatorChanged.connect(self.update_selection)\n\n        view.setModel(datamodel)\n\n        vheader = view.verticalHeader()\n        option = view.viewOptions()\n        size = view.style().sizeFromContents(\n            QStyle.CT_ItemViewItem, option,\n            QSize(20, 20), view)\n\n        vheader.setDefaultSectionSize(size.height() + 2)\n        vheader.setMinimumSectionSize(5)\n        vheader.setSectionResizeMode(QHeaderView.Fixed)\n\n        # Limit the number of rows displayed in the QTableView\n        # (workaround for QTBUG-18490 / QTBUG-28631)\n        maxrows = (2 ** 31 - 1) // (vheader.defaultSectionSize() + 2)\n        if rowcount > maxrows:\n            sliceproxy = TableSliceProxy(\n                parent=view, rowSlice=slice(0, maxrows))\n            sliceproxy.setSourceModel(datamodel)\n            # First reset the view (without this the header view retains\n            # it's state - at this point invalid/broken)\n            view.setModel(None)\n            view.setModel(sliceproxy)\n\n        assert view.model().rowCount() <= maxrows\n        assert vheader.sectionSize(0) > 1 or datamodel.rowCount() == 0\n\n        # update the header (attribute names)\n        self._update_variable_labels(view)\n\n        selmodel = BlockSelectionModel(\n            view.model(), parent=view, selectBlocks=not self.select_rows)\n        view.setSelectionModel(selmodel)\n        view.selectionFinished.connect(self.update_selection)\n\n    #noinspection PyBroadException\n    def set_corner_text(self, table, text):\n        \"\"\"Set table corner text.\"\"\"\n        # As this is an ugly hack, do everything in\n        # try - except blocks, as it may stop working in newer Qt.\n        # pylint: disable=broad-except\n        if not hasattr(table, \"btn\") and not hasattr(table, \"btnfailed\"):\n            try:\n                btn = table.findChild(QAbstractButton)\n\n                class Efc(QObject):\n                    @staticmethod\n                    def eventFilter(o, e):\n                        if (isinstance(o, QAbstractButton) and\n                                e.type() == QEvent.Paint):\n                            # paint by hand (borrowed from QTableCornerButton)\n                            btn = o\n                            opt = QStyleOptionHeader()\n                            opt.initFrom(btn)\n                            state = QStyle.State_None\n                            if btn.isEnabled():\n                                state |= QStyle.State_Enabled\n                            if btn.isActiveWindow():\n                                state |= QStyle.State_Active\n                            if btn.isDown():\n                                state |= QStyle.State_Sunken\n                            opt.state = state\n                            opt.rect = btn.rect()\n                            opt.text = btn.text()\n                            opt.position = QStyleOptionHeader.OnlyOneSection\n                            painter = QStylePainter(btn)\n                            painter.drawControl(QStyle.CE_Header, opt)\n                            return True     # eat event\n                        return False\n                table.efc = Efc()\n                # disconnect default handler for clicks and connect a new one, which supports\n                # both selection and deselection of all data\n                btn.clicked.disconnect()\n                btn.installEventFilter(table.efc)\n                btn.clicked.connect(self._on_select_all)\n                table.btn = btn\n\n                if sys.platform == \"darwin\":\n                    btn.setAttribute(Qt.WA_MacSmallSize)\n\n            except Exception:\n                table.btnfailed = True\n\n        if hasattr(table, \"btn\"):\n            try:\n                btn = table.btn\n                btn.setText(text)\n                opt = QStyleOptionHeader()\n                opt.text = btn.text()\n                s = btn.style().sizeFromContents(\n                    QStyle.CT_HeaderSection,\n                    opt, QSize(),\n                    btn).expandedTo(QApplication.globalStrut())\n                if s.isValid():\n                    table.verticalHeader().setMinimumWidth(s.width())\n            except Exception:\n                pass\n\n    def _set_input_summary(self, slot):\n        def format_summary(summary):\n            if isinstance(summary, ApproxSummary):\n                length = summary.len.result() if summary.len.done() else \\\n                    summary.approx_len\n            elif isinstance(summary, Summary):\n                length = summary.len\n            return length\n\n        summary, details = self.info.NoInput, \"\"\n        if slot:\n            summary = format_summary(slot.summary)\n            details = format_summary_details(slot.table)\n        self.info.set_input_summary(summary, details)\n\n        self.info_text.setText(\"\\n\".join(self._info_box_text(slot)))\n\n    @staticmethod\n    def _info_box_text(slot):\n        def format_part(part):\n            if isinstance(part, DenseArray):\n                if not part.nans:\n                    return \"\"\n                perc = 100 * part.nans / (part.nans + part.non_nans)\n                return f\" ({perc:.1f} % missing data)\"\n\n            if isinstance(part, SparseArray):\n                tag = \"sparse\"\n            elif isinstance(part, SparseBoolArray):\n                tag = \"tags\"\n            else:  # isinstance(part, NotAvailable)\n                return \"\"\n            dens = 100 * part.non_nans / (part.nans + part.non_nans)\n            return f\" ({tag}, density {dens:.2f} %)\"\n\n        def desc(n, part):\n            if n == 0:\n                return f\"No {part}s\"\n            elif n == 1:\n                return f\"1 {part}\"\n            else:\n                return f\"{n} {part}s\"\n\n        if slot is None:\n            return [\"No data.\"]\n        summary = slot.summary\n        text = []\n        if isinstance(summary, ApproxSummary):\n            if summary.len.done():\n                text.append(f\"{summary.len.result()} instances\")\n            else:\n                text.append(f\"~{summary.approx_len} instances\")\n        elif isinstance(summary, Summary):\n            text.append(f\"{summary.len} instances\")\n            if sum(p.nans for p in [summary.X, summary.Y, summary.M]) == 0:\n                text[-1] += \" (no missing data)\"\n\n        text.append(desc(len(summary.domain.attributes), \"feature\")\n                    + format_part(summary.X))\n\n        if not summary.domain.class_vars:\n            text.append(\"No target variable.\")\n        else:\n            if len(summary.domain.class_vars) > 1:\n                c_text = desc(len(summary.domain.class_vars), \"outcome\")\n            elif summary.domain.has_continuous_class:\n                c_text = \"Numeric outcome\"\n            else:\n                c_text = \"Target with \" \\\n                    + desc(len(summary.domain.class_var.values), \"value\")\n            text.append(c_text + format_part(summary.Y))\n\n        text.append(desc(len(summary.domain.metas), \"meta attribute\")\n                    + format_part(summary.M))\n        return text\n\n    def _set_output_summary(self, output):\n        summary = len(output) if output else self.info.NoOutput\n        details = format_summary_details(output) if output else \"\"\n        self.info.set_output_summary(summary, details)\n\n    def _on_select_all(self, _):\n        data_info = self.tabs.currentWidget().input_slot.summary\n        if len(self.selected_rows) == data_info.len \\\n                and len(self.selected_cols) == len(data_info.domain):\n            self.tabs.currentWidget().clearSelection()\n        else:\n            self.tabs.currentWidget().selectAll()\n\n    def _on_current_tab_changed(self, index):\n        \"\"\"Update the status bar on current tab change\"\"\"\n        view = self.tabs.widget(index)\n        if view is not None and view.model() is not None:\n            self._set_input_summary(view.input_slot)\n            self.update_selection()\n        else:\n            self._set_input_summary(None)\n\n    def _update_variable_labels(self, view):\n        \"Update the variable labels visibility for `view`\"\n        model = view.model()\n        if isinstance(model, TableSliceProxy):\n            model = model.sourceModel()\n\n        if self.show_attribute_labels:\n            model.setRichHeaderFlags(\n                RichTableModel.Labels | RichTableModel.Name)\n\n            labelnames = set()\n            domain = model.source.domain\n            for a in itertools.chain(domain.metas, domain.variables):\n                labelnames.update(a.attributes.keys())\n            labelnames = sorted(\n                [label for label in labelnames if not label.startswith(\"_\")])\n            self.set_corner_text(view, \"\\n\".join([\"\"] + labelnames))\n        else:\n            model.setRichHeaderFlags(RichTableModel.Name)\n            self.set_corner_text(view, \"\")\n\n    def _on_show_variable_labels_changed(self):\n        \"\"\"The variable labels (var.attribues) visibility was changed.\"\"\"\n        for slot in self._inputs.values():\n            self._update_variable_labels(slot.view)\n\n    def _on_distribution_color_changed(self):\n        for ti in range(self.tabs.count()):\n            widget = self.tabs.widget(ti)\n            model = widget.model()\n            while isinstance(model, QAbstractProxyModel):\n                model = model.sourceModel()\n            data = model.source\n            class_var = data.domain.class_var\n            if self.color_by_class and class_var and class_var.is_discrete:\n                color_schema = [QColor(*c) for c in class_var.colors]\n            else:\n                color_schema = None\n            if self.show_distributions:\n                delegate = gui.TableBarItem(self, color=self.dist_color,\n                                            color_schema=color_schema)\n            else:\n                delegate = QStyledItemDelegate(self)\n            widget.setItemDelegate(delegate)\n        tab = self.tabs.currentWidget()\n        if tab:\n            tab.reset()\n\n    def _on_select_rows_changed(self):\n        for slot in self._inputs.values():\n            selection_model = slot.view.selectionModel()\n            selection_model.setSelectBlocks(not self.select_rows)\n            if self.select_rows:\n                slot.view.setSelectionBehavior(QTableView.SelectRows)\n                # Expand the current selection to full row selection.\n                selection_model.select(\n                    selection_model.selection(),\n                    QItemSelectionModel.Select | QItemSelectionModel.Rows\n                )\n            else:\n                slot.view.setSelectionBehavior(QTableView.SelectItems)\n\n    def restore_order(self):\n        \"\"\"Restore the original data order of the current view.\"\"\"\n        table = self.tabs.currentWidget()\n        if table is not None:\n            table.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)\n\n    @Slot()\n    def _update_info(self):\n        current = self.tabs.currentWidget()\n        if current is not None and current.model() is not None:\n            self._set_input_summary(current.input_slot)\n\n    def update_selection(self, *_):\n        self.commit()\n\n    def set_selection(self):\n        if self.selected_rows and self.selected_cols:\n            view = self.tabs.currentWidget()\n            model = view.model()\n            if model.rowCount() <= self.selected_rows[-1] or \\\n                    model.columnCount() <= self.selected_cols[-1]:\n                return\n\n            selection = QItemSelection()\n            rowranges = list(ranges(self.selected_rows))\n            colranges = list(ranges(self.selected_cols))\n\n            for rowstart, rowend in rowranges:\n                for colstart, colend in colranges:\n                    selection.append(\n                        QItemSelectionRange(\n                            view.model().index(rowstart, colstart),\n                            view.model().index(rowend - 1, colend - 1)\n                        )\n                    )\n            view.selectionModel().select(\n                selection, QItemSelectionModel.ClearAndSelect)\n\n    @staticmethod\n    def get_selection(view):\n        \"\"\"\n        Return the selected row and column indices of the selection in view.\n        \"\"\"\n        selmodel = view.selectionModel()\n\n        selection = selmodel.selection()\n        model = view.model()\n        # map through the proxies into input table.\n        while isinstance(model, QAbstractProxyModel):\n            selection = model.mapSelectionToSource(selection)\n            model = model.sourceModel()\n\n        assert isinstance(selmodel, BlockSelectionModel)\n        assert isinstance(model, TableModel)\n\n        row_spans, col_spans = selection_blocks(selection)\n        rows = list(itertools.chain.from_iterable(itertools.starmap(range, row_spans)))\n        cols = list(itertools.chain.from_iterable(itertools.starmap(range, col_spans)))\n        rows = numpy.array(rows, dtype=numpy.intp)\n        # map the rows through the applied sorting (if any)\n        rows = model.mapToSourceRows(rows)\n        rows = rows.tolist()\n        return rows, cols\n\n    @staticmethod\n    def _get_model(view):\n        model = view.model()\n        while isinstance(model, QAbstractProxyModel):\n            model = model.sourceModel()\n        return model\n\n    def commit(self):\n        \"\"\"\n        Commit/send the current selected row/column selection.\n        \"\"\"\n        selected_data = table = rowsel = None\n        view = self.tabs.currentWidget()\n        if view and view.model() is not None:\n            model = self._get_model(view)\n            table = model.source  # The input data table\n\n            # Selections of individual instances are not implemented\n            # for SqlTables\n            if isinstance(table, SqlTable):\n                self._set_output_summary(selected_data)\n                self.Outputs.selected_data.send(selected_data)\n                self.Outputs.annotated_data.send(None)\n                return\n\n            rowsel, colsel = self.get_selection(view)\n            self.selected_rows, self.selected_cols = rowsel, colsel\n\n            domain = table.domain\n\n            if len(colsel) < len(domain) + len(domain.metas):\n                # only a subset of the columns is selected\n                allvars = domain.class_vars + domain.metas + domain.attributes\n                columns = [(c, model.headerData(c, Qt.Horizontal,\n                                                TableModel.DomainRole))\n                           for c in colsel]\n                assert all(role is not None for _, role in columns)\n\n                def select_vars(role):\n                    \"\"\"select variables for role (TableModel.DomainRole)\"\"\"\n                    return [allvars[c] for c, r in columns if r == role]\n\n                attrs = select_vars(TableModel.Attribute)\n                if attrs and issparse(table.X):\n                    # for sparse data you can only select all attributes\n                    attrs = table.domain.attributes\n                class_vars = select_vars(TableModel.ClassVar)\n                metas = select_vars(TableModel.Meta)\n                domain = Orange.data.Domain(attrs, class_vars, metas)\n\n            # Send all data by default\n            if not rowsel:\n                selected_data = table\n            else:\n                selected_data = table.from_table(domain, table, rowsel)\n\n        self._set_output_summary(selected_data)\n        self.Outputs.selected_data.send(selected_data)\n        self.Outputs.annotated_data.send(create_annotated_table(table, rowsel))\n\n    def copy(self):\n        \"\"\"\n        Copy current table selection to the clipboard.\n        \"\"\"\n        view = self.tabs.currentWidget()\n        if view is not None:\n            mime = table_selection_to_mime_data(view)\n            QApplication.clipboard().setMimeData(\n                mime, QClipboard.Clipboard\n            )\n\n    def send_report(self):\n        view = self.tabs.currentWidget()\n        if not view or not view.model():\n            return\n        model = self._get_model(view)\n        self.report_data_brief(model.source)\n        self.report_table(view)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 173,
                            "end_lineno": 771,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 739,
                            "length": 9
                        },
                        "new_range": {
                            "start": 741,
                            "length": 9
                        },
                        "section": "class OWDataTable(OWWidget):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "                metas = select_vars(TableModel.Meta)",
                                "type": "context"
                            },
                            {
                                "content": "                domain = Orange.data.Domain(attrs, class_vars, metas)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "            # Avoid a copy if none rows are selected.",
                                "type": "deleted"
                            },
                            {
                                "content": "            # Send all data by default",
                                "type": "added"
                            },
                            {
                                "content": "            if not rowsel:",
                                "type": "context"
                            },
                            {
                                "content": "                selected_data = None",
                                "type": "deleted"
                            },
                            {
                                "content": "                selected_data = table",
                                "type": "added"
                            },
                            {
                                "content": "            else:",
                                "type": "context"
                            },
                            {
                                "content": "                selected_data = table.from_table(domain, table, rowsel)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/owtable.py",
                            "type": "method",
                            "name": "OWDataTable.commit",
                            "content": "class OWDataTable(OWWidget):\n    name = \"Data Table\"\n    description = \"View the dataset in a spreadsheet.\"\n    icon = \"icons/Table.svg\"\n    priority = 50\n    keywords = []\n\n    buttons_area_orientation = Qt.Vertical\n\n    class Inputs:\n        data = Input(\"Data\", Table, multiple=True)\n\n    class Outputs:\n        selected_data = Output(\"Selected Data\", Table, default=True)\n        annotated_data = Output(ANNOTATED_DATA_SIGNAL_NAME, Table)\n\n    show_distributions = Setting(False)\n    dist_color_RGB = Setting((220, 220, 220, 255))\n    show_attribute_labels = Setting(True)\n    select_rows = Setting(True)\n    auto_commit = Setting(True)\n\n    color_by_class = Setting(True)\n    selected_rows = Setting([], schema_only=True)\n    selected_cols = Setting([], schema_only=True)\n\n    def __init__(self):\n        super().__init__()\n\n        self._inputs = OrderedDict()\n\n        self.__pending_selected_rows = self.selected_rows\n        self.selected_rows = None\n        self.__pending_selected_cols = self.selected_cols\n        self.selected_cols = None\n\n        self.dist_color = QColor(*self.dist_color_RGB)\n\n        info_box = gui.vBox(self.controlArea, \"Info\")\n        self.info_text = gui.widgetLabel(info_box)\n        self._set_input_summary(None)\n        self._set_output_summary(None)\n        gui.separator(self.controlArea)\n\n        box = gui.vBox(self.controlArea, \"Variables\")\n        self.c_show_attribute_labels = gui.checkBox(\n            box, self, \"show_attribute_labels\",\n            \"Show variable labels (if present)\",\n            callback=self._on_show_variable_labels_changed)\n\n        gui.checkBox(box, self, \"show_distributions\",\n                     'Visualize numeric values',\n                     callback=self._on_distribution_color_changed)\n        gui.checkBox(box, self, \"color_by_class\", 'Color by instance classes',\n                     callback=self._on_distribution_color_changed)\n\n        box = gui.vBox(self.controlArea, \"Selection\")\n\n        gui.checkBox(box, self, \"select_rows\", \"Select full rows\",\n                     callback=self._on_select_rows_changed)\n\n        gui.rubber(self.controlArea)\n\n        reset = gui.button(\n            None, self, \"Restore Original Order\", callback=self.restore_order,\n            tooltip=\"Show rows in the original order\", autoDefault=False)\n        self.buttonsArea.layout().insertWidget(0, reset)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n        # GUI with tabs\n        self.tabs = gui.tabWidget(self.mainArea)\n        self.tabs.currentChanged.connect(self._on_current_tab_changed)\n\n    def copy_to_clipboard(self):\n        self.copy()\n\n    @staticmethod\n    def sizeHint():\n        return QSize(800, 500)\n\n    @Inputs.data\n    def set_dataset(self, data, tid=None):\n        \"\"\"Set the input dataset.\"\"\"\n        if data is not None:\n            datasetname = getattr(data, \"name\", \"Data\")\n            if tid in self._inputs:\n                # update existing input slot\n                slot = self._inputs[tid]\n                view = slot.view\n                # reset the (header) view state.\n                view.setModel(None)\n                view.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)\n                assert self.tabs.indexOf(view) != -1\n                self.tabs.setTabText(self.tabs.indexOf(view), datasetname)\n            else:\n                view = DataTableView()\n                view.setSortingEnabled(True)\n\n                if self.select_rows:\n                    view.setSelectionBehavior(QTableView.SelectRows)\n\n                header = view.horizontalHeader()\n                header.setSectionsMovable(True)\n                header.setSectionsClickable(True)\n                header.setSortIndicatorShown(True)\n                header.setSortIndicator(-1, Qt.AscendingOrder)\n\n                # QHeaderView does not 'reset' the model sort column,\n                # because there is no guaranty (requirement) that the\n                # models understand the -1 sort column.\n                def sort_reset(index, order):\n                    if view.model() is not None and index == -1:\n                        view.model().sort(index, order)\n\n                header.sortIndicatorChanged.connect(sort_reset)\n                self.tabs.addTab(view, datasetname)\n\n            view.dataset = data\n            self.tabs.setCurrentWidget(view)\n\n            self._setup_table_view(view, data)\n            slot = TableSlot(tid, data, table_summary(data), view)\n            view.input_slot = slot\n            self._inputs[tid] = slot\n\n            self.tabs.setCurrentIndex(self.tabs.indexOf(view))\n\n            self._set_input_summary(slot)\n\n            if isinstance(slot.summary.len, concurrent.futures.Future):\n                def update(_):\n                    QMetaObject.invokeMethod(\n                        self, \"_update_info\", Qt.QueuedConnection)\n\n                slot.summary.len.add_done_callback(update)\n\n        elif tid in self._inputs:\n            slot = self._inputs.pop(tid)\n            view = slot.view\n            view.hide()\n            view.deleteLater()\n            self.tabs.removeTab(self.tabs.indexOf(view))\n\n            current = self.tabs.currentWidget()\n            if current is not None:\n                self._set_input_summary(current.input_slot)\n        else:\n            self._set_input_summary(None)\n\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n\n        if data and self.__pending_selected_rows is not None:\n            self.selected_rows = self.__pending_selected_rows\n            self.__pending_selected_rows = None\n        else:\n            self.selected_rows = []\n\n        if data and self.__pending_selected_cols is not None:\n            self.selected_cols = self.__pending_selected_cols\n            self.__pending_selected_cols = None\n        else:\n            self.selected_cols = []\n\n        self.set_selection()\n        self.unconditional_commit()\n\n    def _setup_table_view(self, view, data):\n        \"\"\"Setup the `view` (QTableView) with `data` (Orange.data.Table)\n        \"\"\"\n        if data is None:\n            view.setModel(None)\n            return\n\n        datamodel = RichTableModel(data)\n\n        rowcount = data.approx_len()\n\n        if self.color_by_class and data.domain.has_discrete_class:\n            color_schema = [\n                QColor(*c) for c in data.domain.class_var.colors]\n        else:\n            color_schema = None\n        if self.show_distributions:\n            view.setItemDelegate(\n                gui.TableBarItem(\n                    self, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(QStyledItemDelegate(self))\n\n        # Enable/disable view sorting based on data's type\n        view.setSortingEnabled(is_sortable(data))\n        header = view.horizontalHeader()\n        header.setSectionsClickable(is_sortable(data))\n        header.setSortIndicatorShown(is_sortable(data))\n        header.sortIndicatorChanged.connect(self.update_selection)\n\n        view.setModel(datamodel)\n\n        vheader = view.verticalHeader()\n        option = view.viewOptions()\n        size = view.style().sizeFromContents(\n            QStyle.CT_ItemViewItem, option,\n            QSize(20, 20), view)\n\n        vheader.setDefaultSectionSize(size.height() + 2)\n        vheader.setMinimumSectionSize(5)\n        vheader.setSectionResizeMode(QHeaderView.Fixed)\n\n        # Limit the number of rows displayed in the QTableView\n        # (workaround for QTBUG-18490 / QTBUG-28631)\n        maxrows = (2 ** 31 - 1) // (vheader.defaultSectionSize() + 2)\n        if rowcount > maxrows:\n            sliceproxy = TableSliceProxy(\n                parent=view, rowSlice=slice(0, maxrows))\n            sliceproxy.setSourceModel(datamodel)\n            # First reset the view (without this the header view retains\n            # it's state - at this point invalid/broken)\n            view.setModel(None)\n            view.setModel(sliceproxy)\n\n        assert view.model().rowCount() <= maxrows\n        assert vheader.sectionSize(0) > 1 or datamodel.rowCount() == 0\n\n        # update the header (attribute names)\n        self._update_variable_labels(view)\n\n        selmodel = BlockSelectionModel(\n            view.model(), parent=view, selectBlocks=not self.select_rows)\n        view.setSelectionModel(selmodel)\n        view.selectionFinished.connect(self.update_selection)\n\n    #noinspection PyBroadException\n    def set_corner_text(self, table, text):\n        \"\"\"Set table corner text.\"\"\"\n        # As this is an ugly hack, do everything in\n        # try - except blocks, as it may stop working in newer Qt.\n        # pylint: disable=broad-except\n        if not hasattr(table, \"btn\") and not hasattr(table, \"btnfailed\"):\n            try:\n                btn = table.findChild(QAbstractButton)\n\n                class Efc(QObject):\n                    @staticmethod\n                    def eventFilter(o, e):\n                        if (isinstance(o, QAbstractButton) and\n                                e.type() == QEvent.Paint):\n                            # paint by hand (borrowed from QTableCornerButton)\n                            btn = o\n                            opt = QStyleOptionHeader()\n                            opt.initFrom(btn)\n                            state = QStyle.State_None\n                            if btn.isEnabled():\n                                state |= QStyle.State_Enabled\n                            if btn.isActiveWindow():\n                                state |= QStyle.State_Active\n                            if btn.isDown():\n                                state |= QStyle.State_Sunken\n                            opt.state = state\n                            opt.rect = btn.rect()\n                            opt.text = btn.text()\n                            opt.position = QStyleOptionHeader.OnlyOneSection\n                            painter = QStylePainter(btn)\n                            painter.drawControl(QStyle.CE_Header, opt)\n                            return True     # eat event\n                        return False\n                table.efc = Efc()\n                # disconnect default handler for clicks and connect a new one, which supports\n                # both selection and deselection of all data\n                btn.clicked.disconnect()\n                btn.installEventFilter(table.efc)\n                btn.clicked.connect(self._on_select_all)\n                table.btn = btn\n\n                if sys.platform == \"darwin\":\n                    btn.setAttribute(Qt.WA_MacSmallSize)\n\n            except Exception:\n                table.btnfailed = True\n\n        if hasattr(table, \"btn\"):\n            try:\n                btn = table.btn\n                btn.setText(text)\n                opt = QStyleOptionHeader()\n                opt.text = btn.text()\n                s = btn.style().sizeFromContents(\n                    QStyle.CT_HeaderSection,\n                    opt, QSize(),\n                    btn).expandedTo(QApplication.globalStrut())\n                if s.isValid():\n                    table.verticalHeader().setMinimumWidth(s.width())\n            except Exception:\n                pass\n\n    def _set_input_summary(self, slot):\n        def format_summary(summary):\n            if isinstance(summary, ApproxSummary):\n                length = summary.len.result() if summary.len.done() else \\\n                    summary.approx_len\n            elif isinstance(summary, Summary):\n                length = summary.len\n            return length\n\n        summary, details = self.info.NoInput, \"\"\n        if slot:\n            summary = format_summary(slot.summary)\n            details = format_summary_details(slot.table)\n        self.info.set_input_summary(summary, details)\n\n        self.info_text.setText(\"\\n\".join(self._info_box_text(slot)))\n\n    @staticmethod\n    def _info_box_text(slot):\n        def format_part(part):\n            if isinstance(part, DenseArray):\n                if not part.nans:\n                    return \"\"\n                perc = 100 * part.nans / (part.nans + part.non_nans)\n                return f\" ({perc:.1f} % missing data)\"\n\n            if isinstance(part, SparseArray):\n                tag = \"sparse\"\n            elif isinstance(part, SparseBoolArray):\n                tag = \"tags\"\n            else:  # isinstance(part, NotAvailable)\n                return \"\"\n            dens = 100 * part.non_nans / (part.nans + part.non_nans)\n            return f\" ({tag}, density {dens:.2f} %)\"\n\n        def desc(n, part):\n            if n == 0:\n                return f\"No {part}s\"\n            elif n == 1:\n                return f\"1 {part}\"\n            else:\n                return f\"{n} {part}s\"\n\n        if slot is None:\n            return [\"No data.\"]\n        summary = slot.summary\n        text = []\n        if isinstance(summary, ApproxSummary):\n            if summary.len.done():\n                text.append(f\"{summary.len.result()} instances\")\n            else:\n                text.append(f\"~{summary.approx_len} instances\")\n        elif isinstance(summary, Summary):\n            text.append(f\"{summary.len} instances\")\n            if sum(p.nans for p in [summary.X, summary.Y, summary.M]) == 0:\n                text[-1] += \" (no missing data)\"\n\n        text.append(desc(len(summary.domain.attributes), \"feature\")\n                    + format_part(summary.X))\n\n        if not summary.domain.class_vars:\n            text.append(\"No target variable.\")\n        else:\n            if len(summary.domain.class_vars) > 1:\n                c_text = desc(len(summary.domain.class_vars), \"outcome\")\n            elif summary.domain.has_continuous_class:\n                c_text = \"Numeric outcome\"\n            else:\n                c_text = \"Target with \" \\\n                    + desc(len(summary.domain.class_var.values), \"value\")\n            text.append(c_text + format_part(summary.Y))\n\n        text.append(desc(len(summary.domain.metas), \"meta attribute\")\n                    + format_part(summary.M))\n        return text\n\n    def _set_output_summary(self, output):\n        summary = len(output) if output else self.info.NoOutput\n        details = format_summary_details(output) if output else \"\"\n        self.info.set_output_summary(summary, details)\n\n    def _on_select_all(self, _):\n        data_info = self.tabs.currentWidget().input_slot.summary\n        if len(self.selected_rows) == data_info.len \\\n                and len(self.selected_cols) == len(data_info.domain):\n            self.tabs.currentWidget().clearSelection()\n        else:\n            self.tabs.currentWidget().selectAll()\n\n    def _on_current_tab_changed(self, index):\n        \"\"\"Update the status bar on current tab change\"\"\"\n        view = self.tabs.widget(index)\n        if view is not None and view.model() is not None:\n            self._set_input_summary(view.input_slot)\n            self.update_selection()\n        else:\n            self._set_input_summary(None)\n\n    def _update_variable_labels(self, view):\n        \"Update the variable labels visibility for `view`\"\n        model = view.model()\n        if isinstance(model, TableSliceProxy):\n            model = model.sourceModel()\n\n        if self.show_attribute_labels:\n            model.setRichHeaderFlags(\n                RichTableModel.Labels | RichTableModel.Name)\n\n            labelnames = set()\n            domain = model.source.domain\n            for a in itertools.chain(domain.metas, domain.variables):\n                labelnames.update(a.attributes.keys())\n            labelnames = sorted(\n                [label for label in labelnames if not label.startswith(\"_\")])\n            self.set_corner_text(view, \"\\n\".join([\"\"] + labelnames))\n        else:\n            model.setRichHeaderFlags(RichTableModel.Name)\n            self.set_corner_text(view, \"\")\n\n    def _on_show_variable_labels_changed(self):\n        \"\"\"The variable labels (var.attribues) visibility was changed.\"\"\"\n        for slot in self._inputs.values():\n            self._update_variable_labels(slot.view)\n\n    def _on_distribution_color_changed(self):\n        for ti in range(self.tabs.count()):\n            widget = self.tabs.widget(ti)\n            model = widget.model()\n            while isinstance(model, QAbstractProxyModel):\n                model = model.sourceModel()\n            data = model.source\n            class_var = data.domain.class_var\n            if self.color_by_class and class_var and class_var.is_discrete:\n                color_schema = [QColor(*c) for c in class_var.colors]\n            else:\n                color_schema = None\n            if self.show_distributions:\n                delegate = gui.TableBarItem(self, color=self.dist_color,\n                                            color_schema=color_schema)\n            else:\n                delegate = QStyledItemDelegate(self)\n            widget.setItemDelegate(delegate)\n        tab = self.tabs.currentWidget()\n        if tab:\n            tab.reset()\n\n    def _on_select_rows_changed(self):\n        for slot in self._inputs.values():\n            selection_model = slot.view.selectionModel()\n            selection_model.setSelectBlocks(not self.select_rows)\n            if self.select_rows:\n                slot.view.setSelectionBehavior(QTableView.SelectRows)\n                # Expand the current selection to full row selection.\n                selection_model.select(\n                    selection_model.selection(),\n                    QItemSelectionModel.Select | QItemSelectionModel.Rows\n                )\n            else:\n                slot.view.setSelectionBehavior(QTableView.SelectItems)\n\n    def restore_order(self):\n        \"\"\"Restore the original data order of the current view.\"\"\"\n        table = self.tabs.currentWidget()\n        if table is not None:\n            table.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)\n\n    @Slot()\n    def _update_info(self):\n        current = self.tabs.currentWidget()\n        if current is not None and current.model() is not None:\n            self._set_input_summary(current.input_slot)\n\n    def update_selection(self, *_):\n        self.commit()\n\n    def set_selection(self):\n        if self.selected_rows and self.selected_cols:\n            view = self.tabs.currentWidget()\n            model = view.model()\n            if model.rowCount() <= self.selected_rows[-1] or \\\n                    model.columnCount() <= self.selected_cols[-1]:\n                return\n\n            selection = QItemSelection()\n            rowranges = list(ranges(self.selected_rows))\n            colranges = list(ranges(self.selected_cols))\n\n            for rowstart, rowend in rowranges:\n                for colstart, colend in colranges:\n                    selection.append(\n                        QItemSelectionRange(\n                            view.model().index(rowstart, colstart),\n                            view.model().index(rowend - 1, colend - 1)\n                        )\n                    )\n            view.selectionModel().select(\n                selection, QItemSelectionModel.ClearAndSelect)\n\n    @staticmethod\n    def get_selection(view):\n        \"\"\"\n        Return the selected row and column indices of the selection in view.\n        \"\"\"\n        selmodel = view.selectionModel()\n\n        selection = selmodel.selection()\n        model = view.model()\n        # map through the proxies into input table.\n        while isinstance(model, QAbstractProxyModel):\n            selection = model.mapSelectionToSource(selection)\n            model = model.sourceModel()\n\n        assert isinstance(selmodel, BlockSelectionModel)\n        assert isinstance(model, TableModel)\n\n        row_spans, col_spans = selection_blocks(selection)\n        rows = list(itertools.chain.from_iterable(itertools.starmap(range, row_spans)))\n        cols = list(itertools.chain.from_iterable(itertools.starmap(range, col_spans)))\n        rows = numpy.array(rows, dtype=numpy.intp)\n        # map the rows through the applied sorting (if any)\n        rows = model.mapToSourceRows(rows)\n        rows = rows.tolist()\n        return rows, cols\n\n    @staticmethod\n    def _get_model(view):\n        model = view.model()\n        while isinstance(model, QAbstractProxyModel):\n            model = model.sourceModel()\n        return model\n\n    def commit(self):\n        \"\"\"\n        Commit/send the current selected row/column selection.\n        \"\"\"\n        selected_data = table = rowsel = None\n        view = self.tabs.currentWidget()\n        if view and view.model() is not None:\n            model = self._get_model(view)\n            table = model.source  # The input data table\n\n            # Selections of individual instances are not implemented\n            # for SqlTables\n            if isinstance(table, SqlTable):\n                self._set_output_summary(selected_data)\n                self.Outputs.selected_data.send(selected_data)\n                self.Outputs.annotated_data.send(None)\n                return\n\n            rowsel, colsel = self.get_selection(view)\n            self.selected_rows, self.selected_cols = rowsel, colsel\n\n            domain = table.domain\n\n            if len(colsel) < len(domain) + len(domain.metas):\n                # only a subset of the columns is selected\n                allvars = domain.class_vars + domain.metas + domain.attributes\n                columns = [(c, model.headerData(c, Qt.Horizontal,\n                                                TableModel.DomainRole))\n                           for c in colsel]\n                assert all(role is not None for _, role in columns)\n\n                def select_vars(role):\n                    \"\"\"select variables for role (TableModel.DomainRole)\"\"\"\n                    return [allvars[c] for c, r in columns if r == role]\n\n                attrs = select_vars(TableModel.Attribute)\n                if attrs and issparse(table.X):\n                    # for sparse data you can only select all attributes\n                    attrs = table.domain.attributes\n                class_vars = select_vars(TableModel.ClassVar)\n                metas = select_vars(TableModel.Meta)\n                domain = Orange.data.Domain(attrs, class_vars, metas)\n\n            # Avoid a copy if none rows are selected.\n            if not rowsel:\n                selected_data = None\n            else:\n                selected_data = table.from_table(domain, table, rowsel)\n\n        self._set_output_summary(selected_data)\n        self.Outputs.selected_data.send(selected_data)\n        self.Outputs.annotated_data.send(create_annotated_table(table, rowsel))\n\n    def copy(self):\n        \"\"\"\n        Copy current table selection to the clipboard.\n        \"\"\"\n        view = self.tabs.currentWidget()\n        if view is not None:\n            mime = table_selection_to_mime_data(view)\n            QApplication.clipboard().setMimeData(\n                mime, QClipboard.Clipboard\n            )\n\n    def send_report(self):\n        view = self.tabs.currentWidget()\n        if not view or not view.model():\n            return\n        model = self._get_model(view)\n        self.report_data_brief(model.source)\n        self.report_table(view)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 699,
                            "end_lineno": 750,
                            "parent": {
                                "file_name": "Orange/widgets/data/owtable.py",
                                "type": "class",
                                "name": "OWDataTable",
                                "content": "class OWDataTable(OWWidget):\n    name = \"Data Table\"\n    description = \"View the dataset in a spreadsheet.\"\n    icon = \"icons/Table.svg\"\n    priority = 50\n    keywords = []\n\n    buttons_area_orientation = Qt.Vertical\n\n    class Inputs:\n        data = Input(\"Data\", Table, multiple=True)\n\n    class Outputs:\n        selected_data = Output(\"Selected Data\", Table, default=True)\n        annotated_data = Output(ANNOTATED_DATA_SIGNAL_NAME, Table)\n\n    show_distributions = Setting(False)\n    dist_color_RGB = Setting((220, 220, 220, 255))\n    show_attribute_labels = Setting(True)\n    select_rows = Setting(True)\n    auto_commit = Setting(True)\n\n    color_by_class = Setting(True)\n    selected_rows = Setting([], schema_only=True)\n    selected_cols = Setting([], schema_only=True)\n\n    def __init__(self):\n        super().__init__()\n\n        self._inputs = OrderedDict()\n\n        self.__pending_selected_rows = self.selected_rows\n        self.selected_rows = None\n        self.__pending_selected_cols = self.selected_cols\n        self.selected_cols = None\n\n        self.dist_color = QColor(*self.dist_color_RGB)\n\n        info_box = gui.vBox(self.controlArea, \"Info\")\n        self.info_text = gui.widgetLabel(info_box)\n        self._set_input_summary(None)\n        self._set_output_summary(None)\n        gui.separator(self.controlArea)\n\n        box = gui.vBox(self.controlArea, \"Variables\")\n        self.c_show_attribute_labels = gui.checkBox(\n            box, self, \"show_attribute_labels\",\n            \"Show variable labels (if present)\",\n            callback=self._on_show_variable_labels_changed)\n\n        gui.checkBox(box, self, \"show_distributions\",\n                     'Visualize numeric values',\n                     callback=self._on_distribution_color_changed)\n        gui.checkBox(box, self, \"color_by_class\", 'Color by instance classes',\n                     callback=self._on_distribution_color_changed)\n\n        box = gui.vBox(self.controlArea, \"Selection\")\n\n        gui.checkBox(box, self, \"select_rows\", \"Select full rows\",\n                     callback=self._on_select_rows_changed)\n\n        gui.rubber(self.controlArea)\n\n        reset = gui.button(\n            None, self, \"Restore Original Order\", callback=self.restore_order,\n            tooltip=\"Show rows in the original order\", autoDefault=False)\n        self.buttonsArea.layout().insertWidget(0, reset)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n        # GUI with tabs\n        self.tabs = gui.tabWidget(self.mainArea)\n        self.tabs.currentChanged.connect(self._on_current_tab_changed)\n\n    def copy_to_clipboard(self):\n        self.copy()\n\n    @staticmethod\n    def sizeHint():\n        return QSize(800, 500)\n\n    @Inputs.data\n    def set_dataset(self, data, tid=None):\n        \"\"\"Set the input dataset.\"\"\"\n        if data is not None:\n            datasetname = getattr(data, \"name\", \"Data\")\n            if tid in self._inputs:\n                # update existing input slot\n                slot = self._inputs[tid]\n                view = slot.view\n                # reset the (header) view state.\n                view.setModel(None)\n                view.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)\n                assert self.tabs.indexOf(view) != -1\n                self.tabs.setTabText(self.tabs.indexOf(view), datasetname)\n            else:\n                view = DataTableView()\n                view.setSortingEnabled(True)\n\n                if self.select_rows:\n                    view.setSelectionBehavior(QTableView.SelectRows)\n\n                header = view.horizontalHeader()\n                header.setSectionsMovable(True)\n                header.setSectionsClickable(True)\n                header.setSortIndicatorShown(True)\n                header.setSortIndicator(-1, Qt.AscendingOrder)\n\n                # QHeaderView does not 'reset' the model sort column,\n                # because there is no guaranty (requirement) that the\n                # models understand the -1 sort column.\n                def sort_reset(index, order):\n                    if view.model() is not None and index == -1:\n                        view.model().sort(index, order)\n\n                header.sortIndicatorChanged.connect(sort_reset)\n                self.tabs.addTab(view, datasetname)\n\n            view.dataset = data\n            self.tabs.setCurrentWidget(view)\n\n            self._setup_table_view(view, data)\n            slot = TableSlot(tid, data, table_summary(data), view)\n            view.input_slot = slot\n            self._inputs[tid] = slot\n\n            self.tabs.setCurrentIndex(self.tabs.indexOf(view))\n\n            self._set_input_summary(slot)\n\n            if isinstance(slot.summary.len, concurrent.futures.Future):\n                def update(_):\n                    QMetaObject.invokeMethod(\n                        self, \"_update_info\", Qt.QueuedConnection)\n\n                slot.summary.len.add_done_callback(update)\n\n        elif tid in self._inputs:\n            slot = self._inputs.pop(tid)\n            view = slot.view\n            view.hide()\n            view.deleteLater()\n            self.tabs.removeTab(self.tabs.indexOf(view))\n\n            current = self.tabs.currentWidget()\n            if current is not None:\n                self._set_input_summary(current.input_slot)\n        else:\n            self._set_input_summary(None)\n\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n\n        if data and self.__pending_selected_rows is not None:\n            self.selected_rows = self.__pending_selected_rows\n            self.__pending_selected_rows = None\n        else:\n            self.selected_rows = []\n\n        if data and self.__pending_selected_cols is not None:\n            self.selected_cols = self.__pending_selected_cols\n            self.__pending_selected_cols = None\n        else:\n            self.selected_cols = []\n\n        self.set_selection()\n        self.unconditional_commit()\n\n    def _setup_table_view(self, view, data):\n        \"\"\"Setup the `view` (QTableView) with `data` (Orange.data.Table)\n        \"\"\"\n        if data is None:\n            view.setModel(None)\n            return\n\n        datamodel = RichTableModel(data)\n\n        rowcount = data.approx_len()\n\n        if self.color_by_class and data.domain.has_discrete_class:\n            color_schema = [\n                QColor(*c) for c in data.domain.class_var.colors]\n        else:\n            color_schema = None\n        if self.show_distributions:\n            view.setItemDelegate(\n                gui.TableBarItem(\n                    self, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(QStyledItemDelegate(self))\n\n        # Enable/disable view sorting based on data's type\n        view.setSortingEnabled(is_sortable(data))\n        header = view.horizontalHeader()\n        header.setSectionsClickable(is_sortable(data))\n        header.setSortIndicatorShown(is_sortable(data))\n        header.sortIndicatorChanged.connect(self.update_selection)\n\n        view.setModel(datamodel)\n\n        vheader = view.verticalHeader()\n        option = view.viewOptions()\n        size = view.style().sizeFromContents(\n            QStyle.CT_ItemViewItem, option,\n            QSize(20, 20), view)\n\n        vheader.setDefaultSectionSize(size.height() + 2)\n        vheader.setMinimumSectionSize(5)\n        vheader.setSectionResizeMode(QHeaderView.Fixed)\n\n        # Limit the number of rows displayed in the QTableView\n        # (workaround for QTBUG-18490 / QTBUG-28631)\n        maxrows = (2 ** 31 - 1) // (vheader.defaultSectionSize() + 2)\n        if rowcount > maxrows:\n            sliceproxy = TableSliceProxy(\n                parent=view, rowSlice=slice(0, maxrows))\n            sliceproxy.setSourceModel(datamodel)\n            # First reset the view (without this the header view retains\n            # it's state - at this point invalid/broken)\n            view.setModel(None)\n            view.setModel(sliceproxy)\n\n        assert view.model().rowCount() <= maxrows\n        assert vheader.sectionSize(0) > 1 or datamodel.rowCount() == 0\n\n        # update the header (attribute names)\n        self._update_variable_labels(view)\n\n        selmodel = BlockSelectionModel(\n            view.model(), parent=view, selectBlocks=not self.select_rows)\n        view.setSelectionModel(selmodel)\n        view.selectionFinished.connect(self.update_selection)\n\n    #noinspection PyBroadException\n    def set_corner_text(self, table, text):\n        \"\"\"Set table corner text.\"\"\"\n        # As this is an ugly hack, do everything in\n        # try - except blocks, as it may stop working in newer Qt.\n        # pylint: disable=broad-except\n        if not hasattr(table, \"btn\") and not hasattr(table, \"btnfailed\"):\n            try:\n                btn = table.findChild(QAbstractButton)\n\n                class Efc(QObject):\n                    @staticmethod\n                    def eventFilter(o, e):\n                        if (isinstance(o, QAbstractButton) and\n                                e.type() == QEvent.Paint):\n                            # paint by hand (borrowed from QTableCornerButton)\n                            btn = o\n                            opt = QStyleOptionHeader()\n                            opt.initFrom(btn)\n                            state = QStyle.State_None\n                            if btn.isEnabled():\n                                state |= QStyle.State_Enabled\n                            if btn.isActiveWindow():\n                                state |= QStyle.State_Active\n                            if btn.isDown():\n                                state |= QStyle.State_Sunken\n                            opt.state = state\n                            opt.rect = btn.rect()\n                            opt.text = btn.text()\n                            opt.position = QStyleOptionHeader.OnlyOneSection\n                            painter = QStylePainter(btn)\n                            painter.drawControl(QStyle.CE_Header, opt)\n                            return True     # eat event\n                        return False\n                table.efc = Efc()\n                # disconnect default handler for clicks and connect a new one, which supports\n                # both selection and deselection of all data\n                btn.clicked.disconnect()\n                btn.installEventFilter(table.efc)\n                btn.clicked.connect(self._on_select_all)\n                table.btn = btn\n\n                if sys.platform == \"darwin\":\n                    btn.setAttribute(Qt.WA_MacSmallSize)\n\n            except Exception:\n                table.btnfailed = True\n\n        if hasattr(table, \"btn\"):\n            try:\n                btn = table.btn\n                btn.setText(text)\n                opt = QStyleOptionHeader()\n                opt.text = btn.text()\n                s = btn.style().sizeFromContents(\n                    QStyle.CT_HeaderSection,\n                    opt, QSize(),\n                    btn).expandedTo(QApplication.globalStrut())\n                if s.isValid():\n                    table.verticalHeader().setMinimumWidth(s.width())\n            except Exception:\n                pass\n\n    def _set_input_summary(self, slot):\n        def format_summary(summary):\n            if isinstance(summary, ApproxSummary):\n                length = summary.len.result() if summary.len.done() else \\\n                    summary.approx_len\n            elif isinstance(summary, Summary):\n                length = summary.len\n            return length\n\n        summary, details = self.info.NoInput, \"\"\n        if slot:\n            summary = format_summary(slot.summary)\n            details = format_summary_details(slot.table)\n        self.info.set_input_summary(summary, details)\n\n        self.info_text.setText(\"\\n\".join(self._info_box_text(slot)))\n\n    @staticmethod\n    def _info_box_text(slot):\n        def format_part(part):\n            if isinstance(part, DenseArray):\n                if not part.nans:\n                    return \"\"\n                perc = 100 * part.nans / (part.nans + part.non_nans)\n                return f\" ({perc:.1f} % missing data)\"\n\n            if isinstance(part, SparseArray):\n                tag = \"sparse\"\n            elif isinstance(part, SparseBoolArray):\n                tag = \"tags\"\n            else:  # isinstance(part, NotAvailable)\n                return \"\"\n            dens = 100 * part.non_nans / (part.nans + part.non_nans)\n            return f\" ({tag}, density {dens:.2f} %)\"\n\n        def desc(n, part):\n            if n == 0:\n                return f\"No {part}s\"\n            elif n == 1:\n                return f\"1 {part}\"\n            else:\n                return f\"{n} {part}s\"\n\n        if slot is None:\n            return [\"No data.\"]\n        summary = slot.summary\n        text = []\n        if isinstance(summary, ApproxSummary):\n            if summary.len.done():\n                text.append(f\"{summary.len.result()} instances\")\n            else:\n                text.append(f\"~{summary.approx_len} instances\")\n        elif isinstance(summary, Summary):\n            text.append(f\"{summary.len} instances\")\n            if sum(p.nans for p in [summary.X, summary.Y, summary.M]) == 0:\n                text[-1] += \" (no missing data)\"\n\n        text.append(desc(len(summary.domain.attributes), \"feature\")\n                    + format_part(summary.X))\n\n        if not summary.domain.class_vars:\n            text.append(\"No target variable.\")\n        else:\n            if len(summary.domain.class_vars) > 1:\n                c_text = desc(len(summary.domain.class_vars), \"outcome\")\n            elif summary.domain.has_continuous_class:\n                c_text = \"Numeric outcome\"\n            else:\n                c_text = \"Target with \" \\\n                    + desc(len(summary.domain.class_var.values), \"value\")\n            text.append(c_text + format_part(summary.Y))\n\n        text.append(desc(len(summary.domain.metas), \"meta attribute\")\n                    + format_part(summary.M))\n        return text\n\n    def _set_output_summary(self, output):\n        summary = len(output) if output else self.info.NoOutput\n        details = format_summary_details(output) if output else \"\"\n        self.info.set_output_summary(summary, details)\n\n    def _on_select_all(self, _):\n        data_info = self.tabs.currentWidget().input_slot.summary\n        if len(self.selected_rows) == data_info.len \\\n                and len(self.selected_cols) == len(data_info.domain):\n            self.tabs.currentWidget().clearSelection()\n        else:\n            self.tabs.currentWidget().selectAll()\n\n    def _on_current_tab_changed(self, index):\n        \"\"\"Update the status bar on current tab change\"\"\"\n        view = self.tabs.widget(index)\n        if view is not None and view.model() is not None:\n            self._set_input_summary(view.input_slot)\n            self.update_selection()\n        else:\n            self._set_input_summary(None)\n\n    def _update_variable_labels(self, view):\n        \"Update the variable labels visibility for `view`\"\n        model = view.model()\n        if isinstance(model, TableSliceProxy):\n            model = model.sourceModel()\n\n        if self.show_attribute_labels:\n            model.setRichHeaderFlags(\n                RichTableModel.Labels | RichTableModel.Name)\n\n            labelnames = set()\n            domain = model.source.domain\n            for a in itertools.chain(domain.metas, domain.variables):\n                labelnames.update(a.attributes.keys())\n            labelnames = sorted(\n                [label for label in labelnames if not label.startswith(\"_\")])\n            self.set_corner_text(view, \"\\n\".join([\"\"] + labelnames))\n        else:\n            model.setRichHeaderFlags(RichTableModel.Name)\n            self.set_corner_text(view, \"\")\n\n    def _on_show_variable_labels_changed(self):\n        \"\"\"The variable labels (var.attribues) visibility was changed.\"\"\"\n        for slot in self._inputs.values():\n            self._update_variable_labels(slot.view)\n\n    def _on_distribution_color_changed(self):\n        for ti in range(self.tabs.count()):\n            widget = self.tabs.widget(ti)\n            model = widget.model()\n            while isinstance(model, QAbstractProxyModel):\n                model = model.sourceModel()\n            data = model.source\n            class_var = data.domain.class_var\n            if self.color_by_class and class_var and class_var.is_discrete:\n                color_schema = [QColor(*c) for c in class_var.colors]\n            else:\n                color_schema = None\n            if self.show_distributions:\n                delegate = gui.TableBarItem(self, color=self.dist_color,\n                                            color_schema=color_schema)\n            else:\n                delegate = QStyledItemDelegate(self)\n            widget.setItemDelegate(delegate)\n        tab = self.tabs.currentWidget()\n        if tab:\n            tab.reset()\n\n    def _on_select_rows_changed(self):\n        for slot in self._inputs.values():\n            selection_model = slot.view.selectionModel()\n            selection_model.setSelectBlocks(not self.select_rows)\n            if self.select_rows:\n                slot.view.setSelectionBehavior(QTableView.SelectRows)\n                # Expand the current selection to full row selection.\n                selection_model.select(\n                    selection_model.selection(),\n                    QItemSelectionModel.Select | QItemSelectionModel.Rows\n                )\n            else:\n                slot.view.setSelectionBehavior(QTableView.SelectItems)\n\n    def restore_order(self):\n        \"\"\"Restore the original data order of the current view.\"\"\"\n        table = self.tabs.currentWidget()\n        if table is not None:\n            table.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)\n\n    @Slot()\n    def _update_info(self):\n        current = self.tabs.currentWidget()\n        if current is not None and current.model() is not None:\n            self._set_input_summary(current.input_slot)\n\n    def update_selection(self, *_):\n        self.commit()\n\n    def set_selection(self):\n        if self.selected_rows and self.selected_cols:\n            view = self.tabs.currentWidget()\n            model = view.model()\n            if model.rowCount() <= self.selected_rows[-1] or \\\n                    model.columnCount() <= self.selected_cols[-1]:\n                return\n\n            selection = QItemSelection()\n            rowranges = list(ranges(self.selected_rows))\n            colranges = list(ranges(self.selected_cols))\n\n            for rowstart, rowend in rowranges:\n                for colstart, colend in colranges:\n                    selection.append(\n                        QItemSelectionRange(\n                            view.model().index(rowstart, colstart),\n                            view.model().index(rowend - 1, colend - 1)\n                        )\n                    )\n            view.selectionModel().select(\n                selection, QItemSelectionModel.ClearAndSelect)\n\n    @staticmethod\n    def get_selection(view):\n        \"\"\"\n        Return the selected row and column indices of the selection in view.\n        \"\"\"\n        selmodel = view.selectionModel()\n\n        selection = selmodel.selection()\n        model = view.model()\n        # map through the proxies into input table.\n        while isinstance(model, QAbstractProxyModel):\n            selection = model.mapSelectionToSource(selection)\n            model = model.sourceModel()\n\n        assert isinstance(selmodel, BlockSelectionModel)\n        assert isinstance(model, TableModel)\n\n        row_spans, col_spans = selection_blocks(selection)\n        rows = list(itertools.chain.from_iterable(itertools.starmap(range, row_spans)))\n        cols = list(itertools.chain.from_iterable(itertools.starmap(range, col_spans)))\n        rows = numpy.array(rows, dtype=numpy.intp)\n        # map the rows through the applied sorting (if any)\n        rows = model.mapToSourceRows(rows)\n        rows = rows.tolist()\n        return rows, cols\n\n    @staticmethod\n    def _get_model(view):\n        model = view.model()\n        while isinstance(model, QAbstractProxyModel):\n            model = model.sourceModel()\n        return model\n\n    def commit(self):\n        \"\"\"\n        Commit/send the current selected row/column selection.\n        \"\"\"\n        selected_data = table = rowsel = None\n        view = self.tabs.currentWidget()\n        if view and view.model() is not None:\n            model = self._get_model(view)\n            table = model.source  # The input data table\n\n            # Selections of individual instances are not implemented\n            # for SqlTables\n            if isinstance(table, SqlTable):\n                self._set_output_summary(selected_data)\n                self.Outputs.selected_data.send(selected_data)\n                self.Outputs.annotated_data.send(None)\n                return\n\n            rowsel, colsel = self.get_selection(view)\n            self.selected_rows, self.selected_cols = rowsel, colsel\n\n            domain = table.domain\n\n            if len(colsel) < len(domain) + len(domain.metas):\n                # only a subset of the columns is selected\n                allvars = domain.class_vars + domain.metas + domain.attributes\n                columns = [(c, model.headerData(c, Qt.Horizontal,\n                                                TableModel.DomainRole))\n                           for c in colsel]\n                assert all(role is not None for _, role in columns)\n\n                def select_vars(role):\n                    \"\"\"select variables for role (TableModel.DomainRole)\"\"\"\n                    return [allvars[c] for c, r in columns if r == role]\n\n                attrs = select_vars(TableModel.Attribute)\n                if attrs and issparse(table.X):\n                    # for sparse data you can only select all attributes\n                    attrs = table.domain.attributes\n                class_vars = select_vars(TableModel.ClassVar)\n                metas = select_vars(TableModel.Meta)\n                domain = Orange.data.Domain(attrs, class_vars, metas)\n\n            # Avoid a copy if none rows are selected.\n            if not rowsel:\n                selected_data = None\n            else:\n                selected_data = table.from_table(domain, table, rowsel)\n\n        self._set_output_summary(selected_data)\n        self.Outputs.selected_data.send(selected_data)\n        self.Outputs.annotated_data.send(create_annotated_table(table, rowsel))\n\n    def copy(self):\n        \"\"\"\n        Copy current table selection to the clipboard.\n        \"\"\"\n        view = self.tabs.currentWidget()\n        if view is not None:\n            mime = table_selection_to_mime_data(view)\n            QApplication.clipboard().setMimeData(\n                mime, QClipboard.Clipboard\n            )\n\n    def send_report(self):\n        view = self.tabs.currentWidget()\n        if not view or not view.model():\n            return\n        model = self._get_model(view)\n        self.report_data_brief(model.source)\n        self.report_table(view)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 173,
                                "end_lineno": 769,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/data/owtable.py",
                            "type": "class",
                            "name": "OWDataTable",
                            "content": "class OWDataTable(OWWidget):\n    name = \"Data Table\"\n    description = \"View the dataset in a spreadsheet.\"\n    icon = \"icons/Table.svg\"\n    priority = 50\n    keywords = []\n\n    buttons_area_orientation = Qt.Vertical\n\n    class Inputs:\n        data = Input(\"Data\", Table, multiple=True)\n\n    class Outputs:\n        selected_data = Output(\"Selected Data\", Table, default=True)\n        annotated_data = Output(ANNOTATED_DATA_SIGNAL_NAME, Table)\n\n    show_distributions = Setting(False)\n    dist_color_RGB = Setting((220, 220, 220, 255))\n    show_attribute_labels = Setting(True)\n    select_rows = Setting(True)\n    auto_commit = Setting(True)\n\n    color_by_class = Setting(True)\n    selected_rows = Setting([], schema_only=True)\n    selected_cols = Setting([], schema_only=True)\n\n    def __init__(self):\n        super().__init__()\n\n        self._inputs = OrderedDict()\n\n        self.__pending_selected_rows = self.selected_rows\n        self.selected_rows = None\n        self.__pending_selected_cols = self.selected_cols\n        self.selected_cols = None\n\n        self.dist_color = QColor(*self.dist_color_RGB)\n\n        info_box = gui.vBox(self.controlArea, \"Info\")\n        self.info_text = gui.widgetLabel(info_box)\n        self._set_input_summary(None)\n        self._set_output_summary(None)\n        gui.separator(self.controlArea)\n\n        box = gui.vBox(self.controlArea, \"Variables\")\n        self.c_show_attribute_labels = gui.checkBox(\n            box, self, \"show_attribute_labels\",\n            \"Show variable labels (if present)\",\n            callback=self._on_show_variable_labels_changed)\n\n        gui.checkBox(box, self, \"show_distributions\",\n                     'Visualize numeric values',\n                     callback=self._on_distribution_color_changed)\n        gui.checkBox(box, self, \"color_by_class\", 'Color by instance classes',\n                     callback=self._on_distribution_color_changed)\n\n        box = gui.vBox(self.controlArea, \"Selection\")\n\n        gui.checkBox(box, self, \"select_rows\", \"Select full rows\",\n                     callback=self._on_select_rows_changed)\n\n        gui.rubber(self.controlArea)\n\n        reset = gui.button(\n            None, self, \"Restore Original Order\", callback=self.restore_order,\n            tooltip=\"Show rows in the original order\", autoDefault=False)\n        self.buttonsArea.layout().insertWidget(0, reset)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n        # GUI with tabs\n        self.tabs = gui.tabWidget(self.mainArea)\n        self.tabs.currentChanged.connect(self._on_current_tab_changed)\n\n    def copy_to_clipboard(self):\n        self.copy()\n\n    @staticmethod\n    def sizeHint():\n        return QSize(800, 500)\n\n    @Inputs.data\n    def set_dataset(self, data, tid=None):\n        \"\"\"Set the input dataset.\"\"\"\n        if data is not None:\n            datasetname = getattr(data, \"name\", \"Data\")\n            if tid in self._inputs:\n                # update existing input slot\n                slot = self._inputs[tid]\n                view = slot.view\n                # reset the (header) view state.\n                view.setModel(None)\n                view.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)\n                assert self.tabs.indexOf(view) != -1\n                self.tabs.setTabText(self.tabs.indexOf(view), datasetname)\n            else:\n                view = DataTableView()\n                view.setSortingEnabled(True)\n\n                if self.select_rows:\n                    view.setSelectionBehavior(QTableView.SelectRows)\n\n                header = view.horizontalHeader()\n                header.setSectionsMovable(True)\n                header.setSectionsClickable(True)\n                header.setSortIndicatorShown(True)\n                header.setSortIndicator(-1, Qt.AscendingOrder)\n\n                # QHeaderView does not 'reset' the model sort column,\n                # because there is no guaranty (requirement) that the\n                # models understand the -1 sort column.\n                def sort_reset(index, order):\n                    if view.model() is not None and index == -1:\n                        view.model().sort(index, order)\n\n                header.sortIndicatorChanged.connect(sort_reset)\n                self.tabs.addTab(view, datasetname)\n\n            view.dataset = data\n            self.tabs.setCurrentWidget(view)\n\n            self._setup_table_view(view, data)\n            slot = TableSlot(tid, data, table_summary(data), view)\n            view.input_slot = slot\n            self._inputs[tid] = slot\n\n            self.tabs.setCurrentIndex(self.tabs.indexOf(view))\n\n            self._set_input_summary(slot)\n\n            if isinstance(slot.summary.len, concurrent.futures.Future):\n                def update(_):\n                    QMetaObject.invokeMethod(\n                        self, \"_update_info\", Qt.QueuedConnection)\n\n                slot.summary.len.add_done_callback(update)\n\n        elif tid in self._inputs:\n            slot = self._inputs.pop(tid)\n            view = slot.view\n            view.hide()\n            view.deleteLater()\n            self.tabs.removeTab(self.tabs.indexOf(view))\n\n            current = self.tabs.currentWidget()\n            if current is not None:\n                self._set_input_summary(current.input_slot)\n        else:\n            self._set_input_summary(None)\n\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n\n        if data and self.__pending_selected_rows is not None:\n            self.selected_rows = self.__pending_selected_rows\n            self.__pending_selected_rows = None\n        else:\n            self.selected_rows = []\n\n        if data and self.__pending_selected_cols is not None:\n            self.selected_cols = self.__pending_selected_cols\n            self.__pending_selected_cols = None\n        else:\n            self.selected_cols = []\n\n        self.set_selection()\n        self.unconditional_commit()\n\n    def _setup_table_view(self, view, data):\n        \"\"\"Setup the `view` (QTableView) with `data` (Orange.data.Table)\n        \"\"\"\n        if data is None:\n            view.setModel(None)\n            return\n\n        datamodel = RichTableModel(data)\n\n        rowcount = data.approx_len()\n\n        if self.color_by_class and data.domain.has_discrete_class:\n            color_schema = [\n                QColor(*c) for c in data.domain.class_var.colors]\n        else:\n            color_schema = None\n        if self.show_distributions:\n            view.setItemDelegate(\n                gui.TableBarItem(\n                    self, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(QStyledItemDelegate(self))\n\n        # Enable/disable view sorting based on data's type\n        view.setSortingEnabled(is_sortable(data))\n        header = view.horizontalHeader()\n        header.setSectionsClickable(is_sortable(data))\n        header.setSortIndicatorShown(is_sortable(data))\n        header.sortIndicatorChanged.connect(self.update_selection)\n\n        view.setModel(datamodel)\n\n        vheader = view.verticalHeader()\n        option = view.viewOptions()\n        size = view.style().sizeFromContents(\n            QStyle.CT_ItemViewItem, option,\n            QSize(20, 20), view)\n\n        vheader.setDefaultSectionSize(size.height() + 2)\n        vheader.setMinimumSectionSize(5)\n        vheader.setSectionResizeMode(QHeaderView.Fixed)\n\n        # Limit the number of rows displayed in the QTableView\n        # (workaround for QTBUG-18490 / QTBUG-28631)\n        maxrows = (2 ** 31 - 1) // (vheader.defaultSectionSize() + 2)\n        if rowcount > maxrows:\n            sliceproxy = TableSliceProxy(\n                parent=view, rowSlice=slice(0, maxrows))\n            sliceproxy.setSourceModel(datamodel)\n            # First reset the view (without this the header view retains\n            # it's state - at this point invalid/broken)\n            view.setModel(None)\n            view.setModel(sliceproxy)\n\n        assert view.model().rowCount() <= maxrows\n        assert vheader.sectionSize(0) > 1 or datamodel.rowCount() == 0\n\n        # update the header (attribute names)\n        self._update_variable_labels(view)\n\n        selmodel = BlockSelectionModel(\n            view.model(), parent=view, selectBlocks=not self.select_rows)\n        view.setSelectionModel(selmodel)\n        view.selectionFinished.connect(self.update_selection)\n\n    #noinspection PyBroadException\n    def set_corner_text(self, table, text):\n        \"\"\"Set table corner text.\"\"\"\n        # As this is an ugly hack, do everything in\n        # try - except blocks, as it may stop working in newer Qt.\n        # pylint: disable=broad-except\n        if not hasattr(table, \"btn\") and not hasattr(table, \"btnfailed\"):\n            try:\n                btn = table.findChild(QAbstractButton)\n\n                class Efc(QObject):\n                    @staticmethod\n                    def eventFilter(o, e):\n                        if (isinstance(o, QAbstractButton) and\n                                e.type() == QEvent.Paint):\n                            # paint by hand (borrowed from QTableCornerButton)\n                            btn = o\n                            opt = QStyleOptionHeader()\n                            opt.initFrom(btn)\n                            state = QStyle.State_None\n                            if btn.isEnabled():\n                                state |= QStyle.State_Enabled\n                            if btn.isActiveWindow():\n                                state |= QStyle.State_Active\n                            if btn.isDown():\n                                state |= QStyle.State_Sunken\n                            opt.state = state\n                            opt.rect = btn.rect()\n                            opt.text = btn.text()\n                            opt.position = QStyleOptionHeader.OnlyOneSection\n                            painter = QStylePainter(btn)\n                            painter.drawControl(QStyle.CE_Header, opt)\n                            return True     # eat event\n                        return False\n                table.efc = Efc()\n                # disconnect default handler for clicks and connect a new one, which supports\n                # both selection and deselection of all data\n                btn.clicked.disconnect()\n                btn.installEventFilter(table.efc)\n                btn.clicked.connect(self._on_select_all)\n                table.btn = btn\n\n                if sys.platform == \"darwin\":\n                    btn.setAttribute(Qt.WA_MacSmallSize)\n\n            except Exception:\n                table.btnfailed = True\n\n        if hasattr(table, \"btn\"):\n            try:\n                btn = table.btn\n                btn.setText(text)\n                opt = QStyleOptionHeader()\n                opt.text = btn.text()\n                s = btn.style().sizeFromContents(\n                    QStyle.CT_HeaderSection,\n                    opt, QSize(),\n                    btn).expandedTo(QApplication.globalStrut())\n                if s.isValid():\n                    table.verticalHeader().setMinimumWidth(s.width())\n            except Exception:\n                pass\n\n    def _set_input_summary(self, slot):\n        def format_summary(summary):\n            if isinstance(summary, ApproxSummary):\n                length = summary.len.result() if summary.len.done() else \\\n                    summary.approx_len\n            elif isinstance(summary, Summary):\n                length = summary.len\n            return length\n\n        summary, details = self.info.NoInput, \"\"\n        if slot:\n            summary = format_summary(slot.summary)\n            details = format_summary_details(slot.table)\n        self.info.set_input_summary(summary, details)\n\n        self.info_text.setText(\"\\n\".join(self._info_box_text(slot)))\n\n    @staticmethod\n    def _info_box_text(slot):\n        def format_part(part):\n            if isinstance(part, DenseArray):\n                if not part.nans:\n                    return \"\"\n                perc = 100 * part.nans / (part.nans + part.non_nans)\n                return f\" ({perc:.1f} % missing data)\"\n\n            if isinstance(part, SparseArray):\n                tag = \"sparse\"\n            elif isinstance(part, SparseBoolArray):\n                tag = \"tags\"\n            else:  # isinstance(part, NotAvailable)\n                return \"\"\n            dens = 100 * part.non_nans / (part.nans + part.non_nans)\n            return f\" ({tag}, density {dens:.2f} %)\"\n\n        def desc(n, part):\n            if n == 0:\n                return f\"No {part}s\"\n            elif n == 1:\n                return f\"1 {part}\"\n            else:\n                return f\"{n} {part}s\"\n\n        if slot is None:\n            return [\"No data.\"]\n        summary = slot.summary\n        text = []\n        if isinstance(summary, ApproxSummary):\n            if summary.len.done():\n                text.append(f\"{summary.len.result()} instances\")\n            else:\n                text.append(f\"~{summary.approx_len} instances\")\n        elif isinstance(summary, Summary):\n            text.append(f\"{summary.len} instances\")\n            if sum(p.nans for p in [summary.X, summary.Y, summary.M]) == 0:\n                text[-1] += \" (no missing data)\"\n\n        text.append(desc(len(summary.domain.attributes), \"feature\")\n                    + format_part(summary.X))\n\n        if not summary.domain.class_vars:\n            text.append(\"No target variable.\")\n        else:\n            if len(summary.domain.class_vars) > 1:\n                c_text = desc(len(summary.domain.class_vars), \"outcome\")\n            elif summary.domain.has_continuous_class:\n                c_text = \"Numeric outcome\"\n            else:\n                c_text = \"Target with \" \\\n                    + desc(len(summary.domain.class_var.values), \"value\")\n            text.append(c_text + format_part(summary.Y))\n\n        text.append(desc(len(summary.domain.metas), \"meta attribute\")\n                    + format_part(summary.M))\n        return text\n\n    def _set_output_summary(self, output):\n        summary = len(output) if output else self.info.NoOutput\n        details = format_summary_details(output) if output else \"\"\n        self.info.set_output_summary(summary, details)\n\n    def _on_select_all(self, _):\n        data_info = self.tabs.currentWidget().input_slot.summary\n        if len(self.selected_rows) == data_info.len \\\n                and len(self.selected_cols) == len(data_info.domain):\n            self.tabs.currentWidget().clearSelection()\n        else:\n            self.tabs.currentWidget().selectAll()\n\n    def _on_current_tab_changed(self, index):\n        \"\"\"Update the status bar on current tab change\"\"\"\n        view = self.tabs.widget(index)\n        if view is not None and view.model() is not None:\n            self._set_input_summary(view.input_slot)\n            self.update_selection()\n        else:\n            self._set_input_summary(None)\n\n    def _update_variable_labels(self, view):\n        \"Update the variable labels visibility for `view`\"\n        model = view.model()\n        if isinstance(model, TableSliceProxy):\n            model = model.sourceModel()\n\n        if self.show_attribute_labels:\n            model.setRichHeaderFlags(\n                RichTableModel.Labels | RichTableModel.Name)\n\n            labelnames = set()\n            domain = model.source.domain\n            for a in itertools.chain(domain.metas, domain.variables):\n                labelnames.update(a.attributes.keys())\n            labelnames = sorted(\n                [label for label in labelnames if not label.startswith(\"_\")])\n            self.set_corner_text(view, \"\\n\".join([\"\"] + labelnames))\n        else:\n            model.setRichHeaderFlags(RichTableModel.Name)\n            self.set_corner_text(view, \"\")\n\n    def _on_show_variable_labels_changed(self):\n        \"\"\"The variable labels (var.attribues) visibility was changed.\"\"\"\n        for slot in self._inputs.values():\n            self._update_variable_labels(slot.view)\n\n    def _on_distribution_color_changed(self):\n        for ti in range(self.tabs.count()):\n            widget = self.tabs.widget(ti)\n            model = widget.model()\n            while isinstance(model, QAbstractProxyModel):\n                model = model.sourceModel()\n            data = model.source\n            class_var = data.domain.class_var\n            if self.color_by_class and class_var and class_var.is_discrete:\n                color_schema = [QColor(*c) for c in class_var.colors]\n            else:\n                color_schema = None\n            if self.show_distributions:\n                delegate = gui.TableBarItem(self, color=self.dist_color,\n                                            color_schema=color_schema)\n            else:\n                delegate = QStyledItemDelegate(self)\n            widget.setItemDelegate(delegate)\n        tab = self.tabs.currentWidget()\n        if tab:\n            tab.reset()\n\n    def _on_select_rows_changed(self):\n        for slot in self._inputs.values():\n            selection_model = slot.view.selectionModel()\n            selection_model.setSelectBlocks(not self.select_rows)\n            if self.select_rows:\n                slot.view.setSelectionBehavior(QTableView.SelectRows)\n                # Expand the current selection to full row selection.\n                selection_model.select(\n                    selection_model.selection(),\n                    QItemSelectionModel.Select | QItemSelectionModel.Rows\n                )\n            else:\n                slot.view.setSelectionBehavior(QTableView.SelectItems)\n\n    def restore_order(self):\n        \"\"\"Restore the original data order of the current view.\"\"\"\n        table = self.tabs.currentWidget()\n        if table is not None:\n            table.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)\n\n    @Slot()\n    def _update_info(self):\n        current = self.tabs.currentWidget()\n        if current is not None and current.model() is not None:\n            self._set_input_summary(current.input_slot)\n\n    def update_selection(self, *_):\n        self.commit()\n\n    def set_selection(self):\n        if self.selected_rows and self.selected_cols:\n            view = self.tabs.currentWidget()\n            model = view.model()\n            if model.rowCount() <= self.selected_rows[-1] or \\\n                    model.columnCount() <= self.selected_cols[-1]:\n                return\n\n            selection = QItemSelection()\n            rowranges = list(ranges(self.selected_rows))\n            colranges = list(ranges(self.selected_cols))\n\n            for rowstart, rowend in rowranges:\n                for colstart, colend in colranges:\n                    selection.append(\n                        QItemSelectionRange(\n                            view.model().index(rowstart, colstart),\n                            view.model().index(rowend - 1, colend - 1)\n                        )\n                    )\n            view.selectionModel().select(\n                selection, QItemSelectionModel.ClearAndSelect)\n\n    @staticmethod\n    def get_selection(view):\n        \"\"\"\n        Return the selected row and column indices of the selection in view.\n        \"\"\"\n        selmodel = view.selectionModel()\n\n        selection = selmodel.selection()\n        model = view.model()\n        # map through the proxies into input table.\n        while isinstance(model, QAbstractProxyModel):\n            selection = model.mapSelectionToSource(selection)\n            model = model.sourceModel()\n\n        assert isinstance(selmodel, BlockSelectionModel)\n        assert isinstance(model, TableModel)\n\n        row_spans, col_spans = selection_blocks(selection)\n        rows = list(itertools.chain.from_iterable(itertools.starmap(range, row_spans)))\n        cols = list(itertools.chain.from_iterable(itertools.starmap(range, col_spans)))\n        rows = numpy.array(rows, dtype=numpy.intp)\n        # map the rows through the applied sorting (if any)\n        rows = model.mapToSourceRows(rows)\n        rows = rows.tolist()\n        return rows, cols\n\n    @staticmethod\n    def _get_model(view):\n        model = view.model()\n        while isinstance(model, QAbstractProxyModel):\n            model = model.sourceModel()\n        return model\n\n    def commit(self):\n        \"\"\"\n        Commit/send the current selected row/column selection.\n        \"\"\"\n        selected_data = table = rowsel = None\n        view = self.tabs.currentWidget()\n        if view and view.model() is not None:\n            model = self._get_model(view)\n            table = model.source  # The input data table\n\n            # Selections of individual instances are not implemented\n            # for SqlTables\n            if isinstance(table, SqlTable):\n                self._set_output_summary(selected_data)\n                self.Outputs.selected_data.send(selected_data)\n                self.Outputs.annotated_data.send(None)\n                return\n\n            rowsel, colsel = self.get_selection(view)\n            self.selected_rows, self.selected_cols = rowsel, colsel\n\n            domain = table.domain\n\n            if len(colsel) < len(domain) + len(domain.metas):\n                # only a subset of the columns is selected\n                allvars = domain.class_vars + domain.metas + domain.attributes\n                columns = [(c, model.headerData(c, Qt.Horizontal,\n                                                TableModel.DomainRole))\n                           for c in colsel]\n                assert all(role is not None for _, role in columns)\n\n                def select_vars(role):\n                    \"\"\"select variables for role (TableModel.DomainRole)\"\"\"\n                    return [allvars[c] for c, r in columns if r == role]\n\n                attrs = select_vars(TableModel.Attribute)\n                if attrs and issparse(table.X):\n                    # for sparse data you can only select all attributes\n                    attrs = table.domain.attributes\n                class_vars = select_vars(TableModel.ClassVar)\n                metas = select_vars(TableModel.Meta)\n                domain = Orange.data.Domain(attrs, class_vars, metas)\n\n            # Avoid a copy if none rows are selected.\n            if not rowsel:\n                selected_data = None\n            else:\n                selected_data = table.from_table(domain, table, rowsel)\n\n        self._set_output_summary(selected_data)\n        self.Outputs.selected_data.send(selected_data)\n        self.Outputs.annotated_data.send(create_annotated_table(table, rowsel))\n\n    def copy(self):\n        \"\"\"\n        Copy current table selection to the clipboard.\n        \"\"\"\n        view = self.tabs.currentWidget()\n        if view is not None:\n            mime = table_selection_to_mime_data(view)\n            QApplication.clipboard().setMimeData(\n                mime, QClipboard.Clipboard\n            )\n\n    def send_report(self):\n        view = self.tabs.currentWidget()\n        if not view or not view.model():\n            return\n        model = self._get_model(view)\n        self.report_data_brief(model.source)\n        self.report_table(view)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 173,
                            "end_lineno": 769,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "# pylint: disable=protected-access\nimport unittest\n\n\nfrom unittest.mock import Mock, patch\nfrom AnyQt.QtCore import Qt\n\nfrom orangewidget.widget import StateInfo\n\nfrom Orange.widgets.data.owtable import OWDataTable\nfrom Orange.widgets.tests.base import WidgetTest, WidgetOutputsTestMixin\nfrom Orange.data import Table, Domain\nfrom Orange.widgets.utils.state_summary import format_summary_details\nfrom Orange.data.sql.table import SqlTable\nfrom Orange.tests.sql.base import DataBaseTest as dbt\n\n\nclass TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data  # pylint: disable=no-member\n\n    def setUp(self):\n        self.widget = self.create_widget(OWDataTable)\n\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        conn, self.iris = self.create_iris_sql_table()\n        self.table = SqlTable(conn, self.iris)\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    def test_input_data(self):\n        \"\"\"Check number of tabs with data on the input\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n        self.send_signal(self.widget.Inputs.data, self.data, 2)\n        self.assertEqual(self.widget.tabs.count(), 2)\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n\n    def test_data_model(self):\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.widget(0).model().rowCount(),\n                         len(self.data))\n\n    def test_reset_select(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._select_data()\n        self.send_signal(self.widget.Inputs.data, Table('heart_disease'))\n        self.assertListEqual([], self.widget.selected_cols)\n        self.assertListEqual([], self.widget.selected_rows)\n\n    def _select_data(self):\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain), 10))\n        self.widget.set_selection()\n        return self.widget.selected_rows\n\n    def test_attrs_appear_in_corner_text(self):\n        iris = Table(\"iris\")\n        domain = iris.domain\n        new_domain = Domain(\n            domain.attributes[1:], iris.domain.class_var, domain.attributes[:1])\n        new_domain.metas[0].attributes = {\"c\": \"foo\"}\n        new_domain.attributes[0].attributes = {\"a\": \"bar\", \"c\": \"baz\"}\n        new_domain.class_var.attributes = {\"b\": \"foo\"}\n        self.widget.set_corner_text = Mock()\n        self.send_signal(self.widget.Inputs.data, iris.transform(new_domain))\n        # false positive, pylint: disable=unsubscriptable-object\n        self.assertEqual(\n            self.widget.set_corner_text.call_args[0][1], \"\\na\\nb\\nc\")\n\n    def test_unconditional_commit_on_new_signal(self):\n        with patch.object(self.widget, 'unconditional_commit') as commit:\n            self.widget.auto_commit = False\n            commit.reset_mock()\n            self.send_signal(self.widget.Inputs.data, self.data)\n            commit.assert_called()\n\n    def test_pending_selection(self):\n        widget = self.create_widget(OWDataTable, stored_settings=dict(\n            selected_rows=[5, 6, 7, 8, 9],\n            selected_cols=list(range(len(self.data.domain)))))\n        self.send_signal(widget.Inputs.data, None, 1)\n        self.send_signal(widget.Inputs.data, self.data, 1)\n        output = self.get_output(widget.Outputs.selected_data)\n        self.assertEqual(5, len(output))\n\n    def test_sorting(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.selected_rows = [0, 1, 2, 3, 4]\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.set_selection()\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_original = output.tolist()\n\n        self.widget.tabs.currentWidget().sortByColumn(1, Qt.AscendingOrder)\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_sorted = output.tolist()\n        \n        # the two outputs should not be the same.\n        self.assertTrue(output_original != output_sorted)\n\n        # check if output after sorting is actually sorted.\n        self.assertTrue(sorted(output_original) == output_sorted)\n        self.assertTrue(sorted(output_sorted) == output_sorted)\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self.widget.tabs.currentWidget().selectAll()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        data = Table(\"iris\")\n        self.send_signal(self.widget.Inputs.data, data, 2)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self._select_data()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self.widget.tabs.setCurrentWidget(self.widget._inputs[1].view)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 2)\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_info(self):\n        info_text = self.widget.info_text\n        no_input = \"No data.\"\n        self.assertEqual(info_text.text(), no_input)\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "new_file_content": "# pylint: disable=protected-access\nimport unittest\n\n\nfrom unittest.mock import Mock, patch\nfrom AnyQt.QtCore import Qt\n\nfrom orangewidget.widget import StateInfo\n\nfrom Orange.widgets.data.owtable import OWDataTable\nfrom Orange.widgets.tests.base import WidgetTest, WidgetOutputsTestMixin\nfrom Orange.data import Table, Domain\nfrom Orange.widgets.utils.state_summary import format_summary_details\nfrom Orange.data.sql.table import SqlTable\nfrom Orange.tests.sql.base import DataBaseTest as dbt\n\n\nclass TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls,\n                                    output_all_on_no_selection=True)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data  # pylint: disable=no-member\n\n    def setUp(self):\n        self.widget = self.create_widget(OWDataTable)\n\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        conn, self.iris = self.create_iris_sql_table()\n        self.table = SqlTable(conn, self.iris)\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    def test_input_data(self):\n        \"\"\"Check number of tabs with data on the input\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n        self.send_signal(self.widget.Inputs.data, self.data, 2)\n        self.assertEqual(self.widget.tabs.count(), 2)\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n\n    def test_data_model(self):\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.widget(0).model().rowCount(),\n                         len(self.data))\n\n    def test_reset_select(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._select_data()\n        self.send_signal(self.widget.Inputs.data, Table('heart_disease'))\n        self.assertListEqual([], self.widget.selected_cols)\n        self.assertListEqual([], self.widget.selected_rows)\n\n    def _select_data(self):\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain), 10))\n        self.widget.set_selection()\n        return self.widget.selected_rows\n\n    def test_attrs_appear_in_corner_text(self):\n        iris = Table(\"iris\")\n        domain = iris.domain\n        new_domain = Domain(\n            domain.attributes[1:], iris.domain.class_var, domain.attributes[:1])\n        new_domain.metas[0].attributes = {\"c\": \"foo\"}\n        new_domain.attributes[0].attributes = {\"a\": \"bar\", \"c\": \"baz\"}\n        new_domain.class_var.attributes = {\"b\": \"foo\"}\n        self.widget.set_corner_text = Mock()\n        self.send_signal(self.widget.Inputs.data, iris.transform(new_domain))\n        # false positive, pylint: disable=unsubscriptable-object\n        self.assertEqual(\n            self.widget.set_corner_text.call_args[0][1], \"\\na\\nb\\nc\")\n\n    def test_unconditional_commit_on_new_signal(self):\n        with patch.object(self.widget, 'unconditional_commit') as commit:\n            self.widget.auto_commit = False\n            commit.reset_mock()\n            self.send_signal(self.widget.Inputs.data, self.data)\n            commit.assert_called()\n\n    def test_pending_selection(self):\n        widget = self.create_widget(OWDataTable, stored_settings=dict(\n            selected_rows=[5, 6, 7, 8, 9],\n            selected_cols=list(range(len(self.data.domain)))))\n        self.send_signal(widget.Inputs.data, None, 1)\n        self.send_signal(widget.Inputs.data, self.data, 1)\n        output = self.get_output(widget.Outputs.selected_data)\n        self.assertEqual(5, len(output))\n\n    def test_sorting(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.selected_rows = [0, 1, 2, 3, 4]\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.set_selection()\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_original = output.tolist()\n\n        self.widget.tabs.currentWidget().sortByColumn(1, Qt.AscendingOrder)\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_sorted = output.tolist()\n        \n        # the two outputs should not be the same.\n        self.assertTrue(output_original != output_sorted)\n\n        # check if output after sorting is actually sorted.\n        self.assertTrue(sorted(output_original) == output_sorted)\n        self.assertTrue(sorted(output_sorted) == output_sorted)\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self.widget.tabs.currentWidget().selectAll()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        data = Table(\"iris\")\n        self.send_signal(self.widget.Inputs.data, data, 2)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self._select_data()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self.widget.tabs.setCurrentWidget(self.widget._inputs[1].view)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 2)\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_info(self):\n        info_text = self.widget.info_text\n        no_input = \"No data.\"\n        self.assertEqual(info_text.text(), no_input)\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/data/tests/test_owtable.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "febbf9b6e",
                "new_commit_hash": "e4018c159",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/data/tests/test_owtable.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/data/tests/test_owtable.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 19,
                            "length": 7
                        },
                        "new_range": {
                            "start": 19,
                            "length": 8
                        },
                        "section": "class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "    @classmethod",
                                "type": "context"
                            },
                            {
                                "content": "    def setUpClass(cls):",
                                "type": "context"
                            },
                            {
                                "content": "        super().setUpClass()",
                                "type": "context"
                            },
                            {
                                "content": "        WidgetOutputsTestMixin.init(cls)",
                                "type": "deleted"
                            },
                            {
                                "content": "        WidgetOutputsTestMixin.init(cls,",
                                "type": "added"
                            },
                            {
                                "content": "                                    output_all_on_no_selection=True)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        cls.signal_name = \"Data\"",
                                "type": "context"
                            },
                            {
                                "content": "        cls.signal_data = cls.data  # pylint: disable=no-member",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owtable.py",
                            "type": "method",
                            "name": "TestOWDataTable.setUpClass",
                            "content": "class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data  # pylint: disable=no-member\n\n    def setUp(self):\n        self.widget = self.create_widget(OWDataTable)\n\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        conn, self.iris = self.create_iris_sql_table()\n        self.table = SqlTable(conn, self.iris)\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    def test_input_data(self):\n        \"\"\"Check number of tabs with data on the input\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n        self.send_signal(self.widget.Inputs.data, self.data, 2)\n        self.assertEqual(self.widget.tabs.count(), 2)\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n\n    def test_data_model(self):\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.widget(0).model().rowCount(),\n                         len(self.data))\n\n    def test_reset_select(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._select_data()\n        self.send_signal(self.widget.Inputs.data, Table('heart_disease'))\n        self.assertListEqual([], self.widget.selected_cols)\n        self.assertListEqual([], self.widget.selected_rows)\n\n    def _select_data(self):\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain), 10))\n        self.widget.set_selection()\n        return self.widget.selected_rows\n\n    def test_attrs_appear_in_corner_text(self):\n        iris = Table(\"iris\")\n        domain = iris.domain\n        new_domain = Domain(\n            domain.attributes[1:], iris.domain.class_var, domain.attributes[:1])\n        new_domain.metas[0].attributes = {\"c\": \"foo\"}\n        new_domain.attributes[0].attributes = {\"a\": \"bar\", \"c\": \"baz\"}\n        new_domain.class_var.attributes = {\"b\": \"foo\"}\n        self.widget.set_corner_text = Mock()\n        self.send_signal(self.widget.Inputs.data, iris.transform(new_domain))\n        # false positive, pylint: disable=unsubscriptable-object\n        self.assertEqual(\n            self.widget.set_corner_text.call_args[0][1], \"\\na\\nb\\nc\")\n\n    def test_unconditional_commit_on_new_signal(self):\n        with patch.object(self.widget, 'unconditional_commit') as commit:\n            self.widget.auto_commit = False\n            commit.reset_mock()\n            self.send_signal(self.widget.Inputs.data, self.data)\n            commit.assert_called()\n\n    def test_pending_selection(self):\n        widget = self.create_widget(OWDataTable, stored_settings=dict(\n            selected_rows=[5, 6, 7, 8, 9],\n            selected_cols=list(range(len(self.data.domain)))))\n        self.send_signal(widget.Inputs.data, None, 1)\n        self.send_signal(widget.Inputs.data, self.data, 1)\n        output = self.get_output(widget.Outputs.selected_data)\n        self.assertEqual(5, len(output))\n\n    def test_sorting(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.selected_rows = [0, 1, 2, 3, 4]\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.set_selection()\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_original = output.tolist()\n\n        self.widget.tabs.currentWidget().sortByColumn(1, Qt.AscendingOrder)\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_sorted = output.tolist()\n        \n        # the two outputs should not be the same.\n        self.assertTrue(output_original != output_sorted)\n\n        # check if output after sorting is actually sorted.\n        self.assertTrue(sorted(output_original) == output_sorted)\n        self.assertTrue(sorted(output_sorted) == output_sorted)\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self.widget.tabs.currentWidget().selectAll()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        data = Table(\"iris\")\n        self.send_signal(self.widget.Inputs.data, data, 2)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self._select_data()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self.widget.tabs.setCurrentWidget(self.widget._inputs[1].view)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 2)\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_info(self):\n        info_text = self.widget.info_text\n        no_input = \"No data.\"\n        self.assertEqual(info_text.text(), no_input)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 20,
                            "end_lineno": 25,
                            "parent": {
                                "file_name": "Orange/widgets/data/tests/test_owtable.py",
                                "type": "class",
                                "name": "TestOWDataTable",
                                "content": "class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data  # pylint: disable=no-member\n\n    def setUp(self):\n        self.widget = self.create_widget(OWDataTable)\n\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        conn, self.iris = self.create_iris_sql_table()\n        self.table = SqlTable(conn, self.iris)\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    def test_input_data(self):\n        \"\"\"Check number of tabs with data on the input\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n        self.send_signal(self.widget.Inputs.data, self.data, 2)\n        self.assertEqual(self.widget.tabs.count(), 2)\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n\n    def test_data_model(self):\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.widget(0).model().rowCount(),\n                         len(self.data))\n\n    def test_reset_select(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._select_data()\n        self.send_signal(self.widget.Inputs.data, Table('heart_disease'))\n        self.assertListEqual([], self.widget.selected_cols)\n        self.assertListEqual([], self.widget.selected_rows)\n\n    def _select_data(self):\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain), 10))\n        self.widget.set_selection()\n        return self.widget.selected_rows\n\n    def test_attrs_appear_in_corner_text(self):\n        iris = Table(\"iris\")\n        domain = iris.domain\n        new_domain = Domain(\n            domain.attributes[1:], iris.domain.class_var, domain.attributes[:1])\n        new_domain.metas[0].attributes = {\"c\": \"foo\"}\n        new_domain.attributes[0].attributes = {\"a\": \"bar\", \"c\": \"baz\"}\n        new_domain.class_var.attributes = {\"b\": \"foo\"}\n        self.widget.set_corner_text = Mock()\n        self.send_signal(self.widget.Inputs.data, iris.transform(new_domain))\n        # false positive, pylint: disable=unsubscriptable-object\n        self.assertEqual(\n            self.widget.set_corner_text.call_args[0][1], \"\\na\\nb\\nc\")\n\n    def test_unconditional_commit_on_new_signal(self):\n        with patch.object(self.widget, 'unconditional_commit') as commit:\n            self.widget.auto_commit = False\n            commit.reset_mock()\n            self.send_signal(self.widget.Inputs.data, self.data)\n            commit.assert_called()\n\n    def test_pending_selection(self):\n        widget = self.create_widget(OWDataTable, stored_settings=dict(\n            selected_rows=[5, 6, 7, 8, 9],\n            selected_cols=list(range(len(self.data.domain)))))\n        self.send_signal(widget.Inputs.data, None, 1)\n        self.send_signal(widget.Inputs.data, self.data, 1)\n        output = self.get_output(widget.Outputs.selected_data)\n        self.assertEqual(5, len(output))\n\n    def test_sorting(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.selected_rows = [0, 1, 2, 3, 4]\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.set_selection()\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_original = output.tolist()\n\n        self.widget.tabs.currentWidget().sortByColumn(1, Qt.AscendingOrder)\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_sorted = output.tolist()\n        \n        # the two outputs should not be the same.\n        self.assertTrue(output_original != output_sorted)\n\n        # check if output after sorting is actually sorted.\n        self.assertTrue(sorted(output_original) == output_sorted)\n        self.assertTrue(sorted(output_sorted) == output_sorted)\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self.widget.tabs.currentWidget().selectAll()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        data = Table(\"iris\")\n        self.send_signal(self.widget.Inputs.data, data, 2)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self._select_data()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self.widget.tabs.setCurrentWidget(self.widget._inputs[1].view)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 2)\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_info(self):\n        info_text = self.widget.info_text\n        no_input = \"No data.\"\n        self.assertEqual(info_text.text(), no_input)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 18,
                                "end_lineno": 177,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/data/tests/test_owtable.py",
                            "type": "class",
                            "name": "TestOWDataTable",
                            "content": "class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data  # pylint: disable=no-member\n\n    def setUp(self):\n        self.widget = self.create_widget(OWDataTable)\n\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        conn, self.iris = self.create_iris_sql_table()\n        self.table = SqlTable(conn, self.iris)\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    def test_input_data(self):\n        \"\"\"Check number of tabs with data on the input\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n        self.send_signal(self.widget.Inputs.data, self.data, 2)\n        self.assertEqual(self.widget.tabs.count(), 2)\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n\n    def test_data_model(self):\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.widget(0).model().rowCount(),\n                         len(self.data))\n\n    def test_reset_select(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._select_data()\n        self.send_signal(self.widget.Inputs.data, Table('heart_disease'))\n        self.assertListEqual([], self.widget.selected_cols)\n        self.assertListEqual([], self.widget.selected_rows)\n\n    def _select_data(self):\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain), 10))\n        self.widget.set_selection()\n        return self.widget.selected_rows\n\n    def test_attrs_appear_in_corner_text(self):\n        iris = Table(\"iris\")\n        domain = iris.domain\n        new_domain = Domain(\n            domain.attributes[1:], iris.domain.class_var, domain.attributes[:1])\n        new_domain.metas[0].attributes = {\"c\": \"foo\"}\n        new_domain.attributes[0].attributes = {\"a\": \"bar\", \"c\": \"baz\"}\n        new_domain.class_var.attributes = {\"b\": \"foo\"}\n        self.widget.set_corner_text = Mock()\n        self.send_signal(self.widget.Inputs.data, iris.transform(new_domain))\n        # false positive, pylint: disable=unsubscriptable-object\n        self.assertEqual(\n            self.widget.set_corner_text.call_args[0][1], \"\\na\\nb\\nc\")\n\n    def test_unconditional_commit_on_new_signal(self):\n        with patch.object(self.widget, 'unconditional_commit') as commit:\n            self.widget.auto_commit = False\n            commit.reset_mock()\n            self.send_signal(self.widget.Inputs.data, self.data)\n            commit.assert_called()\n\n    def test_pending_selection(self):\n        widget = self.create_widget(OWDataTable, stored_settings=dict(\n            selected_rows=[5, 6, 7, 8, 9],\n            selected_cols=list(range(len(self.data.domain)))))\n        self.send_signal(widget.Inputs.data, None, 1)\n        self.send_signal(widget.Inputs.data, self.data, 1)\n        output = self.get_output(widget.Outputs.selected_data)\n        self.assertEqual(5, len(output))\n\n    def test_sorting(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.selected_rows = [0, 1, 2, 3, 4]\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.set_selection()\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_original = output.tolist()\n\n        self.widget.tabs.currentWidget().sortByColumn(1, Qt.AscendingOrder)\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_sorted = output.tolist()\n        \n        # the two outputs should not be the same.\n        self.assertTrue(output_original != output_sorted)\n\n        # check if output after sorting is actually sorted.\n        self.assertTrue(sorted(output_original) == output_sorted)\n        self.assertTrue(sorted(output_sorted) == output_sorted)\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self.widget.tabs.currentWidget().selectAll()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        data = Table(\"iris\")\n        self.send_signal(self.widget.Inputs.data, data, 2)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self._select_data()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self.widget.tabs.setCurrentWidget(self.widget._inputs[1].view)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 2)\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_info(self):\n        info_text = self.widget.info_text\n        no_input = \"No data.\"\n        self.assertEqual(info_text.text(), no_input)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 18,
                            "end_lineno": 177,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 130,
                            "length": 8
                        },
                        "new_range": {
                            "start": 131,
                            "length": 8
                        },
                        "section": "class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        summary, details = f\"{len(data)}\", format_summary_details(data)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(info._StateInfo__input_summary.brief, summary)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(info._StateInfo__input_summary.details, details)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)",
                                "type": "deleted"
                            },
                            {
                                "content": "        self.assertEqual(info._StateInfo__output_summary.details, no_output)",
                                "type": "deleted"
                            },
                            {
                                "content": "        self.assertEqual(info._StateInfo__output_summary.brief, summary)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(info._StateInfo__output_summary.details, details)",
                                "type": "added"
                            },
                            {
                                "content": "        self.widget.tabs.currentWidget().selectAll()",
                                "type": "context"
                            },
                            {
                                "content": "        output = self.get_output(self.widget.Outputs.selected_data)",
                                "type": "context"
                            },
                            {
                                "content": "        summary, details = f\"{len(output)}\", format_summary_details(output)",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owtable.py",
                            "type": "class",
                            "name": "TestOWDataTable",
                            "content": "class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data  # pylint: disable=no-member\n\n    def setUp(self):\n        self.widget = self.create_widget(OWDataTable)\n\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        conn, self.iris = self.create_iris_sql_table()\n        self.table = SqlTable(conn, self.iris)\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    def test_input_data(self):\n        \"\"\"Check number of tabs with data on the input\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n        self.send_signal(self.widget.Inputs.data, self.data, 2)\n        self.assertEqual(self.widget.tabs.count(), 2)\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n\n    def test_data_model(self):\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.widget(0).model().rowCount(),\n                         len(self.data))\n\n    def test_reset_select(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._select_data()\n        self.send_signal(self.widget.Inputs.data, Table('heart_disease'))\n        self.assertListEqual([], self.widget.selected_cols)\n        self.assertListEqual([], self.widget.selected_rows)\n\n    def _select_data(self):\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain), 10))\n        self.widget.set_selection()\n        return self.widget.selected_rows\n\n    def test_attrs_appear_in_corner_text(self):\n        iris = Table(\"iris\")\n        domain = iris.domain\n        new_domain = Domain(\n            domain.attributes[1:], iris.domain.class_var, domain.attributes[:1])\n        new_domain.metas[0].attributes = {\"c\": \"foo\"}\n        new_domain.attributes[0].attributes = {\"a\": \"bar\", \"c\": \"baz\"}\n        new_domain.class_var.attributes = {\"b\": \"foo\"}\n        self.widget.set_corner_text = Mock()\n        self.send_signal(self.widget.Inputs.data, iris.transform(new_domain))\n        # false positive, pylint: disable=unsubscriptable-object\n        self.assertEqual(\n            self.widget.set_corner_text.call_args[0][1], \"\\na\\nb\\nc\")\n\n    def test_unconditional_commit_on_new_signal(self):\n        with patch.object(self.widget, 'unconditional_commit') as commit:\n            self.widget.auto_commit = False\n            commit.reset_mock()\n            self.send_signal(self.widget.Inputs.data, self.data)\n            commit.assert_called()\n\n    def test_pending_selection(self):\n        widget = self.create_widget(OWDataTable, stored_settings=dict(\n            selected_rows=[5, 6, 7, 8, 9],\n            selected_cols=list(range(len(self.data.domain)))))\n        self.send_signal(widget.Inputs.data, None, 1)\n        self.send_signal(widget.Inputs.data, self.data, 1)\n        output = self.get_output(widget.Outputs.selected_data)\n        self.assertEqual(5, len(output))\n\n    def test_sorting(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.selected_rows = [0, 1, 2, 3, 4]\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.set_selection()\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_original = output.tolist()\n\n        self.widget.tabs.currentWidget().sortByColumn(1, Qt.AscendingOrder)\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_sorted = output.tolist()\n        \n        # the two outputs should not be the same.\n        self.assertTrue(output_original != output_sorted)\n\n        # check if output after sorting is actually sorted.\n        self.assertTrue(sorted(output_original) == output_sorted)\n        self.assertTrue(sorted(output_sorted) == output_sorted)\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self.widget.tabs.currentWidget().selectAll()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        data = Table(\"iris\")\n        self.send_signal(self.widget.Inputs.data, data, 2)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self._select_data()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self.widget.tabs.setCurrentWidget(self.widget._inputs[1].view)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 2)\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_info(self):\n        info_text = self.widget.info_text\n        no_input = \"No data.\"\n        self.assertEqual(info_text.text(), no_input)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 18,
                            "end_lineno": 177,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/widgets/data/tests/test_owtable.py",
                            "type": "method",
                            "name": "TestOWDataTable.test_summary",
                            "content": "class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data  # pylint: disable=no-member\n\n    def setUp(self):\n        self.widget = self.create_widget(OWDataTable)\n\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        conn, self.iris = self.create_iris_sql_table()\n        self.table = SqlTable(conn, self.iris)\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    def test_input_data(self):\n        \"\"\"Check number of tabs with data on the input\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n        self.send_signal(self.widget.Inputs.data, self.data, 2)\n        self.assertEqual(self.widget.tabs.count(), 2)\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n\n    def test_data_model(self):\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.widget(0).model().rowCount(),\n                         len(self.data))\n\n    def test_reset_select(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._select_data()\n        self.send_signal(self.widget.Inputs.data, Table('heart_disease'))\n        self.assertListEqual([], self.widget.selected_cols)\n        self.assertListEqual([], self.widget.selected_rows)\n\n    def _select_data(self):\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain), 10))\n        self.widget.set_selection()\n        return self.widget.selected_rows\n\n    def test_attrs_appear_in_corner_text(self):\n        iris = Table(\"iris\")\n        domain = iris.domain\n        new_domain = Domain(\n            domain.attributes[1:], iris.domain.class_var, domain.attributes[:1])\n        new_domain.metas[0].attributes = {\"c\": \"foo\"}\n        new_domain.attributes[0].attributes = {\"a\": \"bar\", \"c\": \"baz\"}\n        new_domain.class_var.attributes = {\"b\": \"foo\"}\n        self.widget.set_corner_text = Mock()\n        self.send_signal(self.widget.Inputs.data, iris.transform(new_domain))\n        # false positive, pylint: disable=unsubscriptable-object\n        self.assertEqual(\n            self.widget.set_corner_text.call_args[0][1], \"\\na\\nb\\nc\")\n\n    def test_unconditional_commit_on_new_signal(self):\n        with patch.object(self.widget, 'unconditional_commit') as commit:\n            self.widget.auto_commit = False\n            commit.reset_mock()\n            self.send_signal(self.widget.Inputs.data, self.data)\n            commit.assert_called()\n\n    def test_pending_selection(self):\n        widget = self.create_widget(OWDataTable, stored_settings=dict(\n            selected_rows=[5, 6, 7, 8, 9],\n            selected_cols=list(range(len(self.data.domain)))))\n        self.send_signal(widget.Inputs.data, None, 1)\n        self.send_signal(widget.Inputs.data, self.data, 1)\n        output = self.get_output(widget.Outputs.selected_data)\n        self.assertEqual(5, len(output))\n\n    def test_sorting(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.selected_rows = [0, 1, 2, 3, 4]\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.set_selection()\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_original = output.tolist()\n\n        self.widget.tabs.currentWidget().sortByColumn(1, Qt.AscendingOrder)\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_sorted = output.tolist()\n        \n        # the two outputs should not be the same.\n        self.assertTrue(output_original != output_sorted)\n\n        # check if output after sorting is actually sorted.\n        self.assertTrue(sorted(output_original) == output_sorted)\n        self.assertTrue(sorted(output_sorted) == output_sorted)\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self.widget.tabs.currentWidget().selectAll()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        data = Table(\"iris\")\n        self.send_signal(self.widget.Inputs.data, data, 2)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self._select_data()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self.widget.tabs.setCurrentWidget(self.widget._inputs[1].view)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 2)\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_info(self):\n        info_text = self.widget.info_text\n        no_input = \"No data.\"\n        self.assertEqual(info_text.text(), no_input)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 118,
                            "end_lineno": 172,
                            "parent": {
                                "file_name": "Orange/widgets/data/tests/test_owtable.py",
                                "type": "class",
                                "name": "TestOWDataTable",
                                "content": "class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data  # pylint: disable=no-member\n\n    def setUp(self):\n        self.widget = self.create_widget(OWDataTable)\n\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        conn, self.iris = self.create_iris_sql_table()\n        self.table = SqlTable(conn, self.iris)\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    def test_input_data(self):\n        \"\"\"Check number of tabs with data on the input\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n        self.send_signal(self.widget.Inputs.data, self.data, 2)\n        self.assertEqual(self.widget.tabs.count(), 2)\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n\n    def test_data_model(self):\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.widget(0).model().rowCount(),\n                         len(self.data))\n\n    def test_reset_select(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._select_data()\n        self.send_signal(self.widget.Inputs.data, Table('heart_disease'))\n        self.assertListEqual([], self.widget.selected_cols)\n        self.assertListEqual([], self.widget.selected_rows)\n\n    def _select_data(self):\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain), 10))\n        self.widget.set_selection()\n        return self.widget.selected_rows\n\n    def test_attrs_appear_in_corner_text(self):\n        iris = Table(\"iris\")\n        domain = iris.domain\n        new_domain = Domain(\n            domain.attributes[1:], iris.domain.class_var, domain.attributes[:1])\n        new_domain.metas[0].attributes = {\"c\": \"foo\"}\n        new_domain.attributes[0].attributes = {\"a\": \"bar\", \"c\": \"baz\"}\n        new_domain.class_var.attributes = {\"b\": \"foo\"}\n        self.widget.set_corner_text = Mock()\n        self.send_signal(self.widget.Inputs.data, iris.transform(new_domain))\n        # false positive, pylint: disable=unsubscriptable-object\n        self.assertEqual(\n            self.widget.set_corner_text.call_args[0][1], \"\\na\\nb\\nc\")\n\n    def test_unconditional_commit_on_new_signal(self):\n        with patch.object(self.widget, 'unconditional_commit') as commit:\n            self.widget.auto_commit = False\n            commit.reset_mock()\n            self.send_signal(self.widget.Inputs.data, self.data)\n            commit.assert_called()\n\n    def test_pending_selection(self):\n        widget = self.create_widget(OWDataTable, stored_settings=dict(\n            selected_rows=[5, 6, 7, 8, 9],\n            selected_cols=list(range(len(self.data.domain)))))\n        self.send_signal(widget.Inputs.data, None, 1)\n        self.send_signal(widget.Inputs.data, self.data, 1)\n        output = self.get_output(widget.Outputs.selected_data)\n        self.assertEqual(5, len(output))\n\n    def test_sorting(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.selected_rows = [0, 1, 2, 3, 4]\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.set_selection()\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_original = output.tolist()\n\n        self.widget.tabs.currentWidget().sortByColumn(1, Qt.AscendingOrder)\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_sorted = output.tolist()\n        \n        # the two outputs should not be the same.\n        self.assertTrue(output_original != output_sorted)\n\n        # check if output after sorting is actually sorted.\n        self.assertTrue(sorted(output_original) == output_sorted)\n        self.assertTrue(sorted(output_sorted) == output_sorted)\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self.widget.tabs.currentWidget().selectAll()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        data = Table(\"iris\")\n        self.send_signal(self.widget.Inputs.data, data, 2)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self._select_data()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self.widget.tabs.setCurrentWidget(self.widget._inputs[1].view)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 2)\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_info(self):\n        info_text = self.widget.info_text\n        no_input = \"No data.\"\n        self.assertEqual(info_text.text(), no_input)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 18,
                                "end_lineno": 177,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 143,
                            "length": 8
                        },
                        "new_range": {
                            "start": 144,
                            "length": 8
                        },
                        "section": "class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        summary, details = f\"{len(data)}\", format_summary_details(data)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(info._StateInfo__input_summary.brief, summary)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(info._StateInfo__input_summary.details, details)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)",
                                "type": "deleted"
                            },
                            {
                                "content": "        self.assertEqual(info._StateInfo__output_summary.details, no_output)",
                                "type": "deleted"
                            },
                            {
                                "content": "        self.assertEqual(info._StateInfo__output_summary.brief, summary)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(info._StateInfo__output_summary.details, details)",
                                "type": "added"
                            },
                            {
                                "content": "        self._select_data()",
                                "type": "context"
                            },
                            {
                                "content": "        output = self.get_output(self.widget.Outputs.selected_data)",
                                "type": "context"
                            },
                            {
                                "content": "        summary, details = f\"{len(output)}\", format_summary_details(output)",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owtable.py",
                            "type": "class",
                            "name": "TestOWDataTable",
                            "content": "class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data  # pylint: disable=no-member\n\n    def setUp(self):\n        self.widget = self.create_widget(OWDataTable)\n\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        conn, self.iris = self.create_iris_sql_table()\n        self.table = SqlTable(conn, self.iris)\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    def test_input_data(self):\n        \"\"\"Check number of tabs with data on the input\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n        self.send_signal(self.widget.Inputs.data, self.data, 2)\n        self.assertEqual(self.widget.tabs.count(), 2)\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n\n    def test_data_model(self):\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.widget(0).model().rowCount(),\n                         len(self.data))\n\n    def test_reset_select(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._select_data()\n        self.send_signal(self.widget.Inputs.data, Table('heart_disease'))\n        self.assertListEqual([], self.widget.selected_cols)\n        self.assertListEqual([], self.widget.selected_rows)\n\n    def _select_data(self):\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain), 10))\n        self.widget.set_selection()\n        return self.widget.selected_rows\n\n    def test_attrs_appear_in_corner_text(self):\n        iris = Table(\"iris\")\n        domain = iris.domain\n        new_domain = Domain(\n            domain.attributes[1:], iris.domain.class_var, domain.attributes[:1])\n        new_domain.metas[0].attributes = {\"c\": \"foo\"}\n        new_domain.attributes[0].attributes = {\"a\": \"bar\", \"c\": \"baz\"}\n        new_domain.class_var.attributes = {\"b\": \"foo\"}\n        self.widget.set_corner_text = Mock()\n        self.send_signal(self.widget.Inputs.data, iris.transform(new_domain))\n        # false positive, pylint: disable=unsubscriptable-object\n        self.assertEqual(\n            self.widget.set_corner_text.call_args[0][1], \"\\na\\nb\\nc\")\n\n    def test_unconditional_commit_on_new_signal(self):\n        with patch.object(self.widget, 'unconditional_commit') as commit:\n            self.widget.auto_commit = False\n            commit.reset_mock()\n            self.send_signal(self.widget.Inputs.data, self.data)\n            commit.assert_called()\n\n    def test_pending_selection(self):\n        widget = self.create_widget(OWDataTable, stored_settings=dict(\n            selected_rows=[5, 6, 7, 8, 9],\n            selected_cols=list(range(len(self.data.domain)))))\n        self.send_signal(widget.Inputs.data, None, 1)\n        self.send_signal(widget.Inputs.data, self.data, 1)\n        output = self.get_output(widget.Outputs.selected_data)\n        self.assertEqual(5, len(output))\n\n    def test_sorting(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.selected_rows = [0, 1, 2, 3, 4]\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.set_selection()\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_original = output.tolist()\n\n        self.widget.tabs.currentWidget().sortByColumn(1, Qt.AscendingOrder)\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_sorted = output.tolist()\n        \n        # the two outputs should not be the same.\n        self.assertTrue(output_original != output_sorted)\n\n        # check if output after sorting is actually sorted.\n        self.assertTrue(sorted(output_original) == output_sorted)\n        self.assertTrue(sorted(output_sorted) == output_sorted)\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self.widget.tabs.currentWidget().selectAll()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        data = Table(\"iris\")\n        self.send_signal(self.widget.Inputs.data, data, 2)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self._select_data()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self.widget.tabs.setCurrentWidget(self.widget._inputs[1].view)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 2)\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_info(self):\n        info_text = self.widget.info_text\n        no_input = \"No data.\"\n        self.assertEqual(info_text.text(), no_input)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 18,
                            "end_lineno": 177,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/widgets/data/tests/test_owtable.py",
                            "type": "method",
                            "name": "TestOWDataTable.test_summary",
                            "content": "class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data  # pylint: disable=no-member\n\n    def setUp(self):\n        self.widget = self.create_widget(OWDataTable)\n\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        conn, self.iris = self.create_iris_sql_table()\n        self.table = SqlTable(conn, self.iris)\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    def test_input_data(self):\n        \"\"\"Check number of tabs with data on the input\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n        self.send_signal(self.widget.Inputs.data, self.data, 2)\n        self.assertEqual(self.widget.tabs.count(), 2)\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n\n    def test_data_model(self):\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.widget(0).model().rowCount(),\n                         len(self.data))\n\n    def test_reset_select(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._select_data()\n        self.send_signal(self.widget.Inputs.data, Table('heart_disease'))\n        self.assertListEqual([], self.widget.selected_cols)\n        self.assertListEqual([], self.widget.selected_rows)\n\n    def _select_data(self):\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain), 10))\n        self.widget.set_selection()\n        return self.widget.selected_rows\n\n    def test_attrs_appear_in_corner_text(self):\n        iris = Table(\"iris\")\n        domain = iris.domain\n        new_domain = Domain(\n            domain.attributes[1:], iris.domain.class_var, domain.attributes[:1])\n        new_domain.metas[0].attributes = {\"c\": \"foo\"}\n        new_domain.attributes[0].attributes = {\"a\": \"bar\", \"c\": \"baz\"}\n        new_domain.class_var.attributes = {\"b\": \"foo\"}\n        self.widget.set_corner_text = Mock()\n        self.send_signal(self.widget.Inputs.data, iris.transform(new_domain))\n        # false positive, pylint: disable=unsubscriptable-object\n        self.assertEqual(\n            self.widget.set_corner_text.call_args[0][1], \"\\na\\nb\\nc\")\n\n    def test_unconditional_commit_on_new_signal(self):\n        with patch.object(self.widget, 'unconditional_commit') as commit:\n            self.widget.auto_commit = False\n            commit.reset_mock()\n            self.send_signal(self.widget.Inputs.data, self.data)\n            commit.assert_called()\n\n    def test_pending_selection(self):\n        widget = self.create_widget(OWDataTable, stored_settings=dict(\n            selected_rows=[5, 6, 7, 8, 9],\n            selected_cols=list(range(len(self.data.domain)))))\n        self.send_signal(widget.Inputs.data, None, 1)\n        self.send_signal(widget.Inputs.data, self.data, 1)\n        output = self.get_output(widget.Outputs.selected_data)\n        self.assertEqual(5, len(output))\n\n    def test_sorting(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.selected_rows = [0, 1, 2, 3, 4]\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.set_selection()\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_original = output.tolist()\n\n        self.widget.tabs.currentWidget().sortByColumn(1, Qt.AscendingOrder)\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_sorted = output.tolist()\n        \n        # the two outputs should not be the same.\n        self.assertTrue(output_original != output_sorted)\n\n        # check if output after sorting is actually sorted.\n        self.assertTrue(sorted(output_original) == output_sorted)\n        self.assertTrue(sorted(output_sorted) == output_sorted)\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self.widget.tabs.currentWidget().selectAll()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        data = Table(\"iris\")\n        self.send_signal(self.widget.Inputs.data, data, 2)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self._select_data()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self.widget.tabs.setCurrentWidget(self.widget._inputs[1].view)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 2)\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_info(self):\n        info_text = self.widget.info_text\n        no_input = \"No data.\"\n        self.assertEqual(info_text.text(), no_input)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 118,
                            "end_lineno": 172,
                            "parent": {
                                "file_name": "Orange/widgets/data/tests/test_owtable.py",
                                "type": "class",
                                "name": "TestOWDataTable",
                                "content": "class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data  # pylint: disable=no-member\n\n    def setUp(self):\n        self.widget = self.create_widget(OWDataTable)\n\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        conn, self.iris = self.create_iris_sql_table()\n        self.table = SqlTable(conn, self.iris)\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    def test_input_data(self):\n        \"\"\"Check number of tabs with data on the input\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n        self.send_signal(self.widget.Inputs.data, self.data, 2)\n        self.assertEqual(self.widget.tabs.count(), 2)\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n\n    def test_data_model(self):\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.widget(0).model().rowCount(),\n                         len(self.data))\n\n    def test_reset_select(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._select_data()\n        self.send_signal(self.widget.Inputs.data, Table('heart_disease'))\n        self.assertListEqual([], self.widget.selected_cols)\n        self.assertListEqual([], self.widget.selected_rows)\n\n    def _select_data(self):\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain), 10))\n        self.widget.set_selection()\n        return self.widget.selected_rows\n\n    def test_attrs_appear_in_corner_text(self):\n        iris = Table(\"iris\")\n        domain = iris.domain\n        new_domain = Domain(\n            domain.attributes[1:], iris.domain.class_var, domain.attributes[:1])\n        new_domain.metas[0].attributes = {\"c\": \"foo\"}\n        new_domain.attributes[0].attributes = {\"a\": \"bar\", \"c\": \"baz\"}\n        new_domain.class_var.attributes = {\"b\": \"foo\"}\n        self.widget.set_corner_text = Mock()\n        self.send_signal(self.widget.Inputs.data, iris.transform(new_domain))\n        # false positive, pylint: disable=unsubscriptable-object\n        self.assertEqual(\n            self.widget.set_corner_text.call_args[0][1], \"\\na\\nb\\nc\")\n\n    def test_unconditional_commit_on_new_signal(self):\n        with patch.object(self.widget, 'unconditional_commit') as commit:\n            self.widget.auto_commit = False\n            commit.reset_mock()\n            self.send_signal(self.widget.Inputs.data, self.data)\n            commit.assert_called()\n\n    def test_pending_selection(self):\n        widget = self.create_widget(OWDataTable, stored_settings=dict(\n            selected_rows=[5, 6, 7, 8, 9],\n            selected_cols=list(range(len(self.data.domain)))))\n        self.send_signal(widget.Inputs.data, None, 1)\n        self.send_signal(widget.Inputs.data, self.data, 1)\n        output = self.get_output(widget.Outputs.selected_data)\n        self.assertEqual(5, len(output))\n\n    def test_sorting(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.selected_rows = [0, 1, 2, 3, 4]\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.set_selection()\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_original = output.tolist()\n\n        self.widget.tabs.currentWidget().sortByColumn(1, Qt.AscendingOrder)\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_sorted = output.tolist()\n        \n        # the two outputs should not be the same.\n        self.assertTrue(output_original != output_sorted)\n\n        # check if output after sorting is actually sorted.\n        self.assertTrue(sorted(output_original) == output_sorted)\n        self.assertTrue(sorted(output_sorted) == output_sorted)\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self.widget.tabs.currentWidget().selectAll()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        data = Table(\"iris\")\n        self.send_signal(self.widget.Inputs.data, data, 2)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n        self._select_data()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self.widget.tabs.setCurrentWidget(self.widget._inputs[1].view)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 2)\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_info(self):\n        info_text = self.widget.info_text\n        no_input = \"No data.\"\n        self.assertEqual(info_text.text(), no_input)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 18,
                                "end_lineno": 177,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "# pylint: disable=protected-access,unused-import\nfrom contextlib import contextmanager\nimport os\nimport pickle\nfrom unittest.mock import Mock, patch\n\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom AnyQt.QtGui import QFont, QTextDocumentFragment\nfrom AnyQt.QtCore import QRectF, QPointF\nfrom AnyQt.QtTest import QSignalSpy\nfrom AnyQt.QtWidgets import (\n    QComboBox, QSpinBox, QDoubleSpinBox, QSlider\n)\n\nfrom orangewidget.widget import StateInfo\nfrom orangewidget.tests.base import (\n    GuiTest, WidgetTest as WidgetTestBase, DummySignalManager, DEFAULT_TIMEOUT\n)\nfrom Orange.base import SklModel, Model\nfrom Orange.classification.base_classification import (\n    LearnerClassification, ModelClassification\n)\nfrom Orange.data import (\n    Table, Domain, DiscreteVariable, ContinuousVariable, Variable\n)\nfrom Orange.modelling import Fitter\nfrom Orange.preprocess import RemoveNaNColumns, Randomize, Continuize\nfrom Orange.preprocess.preprocess import PreprocessorList\nfrom Orange.regression.base_regression import (\n    LearnerRegression, ModelRegression\n)\nfrom Orange.widgets.tests.utils import simulate\nfrom Orange.widgets.utils.annotated_data import (\n    ANNOTATED_DATA_FEATURE_NAME, ANNOTATED_DATA_SIGNAL_NAME\n)\nfrom Orange.widgets.utils.owlearnerwidget import OWBaseLearner\nfrom Orange.widgets.visualize.utils.plotutils import AnchorItem\nfrom Orange.widgets.widget import OWWidget\n\n\nclass WidgetTest(WidgetTestBase):\n    def assert_table_equal(self, table1, table2):\n        if table1 is None or table2 is None:\n            self.assertIs(table1, table2)\n            return\n        self.assert_domain_equal(table1.domain, table2.domain)\n        np.testing.assert_array_equal(table1.X, table2.X)\n        np.testing.assert_array_equal(table1.Y, table2.Y)\n        np.testing.assert_array_equal(table1.metas, table2.metas)\n\n    def assert_domain_equal(self, domain1, domain2):\n        \"\"\"\n        Test domains for equality.\n\n        Unlike in domain1 == domain2 uses `Variable.__eq__`, which in case of\n        DiscreteVariable ignores `values`, this method also checks that both\n        domain have equal `values`.\n        \"\"\"\n        for var1, var2 in zip(domain1.variables + domain1.metas,\n                              domain2.variables + domain2.metas):\n            self.assertEqual(type(var1), type(var2))\n            self.assertEqual(var1.name, var2.name)\n            if var1.is_discrete:\n                self.assertEqual(var1.values, var2.values)\n\n\nclass TestWidgetTest(WidgetTest):\n    \"\"\"Meta tests for widget test helpers\"\"\"\n\n    def test_process_events_handles_timeouts(self):\n        with self.assertRaises(TimeoutError):\n            self.process_events(until=lambda: False, timeout=0)\n\n    def test_minimum_size(self):\n        return  # skip this test\n\n\nclass BaseParameterMapping:\n    \"\"\"Base class for mapping between gui components and learner's parameters\n    when testing learner widgets.\n\n    Parameters\n    ----------\n    name : str\n        Name of learner's parameter.\n\n    gui_element : QWidget\n        Gui component who's corresponding parameter is to be tested.\n\n    values: list\n        List of values to be tested.\n\n    getter: function\n        It gets component's value.\n\n    setter: function\n        It sets component's value.\n    \"\"\"\n\n    def __init__(self, name, gui_element, values, getter, setter,\n                 problem_type=\"both\"):\n        self.name = name\n        self.gui_element = gui_element\n        self.values = values\n        self.get_value = getter\n        self.set_value = setter\n        self.problem_type = problem_type\n\n    def __str__(self):\n        if self.problem_type == \"both\":\n            return self.name\n        else:\n            return \"%s (%s)\" % (self.name, self.problem_type)\n\n\nclass DefaultParameterMapping(BaseParameterMapping):\n    \"\"\"Class for mapping between gui components and learner's parameters\n    when testing unchecked properties and therefore default parameters\n    should be used.\n\n    Parameters\n    ----------\n    name : str\n        Name of learner's parameter.\n\n    default_value: str, int,\n        Value that should be used by default.\n    \"\"\"\n\n    def __init__(self, name, default_value):\n        super().__init__(name, None, [default_value],\n                         lambda: default_value, lambda x: None)\n\n\nclass ParameterMapping(BaseParameterMapping):\n    \"\"\"Class for mapping between gui components and learner parameters\n    when testing learner widgets\n\n    Parameters\n    ----------\n    name : str\n        Name of learner's parameter.\n\n    gui_element : QWidget\n        Gui component who's corresponding parameter is to be tested.\n\n    values: list, mandatory for ComboBox, optional otherwise\n        List of values to be tested. When None, it is set according to\n        component's type.\n\n    getter: function, optional\n        It gets component's value. When None, it is set according to\n        component's type.\n\n    setter: function, optional\n        It sets component's value. When None, it is set according to\n        component's type.\n    \"\"\"\n\n    def __init__(self, name, gui_element, values=None,\n                 getter=None, setter=None, **kwargs):\n        super().__init__(\n            name, gui_element,\n            values or self._default_values(gui_element),\n            getter or self._default_get_value(gui_element, values),\n            setter or self._default_set_value(gui_element, values),\n            **kwargs)\n\n    @staticmethod\n    def get_gui_element(widget, attribute):\n        return widget.controlled_attributes[attribute][0].control\n\n    @classmethod\n    def from_attribute(cls, widget, attribute, parameter=None):\n        return cls(parameter or attribute, cls.get_gui_element(widget, attribute))\n\n    @staticmethod\n    def _default_values(gui_element):\n        if isinstance(gui_element, (QSpinBox, QDoubleSpinBox, QSlider)):\n            return [gui_element.minimum(), gui_element.maximum()]\n        else:\n            raise TypeError(\"{} is not supported\".format(gui_element))\n\n    @staticmethod\n    def _default_get_value(gui_element, values):\n        if isinstance(gui_element, (QSpinBox, QDoubleSpinBox, QSlider)):\n            return gui_element.value\n        elif isinstance(gui_element, QComboBox):\n            return lambda: values[gui_element.currentIndex()]\n        else:\n            raise TypeError(\"{} is not supported\".format(gui_element))\n\n    @staticmethod\n    def _default_set_value(gui_element, values):\n        if isinstance(gui_element, (QSpinBox, QDoubleSpinBox, QSlider)):\n            return lambda val: gui_element.setValue(val)\n        elif isinstance(gui_element, QComboBox):\n            def fun(val):\n                value = values.index(val)\n                gui_element.activated.emit(value)\n                gui_element.setCurrentIndex(value)\n\n            return fun\n        else:\n            raise TypeError(\"{} is not supported\".format(gui_element))\n\n\nclass WidgetLearnerTestMixin:\n    \"\"\"Base class for widget learner tests.\n\n    Contains init method to set up testing parameters and test methods.\n\n    All widget learner tests should extend it (beside extending WidgetTest\n    class as well). Learners with extra parameters, which can be set on the\n    widget, should override self.parameters list in the setUp method. The\n    list should contain mapping: learner parameter - gui component.\n    \"\"\"\n\n    widget = None  # type: OWBaseLearner\n\n    def init(self):\n        cls_ds = Table(datasets.path(\"testing_dataset_cls\"))\n        reg_ds = Table(datasets.path(\"testing_dataset_reg\"))\n\n        if issubclass(self.widget.LEARNER, Fitter):\n            self.data = cls_ds\n            self.valid_datasets = (cls_ds, reg_ds)\n            self.inadequate_dataset = ()\n            self.learner_class = Fitter\n            self.model_class = Model\n            self.model_name = 'Model'\n        elif issubclass(self.widget.LEARNER, LearnerClassification):\n            self.data = cls_ds\n            self.valid_datasets = (cls_ds,)\n            self.inadequate_dataset = (reg_ds,)\n            self.learner_class = LearnerClassification\n            self.model_class = ModelClassification\n            self.model_name = 'Classifier'\n        else:\n            self.data = reg_ds\n            self.valid_datasets = (reg_ds,)\n            self.inadequate_dataset = (cls_ds,)\n            self.learner_class = LearnerRegression\n            self.model_class = ModelRegression\n            self.model_name = 'Predictor'\n\n        self.parameters = []\n\n    def test_has_unconditional_apply(self):\n        self.assertTrue(hasattr(self.widget, \"unconditional_apply\"))\n\n    def test_input_data(self):\n        \"\"\"Check widget's data with data on the input\"\"\"\n        self.assertEqual(self.widget.data, None)\n        self.send_signal(\"Data\", self.data)\n        self.assertEqual(self.widget.data, self.data)\n        self.wait_until_stop_blocking()\n\n    def test_input_data_disconnect(self):\n        \"\"\"Check widget's data and model after disconnecting data from input\"\"\"\n        self.send_signal(\"Data\", self.data)\n        self.assertEqual(self.widget.data, self.data)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.send_signal(\"Data\", None)\n        self.wait_until_stop_blocking()\n        self.assertEqual(self.widget.data, None)\n        self.assertIsNone(self.get_output(self.widget.Outputs.model))\n\n    def test_input_data_learner_adequacy(self):\n        \"\"\"Check if error message is shown with inadequate data on input\"\"\"\n        for inadequate in self.inadequate_dataset:\n            self.send_signal(\"Data\", inadequate)\n            self.widget.apply_button.button.click()\n            self.wait_until_stop_blocking()\n            self.assertTrue(self.widget.Error.data_error.is_shown())\n        for valid in self.valid_datasets:\n            self.send_signal(\"Data\", valid)\n            self.wait_until_stop_blocking()\n            self.assertFalse(self.widget.Error.data_error.is_shown())\n\n    def test_input_preprocessor(self):\n        \"\"\"Check learner's preprocessors with an extra pp on input\"\"\"\n        randomize = Randomize()\n        self.send_signal(\"Preprocessor\", randomize)\n        self.assertEqual(\n            randomize, self.widget.preprocessors,\n            'Preprocessor not added to widget preprocessors')\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertEqual(\n            (randomize,), self.widget.learner.preprocessors,\n            'Preprocessors were not passed to the learner')\n\n    def test_input_preprocessors(self):\n        \"\"\"Check multiple preprocessors on input\"\"\"\n        pp_list = PreprocessorList([Randomize(), RemoveNaNColumns()])\n        self.send_signal(\"Preprocessor\", pp_list)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertEqual(\n            (pp_list,), self.widget.learner.preprocessors,\n            '`PreprocessorList` was not added to preprocessors')\n\n    def test_input_preprocessor_disconnect(self):\n        \"\"\"Check learner's preprocessors after disconnecting pp from input\"\"\"\n        randomize = Randomize()\n        self.send_signal(\"Preprocessor\", randomize)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertEqual(randomize, self.widget.preprocessors)\n\n        self.send_signal(\"Preprocessor\", None)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertIsNone(self.widget.preprocessors,\n                          'Preprocessors not removed on disconnect.')\n\n    def test_output_learner(self):\n        \"\"\"Check if learner is on output after apply\"\"\"\n        initial = self.get_output(\"Learner\")\n        self.assertIsNotNone(initial, \"Does not initialize the learner output\")\n        self.widget.apply_button.button.click()\n        newlearner = self.get_output(\"Learner\")\n        self.assertIsNot(initial, newlearner,\n                         \"Does not send a new learner instance on `Apply`.\")\n        self.assertIsNotNone(newlearner)\n        self.assertIsInstance(newlearner, self.widget.LEARNER)\n\n    def test_output_model(self):\n        \"\"\"Check if model is on output after sending data and apply\"\"\"\n        self.assertIsNone(self.get_output(self.widget.Outputs.model))\n        self.widget.apply_button.button.click()\n        self.assertIsNone(self.get_output(self.widget.Outputs.model))\n        self.send_signal('Data', self.data)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        model = self.get_output(self.widget.Outputs.model)\n        self.assertIsNotNone(model)\n        self.assertIsInstance(model, self.widget.LEARNER.__returns__)\n        self.assertIsInstance(model, self.model_class)\n\n    def test_output_learner_name(self):\n        \"\"\"Check if learner's name properly changes\"\"\"\n        new_name = \"Learner Name\"\n        self.widget.apply_button.button.click()\n        self.assertEqual(self.widget.learner.name,\n                         self.widget.name_line_edit.text()\n                         or self.widget.name_line_edit.placeholderText())\n        self.widget.name_line_edit.setText(new_name)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertEqual(self.get_output(\"Learner\").name, new_name)\n\n    def test_output_model_name(self):\n        \"\"\"Check if model's name properly changes\"\"\"\n        new_name = \"Model Name\"\n        self.widget.name_line_edit.setText(new_name)\n        self.send_signal(\"Data\", self.data)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertEqual(self.get_output(self.widget.Outputs.model).name, new_name)\n\n    def test_output_model_picklable(self):\n        \"\"\"Check if model can be pickled\"\"\"\n        self.send_signal(\"Data\", self.data)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        model = self.get_output(self.widget.Outputs.model)\n        pickle.dumps(model)\n\n    @staticmethod\n    def _get_param_value(learner, param):\n        if isinstance(learner, Fitter):\n            # Both is just a was to indicate to the tests, fitters don't\n            # actually support this\n            if param.problem_type == \"both\":\n                problem_type = learner.CLASSIFICATION\n            else:\n                problem_type = param.problem_type\n            return learner.get_params(problem_type).get(param.name)\n        else:\n            return learner.params.get(param.name)\n\n    def test_parameters_default(self):\n        \"\"\"Check if learner's parameters are set to default (widget's) values\n        \"\"\"\n        for dataset in self.valid_datasets:\n            self.send_signal(\"Data\", dataset)\n            self.widget.apply_button.button.click()\n            self.wait_until_stop_blocking()\n            for parameter in self.parameters:\n                # Skip if the param isn't used for the given data type\n                if self._should_check_parameter(parameter, dataset):\n                    self.assertEqual(\n                        self._get_param_value(self.widget.learner, parameter),\n                        parameter.get_value())\n\n    def test_parameters(self):\n        \"\"\"Check learner and model for various values of all parameters\"\"\"\n        # Test params on every valid dataset, since some attributes may apply\n        # to only certain problem types\n        for dataset in self.valid_datasets:\n            self.send_signal(\"Data\", dataset)\n            self.wait_until_stop_blocking()\n\n            for parameter in self.parameters:\n                # Skip if the param isn't used for the given data type\n                if not self._should_check_parameter(parameter, dataset):\n                    continue\n\n                assert isinstance(parameter, BaseParameterMapping)\n\n                for value in parameter.values:\n                    parameter.set_value(value)\n                    self.widget.apply_button.button.click()\n                    self.wait_until_stop_blocking()\n                    param = self._get_param_value(self.widget.learner, parameter)\n                    self.assertEqual(\n                        param, parameter.get_value(),\n                        \"Mismatching setting for parameter '%s'\" % parameter)\n                    self.assertEqual(\n                        param, value,\n                        \"Mismatching setting for parameter '%s'\" % parameter)\n                    param = self._get_param_value(self.get_output(\"Learner\"), parameter)\n                    self.assertEqual(\n                        param, value,\n                        \"Mismatching setting for parameter '%s'\" % parameter)\n\n                    if issubclass(self.widget.LEARNER, SklModel):\n                        model = self.get_output(self.widget.Outputs.model)\n                        if model is not None:\n                            self.assertEqual(self._get_param_value(model, parameter), value)\n                            self.assertFalse(self.widget.Error.active)\n                        else:\n                            self.assertTrue(self.widget.Error.active)\n\n    def test_params_trigger_settings_changed(self):\n        \"\"\"Check that the learner gets updated whenever a param is changed.\"\"\"\n        for dataset in self.valid_datasets:\n            self.send_signal(\"Data\", dataset)\n            self.wait_until_stop_blocking()\n\n            for parameter in self.parameters:\n                # Skip if the param isn't used for the given data type\n                if not self._should_check_parameter(parameter, dataset):\n                    continue\n\n                assert isinstance(parameter, BaseParameterMapping)\n                # Set the mock here so we can include the param name in the\n                # error message, so if any test fails, we see where\n                # We mock `apply` and not `settings_changed` since that's\n                # sometimes connected with Qt signals, which are not directly\n                # called\n                self.widget.apply = Mock(name=\"apply(%s)\" % parameter)\n                # Since the settings only get updated when the value actually\n                # changes, find a value that isn't the same as the current\n                # value and try with that\n                new_value = [x for x in parameter.values\n                             if x != parameter.get_value()][0]\n                parameter.set_value(new_value)\n                # wait for asynchronous calls\n                self.process_events(lambda: self.widget.apply.call_args is not None)\n                self.widget.apply.assert_called_once()\n\n    @staticmethod\n    def _should_check_parameter(parameter, data):\n        \"\"\"Should the param be passed into the learner given the data\"\"\"\n        return ((parameter.problem_type == \"classification\" and\n                 data.domain.has_discrete_class) or\n                (parameter.problem_type == \"regression\" and\n                 data.domain.has_continuous_class) or\n                (parameter.problem_type == \"both\"))\n\n    def test_send_report(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Test report\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.report_button.click()\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.report_button.click()\n\n\nclass WidgetOutputsTestMixin:\n    \"\"\"Class for widget's outputs testing.\n\n    Contains init method to set up testing parameters and a test method, which\n    checks Selected Data and (Annotated) Data outputs.\n\n    Since widgets have different ways of selecting data instances, _select_data\n    method should be implemented when subclassed. The method should assign\n    value to selected_indices parameter.\n\n    If output's expected domain differs from input's domain, parameter\n    same_input_output_domain should be set to False.\n\n    If Selected Data and Data domains differ, override method\n    _compare_selected_annotated_domains.\n    \"\"\"\n\n    def init(self, same_table_attributes=True):\n        self.data = Table(\"iris\")\n        self.same_input_output_domain = True\n        self.same_table_attributes = same_table_attributes\n\n    def test_outputs(self, timeout=DEFAULT_TIMEOUT):\n        self.send_signal(self.signal_name, self.signal_data)\n\n        self.wait_until_finished(timeout=timeout)\n\n        # check selected data output\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n\n        # check annotated data output\n        feature_name = ANNOTATED_DATA_FEATURE_NAME\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(0, np.sum([i[feature_name] for i in annotated]))\n\n        # select data instances\n        selected_indices = self._select_data()\n\n        # check selected data output\n        selected = self.get_output(\"Selected Data\")\n        n_sel, n_attr = len(selected), len(self.data.domain.attributes)\n        self.assertGreater(n_sel, 0)\n        self.assertEqual(selected.domain == self.data.domain,\n                         self.same_input_output_domain)\n        np.testing.assert_array_equal(selected.X[:, :n_attr],\n                                      self.data.X[selected_indices])\n        if self.same_table_attributes:\n            self.assertEqual(selected.attributes, self.data.attributes)\n\n        # check annotated data output\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(n_sel, np.sum([i[feature_name] for i in annotated]))\n        if self.same_table_attributes:\n            self.assertEqual(annotated.attributes, self.data.attributes)\n\n        # compare selected and annotated data domains\n        self._compare_selected_annotated_domains(selected, annotated)\n\n        # check output when data is removed\n        self.send_signal(self.signal_name, None)\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n        self.assertIsNone(self.get_output(ANNOTATED_DATA_SIGNAL_NAME))\n\n    def _select_data(self):\n        raise NotImplementedError(\"Subclasses should implement select_data\")\n\n    def _compare_selected_annotated_domains(self, selected, annotated):\n        selected_vars = selected.domain.variables + selected.domain.metas\n        annotated_vars = annotated.domain.variables + annotated.domain.metas\n        self.assertLess(set(selected_vars), set(annotated_vars))\n\n\nclass ProjectionWidgetTestMixin:\n    \"\"\"Class for projection widget testing\"\"\"\n\n    def init(self):\n        self.data = Table(\"iris\")\n\n    def _select_data(self):\n        rect = QRectF(QPointF(-20, -20), QPointF(20, 20))\n        self.widget.graph.select_by_rectangle(rect)\n        return self.widget.graph.get_selection()\n\n    def _compare_selected_annotated_domains(self, selected, annotated):\n        selected_vars = selected.domain.variables\n        annotated_vars = annotated.domain.variables\n        self.assertLessEqual(set(selected_vars), set(annotated_vars))\n\n    def test_setup_graph(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Plot should exist after data has been sent in order to be\n        properly set/updated\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assertTrue(\n            self.signal_manager.wait_for_finished(self.widget, timeout),\n            f\"Did not finish in the specified {timeout}ms timeout\"\n        )\n\n        self.assertIsNotNone(self.widget.graph.scatterplot_item)\n\n    def test_default_attrs(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Check default values for 'Color', 'Shape', 'Size' and 'Label'\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertIs(self.widget.attr_color, self.data.domain.class_var)\n        self.assertIsNone(self.widget.attr_label)\n        self.assertIsNone(self.widget.attr_shape)\n        self.assertIsNone(self.widget.attr_size)\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertIsNone(self.widget.attr_color)\n\n    def test_attr_models(self):\n        \"\"\"Check possible values for 'Color', 'Shape', 'Size' and 'Label'\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        controls = self.widget.controls\n        self.assertEqual(len(controls.attr_color.model()), 8)\n        self.assertEqual(len(controls.attr_shape.model()), 3)\n        self.assertTrue(5 < len(controls.attr_size.model()) < 8)\n        self.assertEqual(len(controls.attr_label.model()), 8)\n\n        # color and label should contain all variables\n        # size should contain only continuous variables\n        # shape should contain only discrete variables\n        for var in self.data.domain.variables + self.data.domain.metas:\n            self.assertIn(var, controls.attr_color.model())\n            self.assertIn(var, controls.attr_label.model())\n            if var.is_continuous:\n                self.assertIn(var, controls.attr_size.model())\n                self.assertNotIn(var, controls.attr_shape.model())\n            if var.is_discrete:\n                self.assertNotIn(var, controls.attr_size.model())\n                self.assertIn(var, controls.attr_shape.model())\n\n    def test_attr_label_metas(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Set 'Label' from string meta attribute\"\"\"\n        cont = Continuize(multinomial_treatment=Continuize.AsOrdinal)\n        data = cont(Table(\"zoo\"))\n        self.send_signal(self.widget.Inputs.data, data)\n        self.wait_until_finished(timeout=timeout)\n        simulate.combobox_activate_item(self.widget.controls.attr_label,\n                                        data.domain[-1].name)\n\n    def test_handle_primitive_metas(self):\n        \"\"\"Set 'Color' from continuous meta attribute\"\"\"\n        d, attrs = self.data.domain, self.data.domain.attributes\n        data = self.data.transform(Domain(attrs[:2], d.class_vars, attrs[2:]))\n        self.send_signal(self.widget.Inputs.data, data)\n        simulate.combobox_activate_item(self.widget.controls.attr_color,\n                                        data.domain.metas[0].name)\n\n    def test_datasets(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Test widget for datasets with missing values and constant features\"\"\"\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n            self.wait_until_finished(timeout=timeout)\n\n    def test_none_data(self):\n        \"\"\"Test widget for empty dataset\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data[:0])\n\n    def test_plot_once(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Test if data is plotted only once but committed on every input change\"\"\"\n        table = Table(\"heart_disease\")\n        self.widget.setup_plot = Mock()\n        self.widget.commit = self.widget.unconditional_commit = Mock()\n        self.send_signal(self.widget.Inputs.data, table)\n        self.widget.setup_plot.assert_called_once()\n        self.widget.commit.assert_called_once()\n\n        self.wait_until_finished(timeout=timeout)\n        self.widget.setup_plot.assert_called_once()\n        self.widget.commit.assert_called_once()\n\n        self.widget.commit.reset_mock()\n        self.send_signal(self.widget.Inputs.data_subset, table[::10])\n        self.widget.setup_plot.assert_called_once()\n        self.widget.commit.assert_called_once()\n\n    def test_subset_data_color(self, timeout=DEFAULT_TIMEOUT):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertTrue(\n            self.signal_manager.wait_for_finished(self.widget, timeout),\n            f\"Did not finish in the specified {timeout}ms timeout\"\n        )\n        self.send_signal(self.widget.Inputs.data_subset, self.data[:10])\n        subset = [brush.color().name() == \"#46befa\" for brush in\n                  self.widget.graph.scatterplot_item.data['brush'][:10]]\n        other = [brush.color().name() == \"#000000\" for brush in\n                 self.widget.graph.scatterplot_item.data['brush'][10:]]\n        self.assertTrue(all(subset))\n        self.assertTrue(all(other))\n\n    def test_class_density(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Check class density update\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.cb_class_density.click()\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.cb_class_density.click()\n\n    def test_dragging_tooltip(self):\n        \"\"\"Dragging tooltip depends on data being jittered\"\"\"\n        text = QTextDocumentFragment.fromHtml(self.widget.graph.tiptexts[0]).toPlainText()\n        self.send_signal(self.widget.Inputs.data, Table(\"heart_disease\"))\n        self.assertEqual(self.widget.graph.tip_textitem.toPlainText(), text)\n\n    def test_sparse_data(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Test widget for sparse data\"\"\"\n        table = Table(\"iris\").to_sparse()\n        self.assertTrue(sp.issparse(table.X))\n        self.send_signal(self.widget.Inputs.data, table)\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data_subset, table[::30])\n        self.assertEqual(len(self.widget.subset_data), 5)\n\n    def test_invalidated_embedding(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Check if graph has been replotted when sending same data\"\"\"\n        self.widget.graph.update_coordinates = Mock()\n        self.widget.graph.update_point_props = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.wait_until_finished(timeout=timeout)\n\n        self.widget.graph.update_coordinates.assert_called()\n        self.widget.graph.update_point_props.assert_called()\n\n        self.widget.graph.update_coordinates.reset_mock()\n        self.widget.graph.update_point_props.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.wait_until_finished(timeout=timeout)\n\n        self.widget.graph.update_coordinates.assert_not_called()\n        self.widget.graph.update_point_props.assert_called_once()\n\n    def test_saved_selection(self, timeout=DEFAULT_TIMEOUT):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertTrue(\n            self.signal_manager.wait_for_finished(self.widget, timeout),\n            f\"Did not finish in the specified {timeout}ms timeout\"\n        )\n\n        self.widget.graph.select_by_indices(list(range(0, len(self.data), 10)))\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        w = self.create_widget(self.widget.__class__, stored_settings=settings)\n\n        self.send_signal(self.widget.Inputs.data, self.data, widget=w)\n        self.assertTrue(\n            self.signal_manager.wait_for_finished(w, timeout),\n            f\"Did not finish in the specified {timeout}ms timeout\"\n        )\n\n        self.assertEqual(np.sum(w.graph.selection), 15)\n        np.testing.assert_equal(self.widget.graph.selection, w.graph.selection)\n\n    def test_send_report(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Test report \"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.report_button.click()\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.report_button.click()\n\n    def test_hidden_effective_variables(self, timeout=DEFAULT_TIMEOUT):\n        hidden_var1 = ContinuousVariable(\"c1\")\n        hidden_var1.attributes[\"hidden\"] = True\n        hidden_var2 = ContinuousVariable(\"c2\")\n        hidden_var2.attributes[\"hidden\"] = True\n        class_vars = [DiscreteVariable(\"cls\", values=(\"a\", \"b\"))]\n        table = Table(Domain([hidden_var1, hidden_var2], class_vars),\n                      np.array([[0., 1.], [2., 3.]]),\n                      np.array([[0.], [1.]]))\n        self.send_signal(self.widget.Inputs.data, table)\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data, table)\n\n    def test_in_out_summary(self, timeout=DEFAULT_TIMEOUT):\n        info = self.widget.info\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertIn(info._StateInfo__input_summary.details,\n                      [\"\", \"No data on input\"])\n        self.assertIn(info._StateInfo__output_summary.details,\n                      [\"\", \"No data on output\"])\n\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertTrue(\n            self.signal_manager.wait_for_finished(self.widget, timeout),\n            f\"Did not finish in the specified {timeout}ms timeout\"\n        )\n        ind = self._select_data()\n        self.assertEqual(info._StateInfo__input_summary.brief,\n                         str(len(self.data)))\n        self.assertEqual(info._StateInfo__output_summary.brief, str(len(ind)))\n        self.assertGreater(info._StateInfo__input_summary.details, \"\")\n        self.assertGreater(info._StateInfo__output_summary.details, \"\")\n        self.assertNotIn(info._StateInfo__input_summary.details,\n                         [\"\", \"No data on input\"])\n        self.assertNotIn(info._StateInfo__output_summary.details,\n                         [\"\", \"No data on output\"])\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertIn(info._StateInfo__input_summary.details,\n                      [\"\", \"No data on input\"])\n        self.assertIn(info._StateInfo__output_summary.details,\n                      [\"\", \"No data on output\"])\n\n    def test_visual_settings(self, timeout=DEFAULT_TIMEOUT):\n        graph = self.widget.graph\n        font = QFont()\n        font.setItalic(True)\n        font.setFamily(\"Helvetica\")\n\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.wait_until_finished(timeout=timeout)\n\n        key, value = (\"Fonts\", \"Font family\", \"Font family\"), \"Helvetica\"\n        self.widget.set_visual_settings(key, value)\n\n        key, value = (\"Fonts\", \"Title\", \"Font size\"), 20\n        self.widget.set_visual_settings(key, value)\n        key, value = (\"Fonts\", \"Title\", \"Italic\"), True\n        self.widget.set_visual_settings(key, value)\n        font.setPointSize(20)\n        self.assertFontEqual(graph.parameter_setter.title_item.item.font(), font)\n\n        key, value = (\"Fonts\", \"Label\", \"Font size\"), 10\n        self.widget.set_visual_settings(key, value)\n        key, value = (\"Fonts\", \"Label\", \"Italic\"), True\n        self.widget.set_visual_settings(key, value)\n        simulate.combobox_activate_item(self.widget.controls.attr_label,\n                                        self.data.domain[0].name)\n        font.setPointSize(10)\n        self.assertFontEqual(graph.labels[0].textItem.font(), font)\n\n        key, value = (\"Fonts\", \"Categorical legend\", \"Font size\"), 14\n        self.widget.set_visual_settings(key, value)\n        key, value = (\"Fonts\", \"Categorical legend\", \"Italic\"), True\n        self.widget.set_visual_settings(key, value)\n        font.setPointSize(14)\n        legend_item = list(graph.parameter_setter.cat_legend_items)[0]\n        self.assertFontEqual(legend_item[1].item.font(), font)\n\n        key, value = (\"Fonts\", \"Numerical legend\", \"Font size\"), 12\n        self.widget.set_visual_settings(key, value)\n        key, value = (\"Fonts\", \"Numerical legend\", \"Italic\"), True\n        self.widget.set_visual_settings(key, value)\n        simulate.combobox_activate_item(self.widget.controls.attr_color,\n                                        self.data.domain[0].name)\n        variables = self.data.domain.variables + self.data.domain.metas\n        discrete_var = next(\n            (x for x in variables if isinstance(x, DiscreteVariable)), None\n        )\n        if discrete_var:\n            # activate item only when discrete variable available\n            simulate.combobox_activate_item(\n                self.widget.controls.attr_shape, discrete_var.name\n            )\n        font.setPointSize(12)\n        self.assertFontEqual(graph.parameter_setter.num_legend.items[0][0].font, font)\n\n        key, value = (\"Annotations\", \"Title\", \"Title\"), \"Foo\"\n        self.widget.set_visual_settings(key, value)\n        self.assertEqual(graph.parameter_setter.title_item.item.toPlainText(), \"Foo\")\n        self.assertEqual(graph.parameter_setter.title_item.text, \"Foo\")\n\n    def assertFontEqual(self, font1, font2):\n        self.assertEqual(font1.family(), font2.family())\n        self.assertEqual(font1.pointSize(), font2.pointSize())\n        self.assertEqual(font1.italic(), font2.italic())\n\n\nclass AnchorProjectionWidgetTestMixin(ProjectionWidgetTestMixin):\n    def test_embedding_missing_values(self):\n        table = Table(\"heart_disease\")\n        table.X[0] = np.nan\n        self.send_signal(self.widget.Inputs.data, table)\n        self.assertFalse(np.all(self.widget.valid_data))\n        output = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        embedding_mask = np.all(np.isnan(output.metas[:, :2]), axis=1)\n        np.testing.assert_array_equal(~embedding_mask, self.widget.valid_data)\n        # reload\n        self.send_signal(self.widget.Inputs.data, table)\n\n    def test_sparse_data(self, timeout=DEFAULT_TIMEOUT):\n        table = Table(\"iris\")\n        table.X = sp.csr_matrix(table.X)\n        self.assertTrue(sp.issparse(table.X))\n        self.send_signal(self.widget.Inputs.data, table)\n        self.assertTrue(self.widget.Error.sparse_data.is_shown())\n        self.send_signal(self.widget.Inputs.data_subset, table[::30])\n        self.assertEqual(len(self.widget.subset_data), 5)\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Error.sparse_data.is_shown())\n\n    def test_manual_move(self):\n        data = self.data.copy()\n        data[1, 0] = np.nan\n        nvalid, nsample = len(self.data) - 1, self.widget.SAMPLE_SIZE\n        self.send_signal(self.widget.Inputs.data, data)\n        self.widget.graph.select_by_indices(list(range(0, len(data), 10)))\n\n        # remember state\n        selection = self.widget.graph.selection.copy()\n\n        # simulate manual move\n        self.widget._manual_move_start()\n        self.widget._manual_move(0, 1, 1)\n        self.assertEqual(len(self.widget.graph.scatterplot_item.data), nsample)\n        self.widget._manual_move_finish(0, 1, 2)\n\n        # check new state\n        self.assertEqual(len(self.widget.graph.scatterplot_item.data), nvalid)\n        np.testing.assert_equal(self.widget.graph.selection, selection)\n\n    def test_visual_settings(self, timeout=DEFAULT_TIMEOUT):\n        super().test_visual_settings(timeout)\n\n        graph = self.widget.graph\n        font = QFont()\n        font.setItalic(True)\n        font.setFamily(\"Helvetica\")\n\n        key, value = (\"Fonts\", \"Anchor\", \"Font size\"), 10\n        self.widget.set_visual_settings(key, value)\n        key, value = (\"Fonts\", \"Anchor\", \"Italic\"), True\n        self.widget.set_visual_settings(key, value)\n        font.setPointSize(10)\n        for item in graph.anchor_items:\n            if isinstance(item, AnchorItem):\n                item = item._label\n            self.assertFontEqual(item.textItem.font(), font)\n\n\nclass datasets:\n    @staticmethod\n    def path(filename):\n        dirname = os.path.join(os.path.dirname(__file__), \"datasets\")\n        return os.path.join(dirname, filename)\n\n    @classmethod\n    def missing_data_1(cls):\n        \"\"\"\n        Dataset with 3 continuous features (X{1,2,3}) where all the columns\n        and rows contain at least one NaN value.\n\n        One discrete class D with NaN values\n        Mixed continuous/discrete/string metas ({X,D,S}M)\n\n        Returns\n        -------\n        data : Orange.data.Table\n        \"\"\"\n        return Table(cls.path(\"missing_data_1.tab\"))\n\n    @classmethod\n    def missing_data_2(cls):\n        \"\"\"\n        Dataset with 3 continuous features (X{1,2,3}) where all the columns\n        and rows contain at least one NaN value and X1, X2 are constant.\n\n        One discrete constant class D with NaN values.\n        Mixed continuous/discrete/string class metas ({X,D,S}M)\n\n        Returns\n        -------\n        data : Orange.data.Table\n        \"\"\"\n        return Table(cls.path(\"missing_data_2.tab\"))\n\n    @classmethod\n    def missing_data_3(cls):\n        \"\"\"\n        Dataset with 3 discrete features D{1,2,3} where all the columns and\n        rows contain at least one NaN value\n\n        One discrete class D with NaN values\n        Mixes continuous/discrete/string metas ({X,D,S}M)\n\n        Returns\n        -------\n        data : Orange.data.Table\n        \"\"\"\n        return Table(cls.path(\"missing_data_3.tab\"))\n\n    @classmethod\n    def data_one_column_vals(cls, value=np.nan):\n        \"\"\"\n        Dataset with two continuous features and one discrete. One continuous\n        columns has custom set values (default nan).\n\n        Returns\n        -------\n        data : Orange.data.Table\n        \"\"\"\n        table = Table.from_list(\n            Domain(\n                [ContinuousVariable(\"a\"),\n                 ContinuousVariable(\"b\"),\n                 DiscreteVariable(\"c\", values=(\"y\", \"n\"))]\n            ),\n            list(zip(\n                [42.48, 16.84, 15.23, 23.8],\n                [\"\", \"\", \"\", \"\"],\n                \"ynyn\"\n            )))\n        table[:, 1] = value\n        return table\n\n    @classmethod\n    def data_one_column_nans(cls):\n        \"\"\"\n        Dataset with two continuous features and one discrete. One continuous\n        columns has missing values (NaN).\n\n        Returns\n        -------\n        data : Orange.data.Table\n        \"\"\"\n        return cls.data_one_column_vals(value=np.nan)\n\n    @classmethod\n    def data_one_column_infs(cls):\n        return cls.data_one_column_vals(value=np.inf)\n\n    @classmethod\n    def datasets(cls):\n        \"\"\"\n        Yields multiple datasets.\n\n        Returns\n        -------\n        data : Generator of Orange.data.Table\n        \"\"\"\n        ds_cls = Table(cls.path(\"testing_dataset_cls\"))\n        ds_reg = Table(cls.path(\"testing_dataset_reg\"))\n        for ds in (ds_cls, ds_reg):\n            d, a = ds.domain, ds.domain.attributes\n            for i in range(0, len(a), 2):\n                yield ds.transform(Domain(a[i: i + 2], d.class_vars, d.metas))\n            yield ds.transform(Domain(a[:2] + a[8: 10], d.class_vars, d.metas))\n        yield cls.missing_data_1()\n        yield cls.missing_data_2()\n        yield cls.missing_data_3()\n        yield cls.data_one_column_nans()\n        yield ds_cls\n        yield ds_reg\n\n\n@contextmanager\ndef open_widget_classes():\n    with patch.object(OWWidget, \"__init_subclass__\"):\n        yield\n",
            "new_file_content": "# pylint: disable=protected-access,unused-import\nfrom contextlib import contextmanager\nimport os\nimport pickle\nfrom unittest.mock import Mock, patch\n\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom AnyQt.QtGui import QFont, QTextDocumentFragment\nfrom AnyQt.QtCore import QRectF, QPointF\nfrom AnyQt.QtTest import QSignalSpy\nfrom AnyQt.QtWidgets import (\n    QComboBox, QSpinBox, QDoubleSpinBox, QSlider\n)\n\nfrom orangewidget.widget import StateInfo\nfrom orangewidget.tests.base import (\n    GuiTest, WidgetTest as WidgetTestBase, DummySignalManager, DEFAULT_TIMEOUT\n)\nfrom Orange.base import SklModel, Model\nfrom Orange.classification.base_classification import (\n    LearnerClassification, ModelClassification\n)\nfrom Orange.data import (\n    Table, Domain, DiscreteVariable, ContinuousVariable, Variable\n)\nfrom Orange.modelling import Fitter\nfrom Orange.preprocess import RemoveNaNColumns, Randomize, Continuize\nfrom Orange.preprocess.preprocess import PreprocessorList\nfrom Orange.regression.base_regression import (\n    LearnerRegression, ModelRegression\n)\nfrom Orange.widgets.tests.utils import simulate\nfrom Orange.widgets.utils.annotated_data import (\n    ANNOTATED_DATA_FEATURE_NAME, ANNOTATED_DATA_SIGNAL_NAME\n)\nfrom Orange.widgets.utils.owlearnerwidget import OWBaseLearner\nfrom Orange.widgets.visualize.utils.plotutils import AnchorItem\nfrom Orange.widgets.widget import OWWidget\n\n\nclass WidgetTest(WidgetTestBase):\n    def assert_table_equal(self, table1, table2):\n        if table1 is None or table2 is None:\n            self.assertIs(table1, table2)\n            return\n        self.assert_domain_equal(table1.domain, table2.domain)\n        np.testing.assert_array_equal(table1.X, table2.X)\n        np.testing.assert_array_equal(table1.Y, table2.Y)\n        np.testing.assert_array_equal(table1.metas, table2.metas)\n\n    def assert_domain_equal(self, domain1, domain2):\n        \"\"\"\n        Test domains for equality.\n\n        Unlike in domain1 == domain2 uses `Variable.__eq__`, which in case of\n        DiscreteVariable ignores `values`, this method also checks that both\n        domain have equal `values`.\n        \"\"\"\n        for var1, var2 in zip(domain1.variables + domain1.metas,\n                              domain2.variables + domain2.metas):\n            self.assertEqual(type(var1), type(var2))\n            self.assertEqual(var1.name, var2.name)\n            if var1.is_discrete:\n                self.assertEqual(var1.values, var2.values)\n\n\nclass TestWidgetTest(WidgetTest):\n    \"\"\"Meta tests for widget test helpers\"\"\"\n\n    def test_process_events_handles_timeouts(self):\n        with self.assertRaises(TimeoutError):\n            self.process_events(until=lambda: False, timeout=0)\n\n    def test_minimum_size(self):\n        return  # skip this test\n\n\nclass BaseParameterMapping:\n    \"\"\"Base class for mapping between gui components and learner's parameters\n    when testing learner widgets.\n\n    Parameters\n    ----------\n    name : str\n        Name of learner's parameter.\n\n    gui_element : QWidget\n        Gui component who's corresponding parameter is to be tested.\n\n    values: list\n        List of values to be tested.\n\n    getter: function\n        It gets component's value.\n\n    setter: function\n        It sets component's value.\n    \"\"\"\n\n    def __init__(self, name, gui_element, values, getter, setter,\n                 problem_type=\"both\"):\n        self.name = name\n        self.gui_element = gui_element\n        self.values = values\n        self.get_value = getter\n        self.set_value = setter\n        self.problem_type = problem_type\n\n    def __str__(self):\n        if self.problem_type == \"both\":\n            return self.name\n        else:\n            return \"%s (%s)\" % (self.name, self.problem_type)\n\n\nclass DefaultParameterMapping(BaseParameterMapping):\n    \"\"\"Class for mapping between gui components and learner's parameters\n    when testing unchecked properties and therefore default parameters\n    should be used.\n\n    Parameters\n    ----------\n    name : str\n        Name of learner's parameter.\n\n    default_value: str, int,\n        Value that should be used by default.\n    \"\"\"\n\n    def __init__(self, name, default_value):\n        super().__init__(name, None, [default_value],\n                         lambda: default_value, lambda x: None)\n\n\nclass ParameterMapping(BaseParameterMapping):\n    \"\"\"Class for mapping between gui components and learner parameters\n    when testing learner widgets\n\n    Parameters\n    ----------\n    name : str\n        Name of learner's parameter.\n\n    gui_element : QWidget\n        Gui component who's corresponding parameter is to be tested.\n\n    values: list, mandatory for ComboBox, optional otherwise\n        List of values to be tested. When None, it is set according to\n        component's type.\n\n    getter: function, optional\n        It gets component's value. When None, it is set according to\n        component's type.\n\n    setter: function, optional\n        It sets component's value. When None, it is set according to\n        component's type.\n    \"\"\"\n\n    def __init__(self, name, gui_element, values=None,\n                 getter=None, setter=None, **kwargs):\n        super().__init__(\n            name, gui_element,\n            values or self._default_values(gui_element),\n            getter or self._default_get_value(gui_element, values),\n            setter or self._default_set_value(gui_element, values),\n            **kwargs)\n\n    @staticmethod\n    def get_gui_element(widget, attribute):\n        return widget.controlled_attributes[attribute][0].control\n\n    @classmethod\n    def from_attribute(cls, widget, attribute, parameter=None):\n        return cls(parameter or attribute, cls.get_gui_element(widget, attribute))\n\n    @staticmethod\n    def _default_values(gui_element):\n        if isinstance(gui_element, (QSpinBox, QDoubleSpinBox, QSlider)):\n            return [gui_element.minimum(), gui_element.maximum()]\n        else:\n            raise TypeError(\"{} is not supported\".format(gui_element))\n\n    @staticmethod\n    def _default_get_value(gui_element, values):\n        if isinstance(gui_element, (QSpinBox, QDoubleSpinBox, QSlider)):\n            return gui_element.value\n        elif isinstance(gui_element, QComboBox):\n            return lambda: values[gui_element.currentIndex()]\n        else:\n            raise TypeError(\"{} is not supported\".format(gui_element))\n\n    @staticmethod\n    def _default_set_value(gui_element, values):\n        if isinstance(gui_element, (QSpinBox, QDoubleSpinBox, QSlider)):\n            return lambda val: gui_element.setValue(val)\n        elif isinstance(gui_element, QComboBox):\n            def fun(val):\n                value = values.index(val)\n                gui_element.activated.emit(value)\n                gui_element.setCurrentIndex(value)\n\n            return fun\n        else:\n            raise TypeError(\"{} is not supported\".format(gui_element))\n\n\nclass WidgetLearnerTestMixin:\n    \"\"\"Base class for widget learner tests.\n\n    Contains init method to set up testing parameters and test methods.\n\n    All widget learner tests should extend it (beside extending WidgetTest\n    class as well). Learners with extra parameters, which can be set on the\n    widget, should override self.parameters list in the setUp method. The\n    list should contain mapping: learner parameter - gui component.\n    \"\"\"\n\n    widget = None  # type: OWBaseLearner\n\n    def init(self):\n        cls_ds = Table(datasets.path(\"testing_dataset_cls\"))\n        reg_ds = Table(datasets.path(\"testing_dataset_reg\"))\n\n        if issubclass(self.widget.LEARNER, Fitter):\n            self.data = cls_ds\n            self.valid_datasets = (cls_ds, reg_ds)\n            self.inadequate_dataset = ()\n            self.learner_class = Fitter\n            self.model_class = Model\n            self.model_name = 'Model'\n        elif issubclass(self.widget.LEARNER, LearnerClassification):\n            self.data = cls_ds\n            self.valid_datasets = (cls_ds,)\n            self.inadequate_dataset = (reg_ds,)\n            self.learner_class = LearnerClassification\n            self.model_class = ModelClassification\n            self.model_name = 'Classifier'\n        else:\n            self.data = reg_ds\n            self.valid_datasets = (reg_ds,)\n            self.inadequate_dataset = (cls_ds,)\n            self.learner_class = LearnerRegression\n            self.model_class = ModelRegression\n            self.model_name = 'Predictor'\n\n        self.parameters = []\n\n    def test_has_unconditional_apply(self):\n        self.assertTrue(hasattr(self.widget, \"unconditional_apply\"))\n\n    def test_input_data(self):\n        \"\"\"Check widget's data with data on the input\"\"\"\n        self.assertEqual(self.widget.data, None)\n        self.send_signal(\"Data\", self.data)\n        self.assertEqual(self.widget.data, self.data)\n        self.wait_until_stop_blocking()\n\n    def test_input_data_disconnect(self):\n        \"\"\"Check widget's data and model after disconnecting data from input\"\"\"\n        self.send_signal(\"Data\", self.data)\n        self.assertEqual(self.widget.data, self.data)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.send_signal(\"Data\", None)\n        self.wait_until_stop_blocking()\n        self.assertEqual(self.widget.data, None)\n        self.assertIsNone(self.get_output(self.widget.Outputs.model))\n\n    def test_input_data_learner_adequacy(self):\n        \"\"\"Check if error message is shown with inadequate data on input\"\"\"\n        for inadequate in self.inadequate_dataset:\n            self.send_signal(\"Data\", inadequate)\n            self.widget.apply_button.button.click()\n            self.wait_until_stop_blocking()\n            self.assertTrue(self.widget.Error.data_error.is_shown())\n        for valid in self.valid_datasets:\n            self.send_signal(\"Data\", valid)\n            self.wait_until_stop_blocking()\n            self.assertFalse(self.widget.Error.data_error.is_shown())\n\n    def test_input_preprocessor(self):\n        \"\"\"Check learner's preprocessors with an extra pp on input\"\"\"\n        randomize = Randomize()\n        self.send_signal(\"Preprocessor\", randomize)\n        self.assertEqual(\n            randomize, self.widget.preprocessors,\n            'Preprocessor not added to widget preprocessors')\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertEqual(\n            (randomize,), self.widget.learner.preprocessors,\n            'Preprocessors were not passed to the learner')\n\n    def test_input_preprocessors(self):\n        \"\"\"Check multiple preprocessors on input\"\"\"\n        pp_list = PreprocessorList([Randomize(), RemoveNaNColumns()])\n        self.send_signal(\"Preprocessor\", pp_list)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertEqual(\n            (pp_list,), self.widget.learner.preprocessors,\n            '`PreprocessorList` was not added to preprocessors')\n\n    def test_input_preprocessor_disconnect(self):\n        \"\"\"Check learner's preprocessors after disconnecting pp from input\"\"\"\n        randomize = Randomize()\n        self.send_signal(\"Preprocessor\", randomize)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertEqual(randomize, self.widget.preprocessors)\n\n        self.send_signal(\"Preprocessor\", None)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertIsNone(self.widget.preprocessors,\n                          'Preprocessors not removed on disconnect.')\n\n    def test_output_learner(self):\n        \"\"\"Check if learner is on output after apply\"\"\"\n        initial = self.get_output(\"Learner\")\n        self.assertIsNotNone(initial, \"Does not initialize the learner output\")\n        self.widget.apply_button.button.click()\n        newlearner = self.get_output(\"Learner\")\n        self.assertIsNot(initial, newlearner,\n                         \"Does not send a new learner instance on `Apply`.\")\n        self.assertIsNotNone(newlearner)\n        self.assertIsInstance(newlearner, self.widget.LEARNER)\n\n    def test_output_model(self):\n        \"\"\"Check if model is on output after sending data and apply\"\"\"\n        self.assertIsNone(self.get_output(self.widget.Outputs.model))\n        self.widget.apply_button.button.click()\n        self.assertIsNone(self.get_output(self.widget.Outputs.model))\n        self.send_signal('Data', self.data)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        model = self.get_output(self.widget.Outputs.model)\n        self.assertIsNotNone(model)\n        self.assertIsInstance(model, self.widget.LEARNER.__returns__)\n        self.assertIsInstance(model, self.model_class)\n\n    def test_output_learner_name(self):\n        \"\"\"Check if learner's name properly changes\"\"\"\n        new_name = \"Learner Name\"\n        self.widget.apply_button.button.click()\n        self.assertEqual(self.widget.learner.name,\n                         self.widget.name_line_edit.text()\n                         or self.widget.name_line_edit.placeholderText())\n        self.widget.name_line_edit.setText(new_name)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertEqual(self.get_output(\"Learner\").name, new_name)\n\n    def test_output_model_name(self):\n        \"\"\"Check if model's name properly changes\"\"\"\n        new_name = \"Model Name\"\n        self.widget.name_line_edit.setText(new_name)\n        self.send_signal(\"Data\", self.data)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertEqual(self.get_output(self.widget.Outputs.model).name, new_name)\n\n    def test_output_model_picklable(self):\n        \"\"\"Check if model can be pickled\"\"\"\n        self.send_signal(\"Data\", self.data)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        model = self.get_output(self.widget.Outputs.model)\n        pickle.dumps(model)\n\n    @staticmethod\n    def _get_param_value(learner, param):\n        if isinstance(learner, Fitter):\n            # Both is just a was to indicate to the tests, fitters don't\n            # actually support this\n            if param.problem_type == \"both\":\n                problem_type = learner.CLASSIFICATION\n            else:\n                problem_type = param.problem_type\n            return learner.get_params(problem_type).get(param.name)\n        else:\n            return learner.params.get(param.name)\n\n    def test_parameters_default(self):\n        \"\"\"Check if learner's parameters are set to default (widget's) values\n        \"\"\"\n        for dataset in self.valid_datasets:\n            self.send_signal(\"Data\", dataset)\n            self.widget.apply_button.button.click()\n            self.wait_until_stop_blocking()\n            for parameter in self.parameters:\n                # Skip if the param isn't used for the given data type\n                if self._should_check_parameter(parameter, dataset):\n                    self.assertEqual(\n                        self._get_param_value(self.widget.learner, parameter),\n                        parameter.get_value())\n\n    def test_parameters(self):\n        \"\"\"Check learner and model for various values of all parameters\"\"\"\n        # Test params on every valid dataset, since some attributes may apply\n        # to only certain problem types\n        for dataset in self.valid_datasets:\n            self.send_signal(\"Data\", dataset)\n            self.wait_until_stop_blocking()\n\n            for parameter in self.parameters:\n                # Skip if the param isn't used for the given data type\n                if not self._should_check_parameter(parameter, dataset):\n                    continue\n\n                assert isinstance(parameter, BaseParameterMapping)\n\n                for value in parameter.values:\n                    parameter.set_value(value)\n                    self.widget.apply_button.button.click()\n                    self.wait_until_stop_blocking()\n                    param = self._get_param_value(self.widget.learner, parameter)\n                    self.assertEqual(\n                        param, parameter.get_value(),\n                        \"Mismatching setting for parameter '%s'\" % parameter)\n                    self.assertEqual(\n                        param, value,\n                        \"Mismatching setting for parameter '%s'\" % parameter)\n                    param = self._get_param_value(self.get_output(\"Learner\"), parameter)\n                    self.assertEqual(\n                        param, value,\n                        \"Mismatching setting for parameter '%s'\" % parameter)\n\n                    if issubclass(self.widget.LEARNER, SklModel):\n                        model = self.get_output(self.widget.Outputs.model)\n                        if model is not None:\n                            self.assertEqual(self._get_param_value(model, parameter), value)\n                            self.assertFalse(self.widget.Error.active)\n                        else:\n                            self.assertTrue(self.widget.Error.active)\n\n    def test_params_trigger_settings_changed(self):\n        \"\"\"Check that the learner gets updated whenever a param is changed.\"\"\"\n        for dataset in self.valid_datasets:\n            self.send_signal(\"Data\", dataset)\n            self.wait_until_stop_blocking()\n\n            for parameter in self.parameters:\n                # Skip if the param isn't used for the given data type\n                if not self._should_check_parameter(parameter, dataset):\n                    continue\n\n                assert isinstance(parameter, BaseParameterMapping)\n                # Set the mock here so we can include the param name in the\n                # error message, so if any test fails, we see where\n                # We mock `apply` and not `settings_changed` since that's\n                # sometimes connected with Qt signals, which are not directly\n                # called\n                self.widget.apply = Mock(name=\"apply(%s)\" % parameter)\n                # Since the settings only get updated when the value actually\n                # changes, find a value that isn't the same as the current\n                # value and try with that\n                new_value = [x for x in parameter.values\n                             if x != parameter.get_value()][0]\n                parameter.set_value(new_value)\n                # wait for asynchronous calls\n                self.process_events(lambda: self.widget.apply.call_args is not None)\n                self.widget.apply.assert_called_once()\n\n    @staticmethod\n    def _should_check_parameter(parameter, data):\n        \"\"\"Should the param be passed into the learner given the data\"\"\"\n        return ((parameter.problem_type == \"classification\" and\n                 data.domain.has_discrete_class) or\n                (parameter.problem_type == \"regression\" and\n                 data.domain.has_continuous_class) or\n                (parameter.problem_type == \"both\"))\n\n    def test_send_report(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Test report\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.report_button.click()\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.report_button.click()\n\n\nclass WidgetOutputsTestMixin:\n    \"\"\"Class for widget's outputs testing.\n\n    Contains init method to set up testing parameters and a test method, which\n    checks Selected Data and (Annotated) Data outputs.\n\n    Since widgets have different ways of selecting data instances, _select_data\n    method should be implemented when subclassed. The method should assign\n    value to selected_indices parameter.\n\n    If output's expected domain differs from input's domain, parameter\n    same_input_output_domain should be set to False.\n\n    If Selected Data and Data domains differ, override method\n    _compare_selected_annotated_domains.\n    \"\"\"\n\n    def init(self, same_table_attributes=True, output_all_on_no_selection=False):\n        self.data = Table(\"iris\")\n        self.same_input_output_domain = True\n        self.same_table_attributes = same_table_attributes\n        self.output_all_on_no_selection = output_all_on_no_selection\n\n    def test_outputs(self, timeout=DEFAULT_TIMEOUT):\n        self.send_signal(self.signal_name, self.signal_data)\n\n        self.wait_until_finished(timeout=timeout)\n\n        # check selected data output\n        output = self.get_output(\"Selected Data\")\n        if self.output_all_on_no_selection:\n            self.assertEqual(output, self.signal_data)\n        else:\n            self.assertIsNone(output)\n\n        # check annotated data output\n        feature_name = ANNOTATED_DATA_FEATURE_NAME\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(0, np.sum([i[feature_name] for i in annotated]))\n\n        # select data instances\n        selected_indices = self._select_data()\n\n        # check selected data output\n        selected = self.get_output(\"Selected Data\")\n        n_sel, n_attr = len(selected), len(self.data.domain.attributes)\n        self.assertGreater(n_sel, 0)\n        self.assertEqual(selected.domain == self.data.domain,\n                         self.same_input_output_domain)\n        np.testing.assert_array_equal(selected.X[:, :n_attr],\n                                      self.data.X[selected_indices])\n        if self.same_table_attributes:\n            self.assertEqual(selected.attributes, self.data.attributes)\n\n        # check annotated data output\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(n_sel, np.sum([i[feature_name] for i in annotated]))\n        if self.same_table_attributes:\n            self.assertEqual(annotated.attributes, self.data.attributes)\n\n        # compare selected and annotated data domains\n        self._compare_selected_annotated_domains(selected, annotated)\n\n        # check output when data is removed\n        self.send_signal(self.signal_name, None)\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n        self.assertIsNone(self.get_output(ANNOTATED_DATA_SIGNAL_NAME))\n\n    def _select_data(self):\n        raise NotImplementedError(\"Subclasses should implement select_data\")\n\n    def _compare_selected_annotated_domains(self, selected, annotated):\n        selected_vars = selected.domain.variables + selected.domain.metas\n        annotated_vars = annotated.domain.variables + annotated.domain.metas\n        self.assertLess(set(selected_vars), set(annotated_vars))\n\n\nclass ProjectionWidgetTestMixin:\n    \"\"\"Class for projection widget testing\"\"\"\n\n    def init(self):\n        self.data = Table(\"iris\")\n\n    def _select_data(self):\n        rect = QRectF(QPointF(-20, -20), QPointF(20, 20))\n        self.widget.graph.select_by_rectangle(rect)\n        return self.widget.graph.get_selection()\n\n    def _compare_selected_annotated_domains(self, selected, annotated):\n        selected_vars = selected.domain.variables\n        annotated_vars = annotated.domain.variables\n        self.assertLessEqual(set(selected_vars), set(annotated_vars))\n\n    def test_setup_graph(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Plot should exist after data has been sent in order to be\n        properly set/updated\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assertTrue(\n            self.signal_manager.wait_for_finished(self.widget, timeout),\n            f\"Did not finish in the specified {timeout}ms timeout\"\n        )\n\n        self.assertIsNotNone(self.widget.graph.scatterplot_item)\n\n    def test_default_attrs(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Check default values for 'Color', 'Shape', 'Size' and 'Label'\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertIs(self.widget.attr_color, self.data.domain.class_var)\n        self.assertIsNone(self.widget.attr_label)\n        self.assertIsNone(self.widget.attr_shape)\n        self.assertIsNone(self.widget.attr_size)\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertIsNone(self.widget.attr_color)\n\n    def test_attr_models(self):\n        \"\"\"Check possible values for 'Color', 'Shape', 'Size' and 'Label'\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        controls = self.widget.controls\n        self.assertEqual(len(controls.attr_color.model()), 8)\n        self.assertEqual(len(controls.attr_shape.model()), 3)\n        self.assertTrue(5 < len(controls.attr_size.model()) < 8)\n        self.assertEqual(len(controls.attr_label.model()), 8)\n\n        # color and label should contain all variables\n        # size should contain only continuous variables\n        # shape should contain only discrete variables\n        for var in self.data.domain.variables + self.data.domain.metas:\n            self.assertIn(var, controls.attr_color.model())\n            self.assertIn(var, controls.attr_label.model())\n            if var.is_continuous:\n                self.assertIn(var, controls.attr_size.model())\n                self.assertNotIn(var, controls.attr_shape.model())\n            if var.is_discrete:\n                self.assertNotIn(var, controls.attr_size.model())\n                self.assertIn(var, controls.attr_shape.model())\n\n    def test_attr_label_metas(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Set 'Label' from string meta attribute\"\"\"\n        cont = Continuize(multinomial_treatment=Continuize.AsOrdinal)\n        data = cont(Table(\"zoo\"))\n        self.send_signal(self.widget.Inputs.data, data)\n        self.wait_until_finished(timeout=timeout)\n        simulate.combobox_activate_item(self.widget.controls.attr_label,\n                                        data.domain[-1].name)\n\n    def test_handle_primitive_metas(self):\n        \"\"\"Set 'Color' from continuous meta attribute\"\"\"\n        d, attrs = self.data.domain, self.data.domain.attributes\n        data = self.data.transform(Domain(attrs[:2], d.class_vars, attrs[2:]))\n        self.send_signal(self.widget.Inputs.data, data)\n        simulate.combobox_activate_item(self.widget.controls.attr_color,\n                                        data.domain.metas[0].name)\n\n    def test_datasets(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Test widget for datasets with missing values and constant features\"\"\"\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n            self.wait_until_finished(timeout=timeout)\n\n    def test_none_data(self):\n        \"\"\"Test widget for empty dataset\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data[:0])\n\n    def test_plot_once(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Test if data is plotted only once but committed on every input change\"\"\"\n        table = Table(\"heart_disease\")\n        self.widget.setup_plot = Mock()\n        self.widget.commit = self.widget.unconditional_commit = Mock()\n        self.send_signal(self.widget.Inputs.data, table)\n        self.widget.setup_plot.assert_called_once()\n        self.widget.commit.assert_called_once()\n\n        self.wait_until_finished(timeout=timeout)\n        self.widget.setup_plot.assert_called_once()\n        self.widget.commit.assert_called_once()\n\n        self.widget.commit.reset_mock()\n        self.send_signal(self.widget.Inputs.data_subset, table[::10])\n        self.widget.setup_plot.assert_called_once()\n        self.widget.commit.assert_called_once()\n\n    def test_subset_data_color(self, timeout=DEFAULT_TIMEOUT):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertTrue(\n            self.signal_manager.wait_for_finished(self.widget, timeout),\n            f\"Did not finish in the specified {timeout}ms timeout\"\n        )\n        self.send_signal(self.widget.Inputs.data_subset, self.data[:10])\n        subset = [brush.color().name() == \"#46befa\" for brush in\n                  self.widget.graph.scatterplot_item.data['brush'][:10]]\n        other = [brush.color().name() == \"#000000\" for brush in\n                 self.widget.graph.scatterplot_item.data['brush'][10:]]\n        self.assertTrue(all(subset))\n        self.assertTrue(all(other))\n\n    def test_class_density(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Check class density update\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.cb_class_density.click()\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.cb_class_density.click()\n\n    def test_dragging_tooltip(self):\n        \"\"\"Dragging tooltip depends on data being jittered\"\"\"\n        text = QTextDocumentFragment.fromHtml(self.widget.graph.tiptexts[0]).toPlainText()\n        self.send_signal(self.widget.Inputs.data, Table(\"heart_disease\"))\n        self.assertEqual(self.widget.graph.tip_textitem.toPlainText(), text)\n\n    def test_sparse_data(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Test widget for sparse data\"\"\"\n        table = Table(\"iris\").to_sparse()\n        self.assertTrue(sp.issparse(table.X))\n        self.send_signal(self.widget.Inputs.data, table)\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data_subset, table[::30])\n        self.assertEqual(len(self.widget.subset_data), 5)\n\n    def test_invalidated_embedding(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Check if graph has been replotted when sending same data\"\"\"\n        self.widget.graph.update_coordinates = Mock()\n        self.widget.graph.update_point_props = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.wait_until_finished(timeout=timeout)\n\n        self.widget.graph.update_coordinates.assert_called()\n        self.widget.graph.update_point_props.assert_called()\n\n        self.widget.graph.update_coordinates.reset_mock()\n        self.widget.graph.update_point_props.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.wait_until_finished(timeout=timeout)\n\n        self.widget.graph.update_coordinates.assert_not_called()\n        self.widget.graph.update_point_props.assert_called_once()\n\n    def test_saved_selection(self, timeout=DEFAULT_TIMEOUT):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertTrue(\n            self.signal_manager.wait_for_finished(self.widget, timeout),\n            f\"Did not finish in the specified {timeout}ms timeout\"\n        )\n\n        self.widget.graph.select_by_indices(list(range(0, len(self.data), 10)))\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        w = self.create_widget(self.widget.__class__, stored_settings=settings)\n\n        self.send_signal(self.widget.Inputs.data, self.data, widget=w)\n        self.assertTrue(\n            self.signal_manager.wait_for_finished(w, timeout),\n            f\"Did not finish in the specified {timeout}ms timeout\"\n        )\n\n        self.assertEqual(np.sum(w.graph.selection), 15)\n        np.testing.assert_equal(self.widget.graph.selection, w.graph.selection)\n\n    def test_send_report(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Test report \"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.report_button.click()\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.report_button.click()\n\n    def test_hidden_effective_variables(self, timeout=DEFAULT_TIMEOUT):\n        hidden_var1 = ContinuousVariable(\"c1\")\n        hidden_var1.attributes[\"hidden\"] = True\n        hidden_var2 = ContinuousVariable(\"c2\")\n        hidden_var2.attributes[\"hidden\"] = True\n        class_vars = [DiscreteVariable(\"cls\", values=(\"a\", \"b\"))]\n        table = Table(Domain([hidden_var1, hidden_var2], class_vars),\n                      np.array([[0., 1.], [2., 3.]]),\n                      np.array([[0.], [1.]]))\n        self.send_signal(self.widget.Inputs.data, table)\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data, table)\n\n    def test_in_out_summary(self, timeout=DEFAULT_TIMEOUT):\n        info = self.widget.info\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertIn(info._StateInfo__input_summary.details,\n                      [\"\", \"No data on input\"])\n        self.assertIn(info._StateInfo__output_summary.details,\n                      [\"\", \"No data on output\"])\n\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertTrue(\n            self.signal_manager.wait_for_finished(self.widget, timeout),\n            f\"Did not finish in the specified {timeout}ms timeout\"\n        )\n        ind = self._select_data()\n        self.assertEqual(info._StateInfo__input_summary.brief,\n                         str(len(self.data)))\n        self.assertEqual(info._StateInfo__output_summary.brief, str(len(ind)))\n        self.assertGreater(info._StateInfo__input_summary.details, \"\")\n        self.assertGreater(info._StateInfo__output_summary.details, \"\")\n        self.assertNotIn(info._StateInfo__input_summary.details,\n                         [\"\", \"No data on input\"])\n        self.assertNotIn(info._StateInfo__output_summary.details,\n                         [\"\", \"No data on output\"])\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertIn(info._StateInfo__input_summary.details,\n                      [\"\", \"No data on input\"])\n        self.assertIn(info._StateInfo__output_summary.details,\n                      [\"\", \"No data on output\"])\n\n    def test_visual_settings(self, timeout=DEFAULT_TIMEOUT):\n        graph = self.widget.graph\n        font = QFont()\n        font.setItalic(True)\n        font.setFamily(\"Helvetica\")\n\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.wait_until_finished(timeout=timeout)\n\n        key, value = (\"Fonts\", \"Font family\", \"Font family\"), \"Helvetica\"\n        self.widget.set_visual_settings(key, value)\n\n        key, value = (\"Fonts\", \"Title\", \"Font size\"), 20\n        self.widget.set_visual_settings(key, value)\n        key, value = (\"Fonts\", \"Title\", \"Italic\"), True\n        self.widget.set_visual_settings(key, value)\n        font.setPointSize(20)\n        self.assertFontEqual(graph.parameter_setter.title_item.item.font(), font)\n\n        key, value = (\"Fonts\", \"Label\", \"Font size\"), 10\n        self.widget.set_visual_settings(key, value)\n        key, value = (\"Fonts\", \"Label\", \"Italic\"), True\n        self.widget.set_visual_settings(key, value)\n        simulate.combobox_activate_item(self.widget.controls.attr_label,\n                                        self.data.domain[0].name)\n        font.setPointSize(10)\n        self.assertFontEqual(graph.labels[0].textItem.font(), font)\n\n        key, value = (\"Fonts\", \"Categorical legend\", \"Font size\"), 14\n        self.widget.set_visual_settings(key, value)\n        key, value = (\"Fonts\", \"Categorical legend\", \"Italic\"), True\n        self.widget.set_visual_settings(key, value)\n        font.setPointSize(14)\n        legend_item = list(graph.parameter_setter.cat_legend_items)[0]\n        self.assertFontEqual(legend_item[1].item.font(), font)\n\n        key, value = (\"Fonts\", \"Numerical legend\", \"Font size\"), 12\n        self.widget.set_visual_settings(key, value)\n        key, value = (\"Fonts\", \"Numerical legend\", \"Italic\"), True\n        self.widget.set_visual_settings(key, value)\n        simulate.combobox_activate_item(self.widget.controls.attr_color,\n                                        self.data.domain[0].name)\n        variables = self.data.domain.variables + self.data.domain.metas\n        discrete_var = next(\n            (x for x in variables if isinstance(x, DiscreteVariable)), None\n        )\n        if discrete_var:\n            # activate item only when discrete variable available\n            simulate.combobox_activate_item(\n                self.widget.controls.attr_shape, discrete_var.name\n            )\n        font.setPointSize(12)\n        self.assertFontEqual(graph.parameter_setter.num_legend.items[0][0].font, font)\n\n        key, value = (\"Annotations\", \"Title\", \"Title\"), \"Foo\"\n        self.widget.set_visual_settings(key, value)\n        self.assertEqual(graph.parameter_setter.title_item.item.toPlainText(), \"Foo\")\n        self.assertEqual(graph.parameter_setter.title_item.text, \"Foo\")\n\n    def assertFontEqual(self, font1, font2):\n        self.assertEqual(font1.family(), font2.family())\n        self.assertEqual(font1.pointSize(), font2.pointSize())\n        self.assertEqual(font1.italic(), font2.italic())\n\n\nclass AnchorProjectionWidgetTestMixin(ProjectionWidgetTestMixin):\n    def test_embedding_missing_values(self):\n        table = Table(\"heart_disease\")\n        table.X[0] = np.nan\n        self.send_signal(self.widget.Inputs.data, table)\n        self.assertFalse(np.all(self.widget.valid_data))\n        output = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        embedding_mask = np.all(np.isnan(output.metas[:, :2]), axis=1)\n        np.testing.assert_array_equal(~embedding_mask, self.widget.valid_data)\n        # reload\n        self.send_signal(self.widget.Inputs.data, table)\n\n    def test_sparse_data(self, timeout=DEFAULT_TIMEOUT):\n        table = Table(\"iris\")\n        table.X = sp.csr_matrix(table.X)\n        self.assertTrue(sp.issparse(table.X))\n        self.send_signal(self.widget.Inputs.data, table)\n        self.assertTrue(self.widget.Error.sparse_data.is_shown())\n        self.send_signal(self.widget.Inputs.data_subset, table[::30])\n        self.assertEqual(len(self.widget.subset_data), 5)\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Error.sparse_data.is_shown())\n\n    def test_manual_move(self):\n        data = self.data.copy()\n        data[1, 0] = np.nan\n        nvalid, nsample = len(self.data) - 1, self.widget.SAMPLE_SIZE\n        self.send_signal(self.widget.Inputs.data, data)\n        self.widget.graph.select_by_indices(list(range(0, len(data), 10)))\n\n        # remember state\n        selection = self.widget.graph.selection.copy()\n\n        # simulate manual move\n        self.widget._manual_move_start()\n        self.widget._manual_move(0, 1, 1)\n        self.assertEqual(len(self.widget.graph.scatterplot_item.data), nsample)\n        self.widget._manual_move_finish(0, 1, 2)\n\n        # check new state\n        self.assertEqual(len(self.widget.graph.scatterplot_item.data), nvalid)\n        np.testing.assert_equal(self.widget.graph.selection, selection)\n\n    def test_visual_settings(self, timeout=DEFAULT_TIMEOUT):\n        super().test_visual_settings(timeout)\n\n        graph = self.widget.graph\n        font = QFont()\n        font.setItalic(True)\n        font.setFamily(\"Helvetica\")\n\n        key, value = (\"Fonts\", \"Anchor\", \"Font size\"), 10\n        self.widget.set_visual_settings(key, value)\n        key, value = (\"Fonts\", \"Anchor\", \"Italic\"), True\n        self.widget.set_visual_settings(key, value)\n        font.setPointSize(10)\n        for item in graph.anchor_items:\n            if isinstance(item, AnchorItem):\n                item = item._label\n            self.assertFontEqual(item.textItem.font(), font)\n\n\nclass datasets:\n    @staticmethod\n    def path(filename):\n        dirname = os.path.join(os.path.dirname(__file__), \"datasets\")\n        return os.path.join(dirname, filename)\n\n    @classmethod\n    def missing_data_1(cls):\n        \"\"\"\n        Dataset with 3 continuous features (X{1,2,3}) where all the columns\n        and rows contain at least one NaN value.\n\n        One discrete class D with NaN values\n        Mixed continuous/discrete/string metas ({X,D,S}M)\n\n        Returns\n        -------\n        data : Orange.data.Table\n        \"\"\"\n        return Table(cls.path(\"missing_data_1.tab\"))\n\n    @classmethod\n    def missing_data_2(cls):\n        \"\"\"\n        Dataset with 3 continuous features (X{1,2,3}) where all the columns\n        and rows contain at least one NaN value and X1, X2 are constant.\n\n        One discrete constant class D with NaN values.\n        Mixed continuous/discrete/string class metas ({X,D,S}M)\n\n        Returns\n        -------\n        data : Orange.data.Table\n        \"\"\"\n        return Table(cls.path(\"missing_data_2.tab\"))\n\n    @classmethod\n    def missing_data_3(cls):\n        \"\"\"\n        Dataset with 3 discrete features D{1,2,3} where all the columns and\n        rows contain at least one NaN value\n\n        One discrete class D with NaN values\n        Mixes continuous/discrete/string metas ({X,D,S}M)\n\n        Returns\n        -------\n        data : Orange.data.Table\n        \"\"\"\n        return Table(cls.path(\"missing_data_3.tab\"))\n\n    @classmethod\n    def data_one_column_vals(cls, value=np.nan):\n        \"\"\"\n        Dataset with two continuous features and one discrete. One continuous\n        columns has custom set values (default nan).\n\n        Returns\n        -------\n        data : Orange.data.Table\n        \"\"\"\n        table = Table.from_list(\n            Domain(\n                [ContinuousVariable(\"a\"),\n                 ContinuousVariable(\"b\"),\n                 DiscreteVariable(\"c\", values=(\"y\", \"n\"))]\n            ),\n            list(zip(\n                [42.48, 16.84, 15.23, 23.8],\n                [\"\", \"\", \"\", \"\"],\n                \"ynyn\"\n            )))\n        table[:, 1] = value\n        return table\n\n    @classmethod\n    def data_one_column_nans(cls):\n        \"\"\"\n        Dataset with two continuous features and one discrete. One continuous\n        columns has missing values (NaN).\n\n        Returns\n        -------\n        data : Orange.data.Table\n        \"\"\"\n        return cls.data_one_column_vals(value=np.nan)\n\n    @classmethod\n    def data_one_column_infs(cls):\n        return cls.data_one_column_vals(value=np.inf)\n\n    @classmethod\n    def datasets(cls):\n        \"\"\"\n        Yields multiple datasets.\n\n        Returns\n        -------\n        data : Generator of Orange.data.Table\n        \"\"\"\n        ds_cls = Table(cls.path(\"testing_dataset_cls\"))\n        ds_reg = Table(cls.path(\"testing_dataset_reg\"))\n        for ds in (ds_cls, ds_reg):\n            d, a = ds.domain, ds.domain.attributes\n            for i in range(0, len(a), 2):\n                yield ds.transform(Domain(a[i: i + 2], d.class_vars, d.metas))\n            yield ds.transform(Domain(a[:2] + a[8: 10], d.class_vars, d.metas))\n        yield cls.missing_data_1()\n        yield cls.missing_data_2()\n        yield cls.missing_data_3()\n        yield cls.data_one_column_nans()\n        yield ds_cls\n        yield ds_reg\n\n\n@contextmanager\ndef open_widget_classes():\n    with patch.object(OWWidget, \"__init_subclass__\"):\n        yield\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/tests/base.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "fa1a74dee",
                "new_commit_hash": "7075fcb51",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/tests/base.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/tests/base.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 500,
                            "length": 10
                        },
                        "new_range": {
                            "start": 500,
                            "length": 11
                        },
                        "section": "class WidgetOutputsTestMixin:"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "    _compare_selected_annotated_domains.",
                                "type": "context"
                            },
                            {
                                "content": "    \"\"\"",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def init(self, same_table_attributes=True):",
                                "type": "deleted"
                            },
                            {
                                "content": "    def init(self, same_table_attributes=True, output_all_on_no_selection=False):",
                                "type": "added"
                            },
                            {
                                "content": "        self.data = Table(\"iris\")",
                                "type": "context"
                            },
                            {
                                "content": "        self.same_input_output_domain = True",
                                "type": "context"
                            },
                            {
                                "content": "        self.same_table_attributes = same_table_attributes",
                                "type": "context"
                            },
                            {
                                "content": "        self.output_all_on_no_selection = output_all_on_no_selection",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_outputs(self, timeout=DEFAULT_TIMEOUT):",
                                "type": "context"
                            },
                            {
                                "content": "        self.send_signal(self.signal_name, self.signal_data)",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/tests/base.py",
                            "type": "class",
                            "name": "WidgetOutputsTestMixin",
                            "content": "class WidgetOutputsTestMixin:\n    \"\"\"Class for widget's outputs testing.\n\n    Contains init method to set up testing parameters and a test method, which\n    checks Selected Data and (Annotated) Data outputs.\n\n    Since widgets have different ways of selecting data instances, _select_data\n    method should be implemented when subclassed. The method should assign\n    value to selected_indices parameter.\n\n    If output's expected domain differs from input's domain, parameter\n    same_input_output_domain should be set to False.\n\n    If Selected Data and Data domains differ, override method\n    _compare_selected_annotated_domains.\n    \"\"\"\n\n    def init(self, same_table_attributes=True):\n        self.data = Table(\"iris\")\n        self.same_input_output_domain = True\n        self.same_table_attributes = same_table_attributes\n\n    def test_outputs(self, timeout=DEFAULT_TIMEOUT):\n        self.send_signal(self.signal_name, self.signal_data)\n\n        self.wait_until_finished(timeout=timeout)\n\n        # check selected data output\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n\n        # check annotated data output\n        feature_name = ANNOTATED_DATA_FEATURE_NAME\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(0, np.sum([i[feature_name] for i in annotated]))\n\n        # select data instances\n        selected_indices = self._select_data()\n\n        # check selected data output\n        selected = self.get_output(\"Selected Data\")\n        n_sel, n_attr = len(selected), len(self.data.domain.attributes)\n        self.assertGreater(n_sel, 0)\n        self.assertEqual(selected.domain == self.data.domain,\n                         self.same_input_output_domain)\n        np.testing.assert_array_equal(selected.X[:, :n_attr],\n                                      self.data.X[selected_indices])\n        if self.same_table_attributes:\n            self.assertEqual(selected.attributes, self.data.attributes)\n\n        # check annotated data output\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(n_sel, np.sum([i[feature_name] for i in annotated]))\n        if self.same_table_attributes:\n            self.assertEqual(annotated.attributes, self.data.attributes)\n\n        # compare selected and annotated data domains\n        self._compare_selected_annotated_domains(selected, annotated)\n\n        # check output when data is removed\n        self.send_signal(self.signal_name, None)\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n        self.assertIsNone(self.get_output(ANNOTATED_DATA_SIGNAL_NAME))\n\n    def _select_data(self):\n        raise NotImplementedError(\"Subclasses should implement select_data\")\n\n    def _compare_selected_annotated_domains(self, selected, annotated):\n        selected_vars = selected.domain.variables + selected.domain.metas\n        annotated_vars = annotated.domain.variables + annotated.domain.metas\n        self.assertLess(set(selected_vars), set(annotated_vars))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 486,
                            "end_lineno": 555,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/widgets/tests/base.py",
                            "type": "method",
                            "name": "WidgetOutputsTestMixin.init",
                            "content": "class WidgetOutputsTestMixin:\n    \"\"\"Class for widget's outputs testing.\n\n    Contains init method to set up testing parameters and a test method, which\n    checks Selected Data and (Annotated) Data outputs.\n\n    Since widgets have different ways of selecting data instances, _select_data\n    method should be implemented when subclassed. The method should assign\n    value to selected_indices parameter.\n\n    If output's expected domain differs from input's domain, parameter\n    same_input_output_domain should be set to False.\n\n    If Selected Data and Data domains differ, override method\n    _compare_selected_annotated_domains.\n    \"\"\"\n\n    def init(self, same_table_attributes=True):\n        self.data = Table(\"iris\")\n        self.same_input_output_domain = True\n        self.same_table_attributes = same_table_attributes\n\n    def test_outputs(self, timeout=DEFAULT_TIMEOUT):\n        self.send_signal(self.signal_name, self.signal_data)\n\n        self.wait_until_finished(timeout=timeout)\n\n        # check selected data output\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n\n        # check annotated data output\n        feature_name = ANNOTATED_DATA_FEATURE_NAME\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(0, np.sum([i[feature_name] for i in annotated]))\n\n        # select data instances\n        selected_indices = self._select_data()\n\n        # check selected data output\n        selected = self.get_output(\"Selected Data\")\n        n_sel, n_attr = len(selected), len(self.data.domain.attributes)\n        self.assertGreater(n_sel, 0)\n        self.assertEqual(selected.domain == self.data.domain,\n                         self.same_input_output_domain)\n        np.testing.assert_array_equal(selected.X[:, :n_attr],\n                                      self.data.X[selected_indices])\n        if self.same_table_attributes:\n            self.assertEqual(selected.attributes, self.data.attributes)\n\n        # check annotated data output\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(n_sel, np.sum([i[feature_name] for i in annotated]))\n        if self.same_table_attributes:\n            self.assertEqual(annotated.attributes, self.data.attributes)\n\n        # compare selected and annotated data domains\n        self._compare_selected_annotated_domains(selected, annotated)\n\n        # check output when data is removed\n        self.send_signal(self.signal_name, None)\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n        self.assertIsNone(self.get_output(ANNOTATED_DATA_SIGNAL_NAME))\n\n    def _select_data(self):\n        raise NotImplementedError(\"Subclasses should implement select_data\")\n\n    def _compare_selected_annotated_domains(self, selected, annotated):\n        selected_vars = selected.domain.variables + selected.domain.metas\n        annotated_vars = annotated.domain.variables + annotated.domain.metas\n        self.assertLess(set(selected_vars), set(annotated_vars))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 503,
                            "end_lineno": 506,
                            "parent": {
                                "file_name": "Orange/widgets/tests/base.py",
                                "type": "class",
                                "name": "WidgetOutputsTestMixin",
                                "content": "class WidgetOutputsTestMixin:\n    \"\"\"Class for widget's outputs testing.\n\n    Contains init method to set up testing parameters and a test method, which\n    checks Selected Data and (Annotated) Data outputs.\n\n    Since widgets have different ways of selecting data instances, _select_data\n    method should be implemented when subclassed. The method should assign\n    value to selected_indices parameter.\n\n    If output's expected domain differs from input's domain, parameter\n    same_input_output_domain should be set to False.\n\n    If Selected Data and Data domains differ, override method\n    _compare_selected_annotated_domains.\n    \"\"\"\n\n    def init(self, same_table_attributes=True):\n        self.data = Table(\"iris\")\n        self.same_input_output_domain = True\n        self.same_table_attributes = same_table_attributes\n\n    def test_outputs(self, timeout=DEFAULT_TIMEOUT):\n        self.send_signal(self.signal_name, self.signal_data)\n\n        self.wait_until_finished(timeout=timeout)\n\n        # check selected data output\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n\n        # check annotated data output\n        feature_name = ANNOTATED_DATA_FEATURE_NAME\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(0, np.sum([i[feature_name] for i in annotated]))\n\n        # select data instances\n        selected_indices = self._select_data()\n\n        # check selected data output\n        selected = self.get_output(\"Selected Data\")\n        n_sel, n_attr = len(selected), len(self.data.domain.attributes)\n        self.assertGreater(n_sel, 0)\n        self.assertEqual(selected.domain == self.data.domain,\n                         self.same_input_output_domain)\n        np.testing.assert_array_equal(selected.X[:, :n_attr],\n                                      self.data.X[selected_indices])\n        if self.same_table_attributes:\n            self.assertEqual(selected.attributes, self.data.attributes)\n\n        # check annotated data output\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(n_sel, np.sum([i[feature_name] for i in annotated]))\n        if self.same_table_attributes:\n            self.assertEqual(annotated.attributes, self.data.attributes)\n\n        # compare selected and annotated data domains\n        self._compare_selected_annotated_domains(selected, annotated)\n\n        # check output when data is removed\n        self.send_signal(self.signal_name, None)\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n        self.assertIsNone(self.get_output(ANNOTATED_DATA_SIGNAL_NAME))\n\n    def _select_data(self):\n        raise NotImplementedError(\"Subclasses should implement select_data\")\n\n    def _compare_selected_annotated_domains(self, selected, annotated):\n        selected_vars = selected.domain.variables + selected.domain.metas\n        annotated_vars = annotated.domain.variables + annotated.domain.metas\n        self.assertLess(set(selected_vars), set(annotated_vars))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 486,
                                "end_lineno": 555,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 511,
                            "length": 7
                        },
                        "new_range": {
                            "start": 512,
                            "length": 11
                        },
                        "section": "class WidgetOutputsTestMixin:"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.wait_until_finished(timeout=timeout)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        # check selected data output",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertIsNone(self.get_output(\"Selected Data\"))",
                                "type": "deleted"
                            },
                            {
                                "content": "        output = self.get_output(\"Selected Data\")",
                                "type": "added"
                            },
                            {
                                "content": "        if self.output_all_on_no_selection:",
                                "type": "added"
                            },
                            {
                                "content": "            self.assertEqual(output, self.signal_data)",
                                "type": "added"
                            },
                            {
                                "content": "        else:",
                                "type": "added"
                            },
                            {
                                "content": "            self.assertIsNone(output)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        # check annotated data output",
                                "type": "context"
                            },
                            {
                                "content": "        feature_name = ANNOTATED_DATA_FEATURE_NAME",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/tests/base.py",
                            "type": "method",
                            "name": "WidgetOutputsTestMixin.test_outputs",
                            "content": "class WidgetOutputsTestMixin:\n    \"\"\"Class for widget's outputs testing.\n\n    Contains init method to set up testing parameters and a test method, which\n    checks Selected Data and (Annotated) Data outputs.\n\n    Since widgets have different ways of selecting data instances, _select_data\n    method should be implemented when subclassed. The method should assign\n    value to selected_indices parameter.\n\n    If output's expected domain differs from input's domain, parameter\n    same_input_output_domain should be set to False.\n\n    If Selected Data and Data domains differ, override method\n    _compare_selected_annotated_domains.\n    \"\"\"\n\n    def init(self, same_table_attributes=True):\n        self.data = Table(\"iris\")\n        self.same_input_output_domain = True\n        self.same_table_attributes = same_table_attributes\n\n    def test_outputs(self, timeout=DEFAULT_TIMEOUT):\n        self.send_signal(self.signal_name, self.signal_data)\n\n        self.wait_until_finished(timeout=timeout)\n\n        # check selected data output\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n\n        # check annotated data output\n        feature_name = ANNOTATED_DATA_FEATURE_NAME\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(0, np.sum([i[feature_name] for i in annotated]))\n\n        # select data instances\n        selected_indices = self._select_data()\n\n        # check selected data output\n        selected = self.get_output(\"Selected Data\")\n        n_sel, n_attr = len(selected), len(self.data.domain.attributes)\n        self.assertGreater(n_sel, 0)\n        self.assertEqual(selected.domain == self.data.domain,\n                         self.same_input_output_domain)\n        np.testing.assert_array_equal(selected.X[:, :n_attr],\n                                      self.data.X[selected_indices])\n        if self.same_table_attributes:\n            self.assertEqual(selected.attributes, self.data.attributes)\n\n        # check annotated data output\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(n_sel, np.sum([i[feature_name] for i in annotated]))\n        if self.same_table_attributes:\n            self.assertEqual(annotated.attributes, self.data.attributes)\n\n        # compare selected and annotated data domains\n        self._compare_selected_annotated_domains(selected, annotated)\n\n        # check output when data is removed\n        self.send_signal(self.signal_name, None)\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n        self.assertIsNone(self.get_output(ANNOTATED_DATA_SIGNAL_NAME))\n\n    def _select_data(self):\n        raise NotImplementedError(\"Subclasses should implement select_data\")\n\n    def _compare_selected_annotated_domains(self, selected, annotated):\n        selected_vars = selected.domain.variables + selected.domain.metas\n        annotated_vars = annotated.domain.variables + annotated.domain.metas\n        self.assertLess(set(selected_vars), set(annotated_vars))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 508,
                            "end_lineno": 547,
                            "parent": {
                                "file_name": "Orange/widgets/tests/base.py",
                                "type": "class",
                                "name": "WidgetOutputsTestMixin",
                                "content": "class WidgetOutputsTestMixin:\n    \"\"\"Class for widget's outputs testing.\n\n    Contains init method to set up testing parameters and a test method, which\n    checks Selected Data and (Annotated) Data outputs.\n\n    Since widgets have different ways of selecting data instances, _select_data\n    method should be implemented when subclassed. The method should assign\n    value to selected_indices parameter.\n\n    If output's expected domain differs from input's domain, parameter\n    same_input_output_domain should be set to False.\n\n    If Selected Data and Data domains differ, override method\n    _compare_selected_annotated_domains.\n    \"\"\"\n\n    def init(self, same_table_attributes=True):\n        self.data = Table(\"iris\")\n        self.same_input_output_domain = True\n        self.same_table_attributes = same_table_attributes\n\n    def test_outputs(self, timeout=DEFAULT_TIMEOUT):\n        self.send_signal(self.signal_name, self.signal_data)\n\n        self.wait_until_finished(timeout=timeout)\n\n        # check selected data output\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n\n        # check annotated data output\n        feature_name = ANNOTATED_DATA_FEATURE_NAME\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(0, np.sum([i[feature_name] for i in annotated]))\n\n        # select data instances\n        selected_indices = self._select_data()\n\n        # check selected data output\n        selected = self.get_output(\"Selected Data\")\n        n_sel, n_attr = len(selected), len(self.data.domain.attributes)\n        self.assertGreater(n_sel, 0)\n        self.assertEqual(selected.domain == self.data.domain,\n                         self.same_input_output_domain)\n        np.testing.assert_array_equal(selected.X[:, :n_attr],\n                                      self.data.X[selected_indices])\n        if self.same_table_attributes:\n            self.assertEqual(selected.attributes, self.data.attributes)\n\n        # check annotated data output\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(n_sel, np.sum([i[feature_name] for i in annotated]))\n        if self.same_table_attributes:\n            self.assertEqual(annotated.attributes, self.data.attributes)\n\n        # compare selected and annotated data domains\n        self._compare_selected_annotated_domains(selected, annotated)\n\n        # check output when data is removed\n        self.send_signal(self.signal_name, None)\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n        self.assertIsNone(self.get_output(ANNOTATED_DATA_SIGNAL_NAME))\n\n    def _select_data(self):\n        raise NotImplementedError(\"Subclasses should implement select_data\")\n\n    def _compare_selected_annotated_domains(self, selected, annotated):\n        selected_vars = selected.domain.variables + selected.domain.metas\n        annotated_vars = annotated.domain.variables + annotated.domain.metas\n        self.assertLess(set(selected_vars), set(annotated_vars))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 486,
                                "end_lineno": 555,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/tests/base.py",
                            "type": "class",
                            "name": "WidgetOutputsTestMixin",
                            "content": "class WidgetOutputsTestMixin:\n    \"\"\"Class for widget's outputs testing.\n\n    Contains init method to set up testing parameters and a test method, which\n    checks Selected Data and (Annotated) Data outputs.\n\n    Since widgets have different ways of selecting data instances, _select_data\n    method should be implemented when subclassed. The method should assign\n    value to selected_indices parameter.\n\n    If output's expected domain differs from input's domain, parameter\n    same_input_output_domain should be set to False.\n\n    If Selected Data and Data domains differ, override method\n    _compare_selected_annotated_domains.\n    \"\"\"\n\n    def init(self, same_table_attributes=True):\n        self.data = Table(\"iris\")\n        self.same_input_output_domain = True\n        self.same_table_attributes = same_table_attributes\n\n    def test_outputs(self, timeout=DEFAULT_TIMEOUT):\n        self.send_signal(self.signal_name, self.signal_data)\n\n        self.wait_until_finished(timeout=timeout)\n\n        # check selected data output\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n\n        # check annotated data output\n        feature_name = ANNOTATED_DATA_FEATURE_NAME\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(0, np.sum([i[feature_name] for i in annotated]))\n\n        # select data instances\n        selected_indices = self._select_data()\n\n        # check selected data output\n        selected = self.get_output(\"Selected Data\")\n        n_sel, n_attr = len(selected), len(self.data.domain.attributes)\n        self.assertGreater(n_sel, 0)\n        self.assertEqual(selected.domain == self.data.domain,\n                         self.same_input_output_domain)\n        np.testing.assert_array_equal(selected.X[:, :n_attr],\n                                      self.data.X[selected_indices])\n        if self.same_table_attributes:\n            self.assertEqual(selected.attributes, self.data.attributes)\n\n        # check annotated data output\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(n_sel, np.sum([i[feature_name] for i in annotated]))\n        if self.same_table_attributes:\n            self.assertEqual(annotated.attributes, self.data.attributes)\n\n        # compare selected and annotated data domains\n        self._compare_selected_annotated_domains(selected, annotated)\n\n        # check output when data is removed\n        self.send_signal(self.signal_name, None)\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n        self.assertIsNone(self.get_output(ANNOTATED_DATA_SIGNAL_NAME))\n\n    def _select_data(self):\n        raise NotImplementedError(\"Subclasses should implement select_data\")\n\n    def _compare_selected_annotated_domains(self, selected, annotated):\n        selected_vars = selected.domain.variables + selected.domain.metas\n        annotated_vars = annotated.domain.variables + annotated.domain.metas\n        self.assertLess(set(selected_vars), set(annotated_vars))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 486,
                            "end_lineno": 555,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "d2366dc6fd20611fea0fc49733f82dc8d396062d^",
    "new_commit_hash": "d2366dc6fd20611fea0fc49733f82dc8d396062d",
    "commit_message": "Merge pull request #5233 from irgolic/data-table-send-all\n\nowtable: Select all rows by default",
    "commit_date": "2021-02-19T11:25:40+01:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "d2366dc6fd20611fea0fc49733f82dc8d396062d",
    "test_file_codes": [
        "# pylint: disable=protected-access,unused-import\nfrom contextlib import contextmanager\nimport os\nimport pickle\nfrom unittest.mock import Mock, patch\n\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom AnyQt.QtGui import QFont, QTextDocumentFragment\nfrom AnyQt.QtCore import QRectF, QPointF\nfrom AnyQt.QtTest import QSignalSpy\nfrom AnyQt.QtWidgets import (\n    QComboBox, QSpinBox, QDoubleSpinBox, QSlider\n)\n\nfrom orangewidget.widget import StateInfo\nfrom orangewidget.tests.base import (\n    GuiTest, WidgetTest as WidgetTestBase, DummySignalManager, DEFAULT_TIMEOUT\n)\nfrom Orange.base import SklModel, Model\nfrom Orange.classification.base_classification import (\n    LearnerClassification, ModelClassification\n)\nfrom Orange.data import (\n    Table, Domain, DiscreteVariable, ContinuousVariable, Variable\n)\nfrom Orange.modelling import Fitter\nfrom Orange.preprocess import RemoveNaNColumns, Randomize, Continuize\nfrom Orange.preprocess.preprocess import PreprocessorList\nfrom Orange.regression.base_regression import (\n    LearnerRegression, ModelRegression\n)\nfrom Orange.widgets.tests.utils import simulate\nfrom Orange.widgets.utils.annotated_data import (\n    ANNOTATED_DATA_FEATURE_NAME, ANNOTATED_DATA_SIGNAL_NAME\n)\nfrom Orange.widgets.utils.owlearnerwidget import OWBaseLearner\nfrom Orange.widgets.visualize.utils.plotutils import AnchorItem\nfrom Orange.widgets.widget import OWWidget\n\n\nclass WidgetTest(WidgetTestBase):\n    def assert_table_equal(self, table1, table2):\n        if table1 is None or table2 is None:\n            self.assertIs(table1, table2)\n            return\n        self.assert_domain_equal(table1.domain, table2.domain)\n        np.testing.assert_array_equal(table1.X, table2.X)\n        np.testing.assert_array_equal(table1.Y, table2.Y)\n        np.testing.assert_array_equal(table1.metas, table2.metas)\n\n    def assert_domain_equal(self, domain1, domain2):\n        \"\"\"\n        Test domains for equality.\n\n        Unlike in domain1 == domain2 uses `Variable.__eq__`, which in case of\n        DiscreteVariable ignores `values`, this method also checks that both\n        domain have equal `values`.\n        \"\"\"\n        for var1, var2 in zip(domain1.variables + domain1.metas,\n                              domain2.variables + domain2.metas):\n            self.assertEqual(type(var1), type(var2))\n            self.assertEqual(var1.name, var2.name)\n            if var1.is_discrete:\n                self.assertEqual(var1.values, var2.values)\n\n\nclass TestWidgetTest(WidgetTest):\n    \"\"\"Meta tests for widget test helpers\"\"\"\n\n    def test_process_events_handles_timeouts(self):\n        with self.assertRaises(TimeoutError):\n            self.process_events(until=lambda: False, timeout=0)\n\n    def test_minimum_size(self):\n        return  # skip this test\n\n\nclass BaseParameterMapping:\n    \"\"\"Base class for mapping between gui components and learner's parameters\n    when testing learner widgets.\n\n    Parameters\n    ----------\n    name : str\n        Name of learner's parameter.\n\n    gui_element : QWidget\n        Gui component who's corresponding parameter is to be tested.\n\n    values: list\n        List of values to be tested.\n\n    getter: function\n        It gets component's value.\n\n    setter: function\n        It sets component's value.\n    \"\"\"\n\n    def __init__(self, name, gui_element, values, getter, setter,\n                 problem_type=\"both\"):\n        self.name = name\n        self.gui_element = gui_element\n        self.values = values\n        self.get_value = getter\n        self.set_value = setter\n        self.problem_type = problem_type\n\n    def __str__(self):\n        if self.problem_type == \"both\":\n            return self.name\n        else:\n            return \"%s (%s)\" % (self.name, self.problem_type)\n\n\nclass DefaultParameterMapping(BaseParameterMapping):\n    \"\"\"Class for mapping between gui components and learner's parameters\n    when testing unchecked properties and therefore default parameters\n    should be used.\n\n    Parameters\n    ----------\n    name : str\n        Name of learner's parameter.\n\n    default_value: str, int,\n        Value that should be used by default.\n    \"\"\"\n\n    def __init__(self, name, default_value):\n        super().__init__(name, None, [default_value],\n                         lambda: default_value, lambda x: None)\n\n\nclass ParameterMapping(BaseParameterMapping):\n    \"\"\"Class for mapping between gui components and learner parameters\n    when testing learner widgets\n\n    Parameters\n    ----------\n    name : str\n        Name of learner's parameter.\n\n    gui_element : QWidget\n        Gui component who's corresponding parameter is to be tested.\n\n    values: list, mandatory for ComboBox, optional otherwise\n        List of values to be tested. When None, it is set according to\n        component's type.\n\n    getter: function, optional\n        It gets component's value. When None, it is set according to\n        component's type.\n\n    setter: function, optional\n        It sets component's value. When None, it is set according to\n        component's type.\n    \"\"\"\n\n    def __init__(self, name, gui_element, values=None,\n                 getter=None, setter=None, **kwargs):\n        super().__init__(\n            name, gui_element,\n            values or self._default_values(gui_element),\n            getter or self._default_get_value(gui_element, values),\n            setter or self._default_set_value(gui_element, values),\n            **kwargs)\n\n    @staticmethod\n    def get_gui_element(widget, attribute):\n        return widget.controlled_attributes[attribute][0].control\n\n    @classmethod\n    def from_attribute(cls, widget, attribute, parameter=None):\n        return cls(parameter or attribute, cls.get_gui_element(widget, attribute))\n\n    @staticmethod\n    def _default_values(gui_element):\n        if isinstance(gui_element, (QSpinBox, QDoubleSpinBox, QSlider)):\n            return [gui_element.minimum(), gui_element.maximum()]\n        else:\n            raise TypeError(\"{} is not supported\".format(gui_element))\n\n    @staticmethod\n    def _default_get_value(gui_element, values):\n        if isinstance(gui_element, (QSpinBox, QDoubleSpinBox, QSlider)):\n            return gui_element.value\n        elif isinstance(gui_element, QComboBox):\n            return lambda: values[gui_element.currentIndex()]\n        else:\n            raise TypeError(\"{} is not supported\".format(gui_element))\n\n    @staticmethod\n    def _default_set_value(gui_element, values):\n        if isinstance(gui_element, (QSpinBox, QDoubleSpinBox, QSlider)):\n            return lambda val: gui_element.setValue(val)\n        elif isinstance(gui_element, QComboBox):\n            def fun(val):\n                value = values.index(val)\n                gui_element.activated.emit(value)\n                gui_element.setCurrentIndex(value)\n\n            return fun\n        else:\n            raise TypeError(\"{} is not supported\".format(gui_element))\n\n\nclass WidgetLearnerTestMixin:\n    \"\"\"Base class for widget learner tests.\n\n    Contains init method to set up testing parameters and test methods.\n\n    All widget learner tests should extend it (beside extending WidgetTest\n    class as well). Learners with extra parameters, which can be set on the\n    widget, should override self.parameters list in the setUp method. The\n    list should contain mapping: learner parameter - gui component.\n    \"\"\"\n\n    widget = None  # type: OWBaseLearner\n\n    def init(self):\n        cls_ds = Table(datasets.path(\"testing_dataset_cls\"))\n        reg_ds = Table(datasets.path(\"testing_dataset_reg\"))\n\n        if issubclass(self.widget.LEARNER, Fitter):\n            self.data = cls_ds\n            self.valid_datasets = (cls_ds, reg_ds)\n            self.inadequate_dataset = ()\n            self.learner_class = Fitter\n            self.model_class = Model\n            self.model_name = 'Model'\n        elif issubclass(self.widget.LEARNER, LearnerClassification):\n            self.data = cls_ds\n            self.valid_datasets = (cls_ds,)\n            self.inadequate_dataset = (reg_ds,)\n            self.learner_class = LearnerClassification\n            self.model_class = ModelClassification\n            self.model_name = 'Classifier'\n        else:\n            self.data = reg_ds\n            self.valid_datasets = (reg_ds,)\n            self.inadequate_dataset = (cls_ds,)\n            self.learner_class = LearnerRegression\n            self.model_class = ModelRegression\n            self.model_name = 'Predictor'\n\n        self.parameters = []\n\n    def test_has_unconditional_apply(self):\n        self.assertTrue(hasattr(self.widget, \"unconditional_apply\"))\n\n    def test_input_data(self):\n        \"\"\"Check widget's data with data on the input\"\"\"\n        self.assertEqual(self.widget.data, None)\n        self.send_signal(\"Data\", self.data)\n        self.assertEqual(self.widget.data, self.data)\n        self.wait_until_stop_blocking()\n\n    def test_input_data_disconnect(self):\n        \"\"\"Check widget's data and model after disconnecting data from input\"\"\"\n        self.send_signal(\"Data\", self.data)\n        self.assertEqual(self.widget.data, self.data)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.send_signal(\"Data\", None)\n        self.wait_until_stop_blocking()\n        self.assertEqual(self.widget.data, None)\n        self.assertIsNone(self.get_output(self.widget.Outputs.model))\n\n    def test_input_data_learner_adequacy(self):\n        \"\"\"Check if error message is shown with inadequate data on input\"\"\"\n        for inadequate in self.inadequate_dataset:\n            self.send_signal(\"Data\", inadequate)\n            self.widget.apply_button.button.click()\n            self.wait_until_stop_blocking()\n            self.assertTrue(self.widget.Error.data_error.is_shown())\n        for valid in self.valid_datasets:\n            self.send_signal(\"Data\", valid)\n            self.wait_until_stop_blocking()\n            self.assertFalse(self.widget.Error.data_error.is_shown())\n\n    def test_input_preprocessor(self):\n        \"\"\"Check learner's preprocessors with an extra pp on input\"\"\"\n        randomize = Randomize()\n        self.send_signal(\"Preprocessor\", randomize)\n        self.assertEqual(\n            randomize, self.widget.preprocessors,\n            'Preprocessor not added to widget preprocessors')\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertEqual(\n            (randomize,), self.widget.learner.preprocessors,\n            'Preprocessors were not passed to the learner')\n\n    def test_input_preprocessors(self):\n        \"\"\"Check multiple preprocessors on input\"\"\"\n        pp_list = PreprocessorList([Randomize(), RemoveNaNColumns()])\n        self.send_signal(\"Preprocessor\", pp_list)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertEqual(\n            (pp_list,), self.widget.learner.preprocessors,\n            '`PreprocessorList` was not added to preprocessors')\n\n    def test_input_preprocessor_disconnect(self):\n        \"\"\"Check learner's preprocessors after disconnecting pp from input\"\"\"\n        randomize = Randomize()\n        self.send_signal(\"Preprocessor\", randomize)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertEqual(randomize, self.widget.preprocessors)\n\n        self.send_signal(\"Preprocessor\", None)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertIsNone(self.widget.preprocessors,\n                          'Preprocessors not removed on disconnect.')\n\n    def test_output_learner(self):\n        \"\"\"Check if learner is on output after apply\"\"\"\n        initial = self.get_output(\"Learner\")\n        self.assertIsNotNone(initial, \"Does not initialize the learner output\")\n        self.widget.apply_button.button.click()\n        newlearner = self.get_output(\"Learner\")\n        self.assertIsNot(initial, newlearner,\n                         \"Does not send a new learner instance on `Apply`.\")\n        self.assertIsNotNone(newlearner)\n        self.assertIsInstance(newlearner, self.widget.LEARNER)\n\n    def test_output_model(self):\n        \"\"\"Check if model is on output after sending data and apply\"\"\"\n        self.assertIsNone(self.get_output(self.widget.Outputs.model))\n        self.widget.apply_button.button.click()\n        self.assertIsNone(self.get_output(self.widget.Outputs.model))\n        self.send_signal('Data', self.data)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        model = self.get_output(self.widget.Outputs.model)\n        self.assertIsNotNone(model)\n        self.assertIsInstance(model, self.widget.LEARNER.__returns__)\n        self.assertIsInstance(model, self.model_class)\n\n    def test_output_learner_name(self):\n        \"\"\"Check if learner's name properly changes\"\"\"\n        new_name = \"Learner Name\"\n        self.widget.apply_button.button.click()\n        self.assertEqual(self.widget.learner.name,\n                         self.widget.name_line_edit.text()\n                         or self.widget.name_line_edit.placeholderText())\n        self.widget.name_line_edit.setText(new_name)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertEqual(self.get_output(\"Learner\").name, new_name)\n\n    def test_output_model_name(self):\n        \"\"\"Check if model's name properly changes\"\"\"\n        new_name = \"Model Name\"\n        self.widget.name_line_edit.setText(new_name)\n        self.send_signal(\"Data\", self.data)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        self.assertEqual(self.get_output(self.widget.Outputs.model).name, new_name)\n\n    def test_output_model_picklable(self):\n        \"\"\"Check if model can be pickled\"\"\"\n        self.send_signal(\"Data\", self.data)\n        self.widget.apply_button.button.click()\n        self.wait_until_stop_blocking()\n        model = self.get_output(self.widget.Outputs.model)\n        pickle.dumps(model)\n\n    @staticmethod\n    def _get_param_value(learner, param):\n        if isinstance(learner, Fitter):\n            # Both is just a was to indicate to the tests, fitters don't\n            # actually support this\n            if param.problem_type == \"both\":\n                problem_type = learner.CLASSIFICATION\n            else:\n                problem_type = param.problem_type\n            return learner.get_params(problem_type).get(param.name)\n        else:\n            return learner.params.get(param.name)\n\n    def test_parameters_default(self):\n        \"\"\"Check if learner's parameters are set to default (widget's) values\n        \"\"\"\n        for dataset in self.valid_datasets:\n            self.send_signal(\"Data\", dataset)\n            self.widget.apply_button.button.click()\n            self.wait_until_stop_blocking()\n            for parameter in self.parameters:\n                # Skip if the param isn't used for the given data type\n                if self._should_check_parameter(parameter, dataset):\n                    self.assertEqual(\n                        self._get_param_value(self.widget.learner, parameter),\n                        parameter.get_value())\n\n    def test_parameters(self):\n        \"\"\"Check learner and model for various values of all parameters\"\"\"\n        # Test params on every valid dataset, since some attributes may apply\n        # to only certain problem types\n        for dataset in self.valid_datasets:\n            self.send_signal(\"Data\", dataset)\n            self.wait_until_stop_blocking()\n\n            for parameter in self.parameters:\n                # Skip if the param isn't used for the given data type\n                if not self._should_check_parameter(parameter, dataset):\n                    continue\n\n                assert isinstance(parameter, BaseParameterMapping)\n\n                for value in parameter.values:\n                    parameter.set_value(value)\n                    self.widget.apply_button.button.click()\n                    self.wait_until_stop_blocking()\n                    param = self._get_param_value(self.widget.learner, parameter)\n                    self.assertEqual(\n                        param, parameter.get_value(),\n                        \"Mismatching setting for parameter '%s'\" % parameter)\n                    self.assertEqual(\n                        param, value,\n                        \"Mismatching setting for parameter '%s'\" % parameter)\n                    param = self._get_param_value(self.get_output(\"Learner\"), parameter)\n                    self.assertEqual(\n                        param, value,\n                        \"Mismatching setting for parameter '%s'\" % parameter)\n\n                    if issubclass(self.widget.LEARNER, SklModel):\n                        model = self.get_output(self.widget.Outputs.model)\n                        if model is not None:\n                            self.assertEqual(self._get_param_value(model, parameter), value)\n                            self.assertFalse(self.widget.Error.active)\n                        else:\n                            self.assertTrue(self.widget.Error.active)\n\n    def test_params_trigger_settings_changed(self):\n        \"\"\"Check that the learner gets updated whenever a param is changed.\"\"\"\n        for dataset in self.valid_datasets:\n            self.send_signal(\"Data\", dataset)\n            self.wait_until_stop_blocking()\n\n            for parameter in self.parameters:\n                # Skip if the param isn't used for the given data type\n                if not self._should_check_parameter(parameter, dataset):\n                    continue\n\n                assert isinstance(parameter, BaseParameterMapping)\n                # Set the mock here so we can include the param name in the\n                # error message, so if any test fails, we see where\n                # We mock `apply` and not `settings_changed` since that's\n                # sometimes connected with Qt signals, which are not directly\n                # called\n                self.widget.apply = Mock(name=\"apply(%s)\" % parameter)\n                # Since the settings only get updated when the value actually\n                # changes, find a value that isn't the same as the current\n                # value and try with that\n                new_value = [x for x in parameter.values\n                             if x != parameter.get_value()][0]\n                parameter.set_value(new_value)\n                # wait for asynchronous calls\n                self.process_events(lambda: self.widget.apply.call_args is not None)\n                self.widget.apply.assert_called_once()\n\n    @staticmethod\n    def _should_check_parameter(parameter, data):\n        \"\"\"Should the param be passed into the learner given the data\"\"\"\n        return ((parameter.problem_type == \"classification\" and\n                 data.domain.has_discrete_class) or\n                (parameter.problem_type == \"regression\" and\n                 data.domain.has_continuous_class) or\n                (parameter.problem_type == \"both\"))\n\n    def test_send_report(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Test report\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.report_button.click()\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.report_button.click()\n\n\nclass WidgetOutputsTestMixin:\n    \"\"\"Class for widget's outputs testing.\n\n    Contains init method to set up testing parameters and a test method, which\n    checks Selected Data and (Annotated) Data outputs.\n\n    Since widgets have different ways of selecting data instances, _select_data\n    method should be implemented when subclassed. The method should assign\n    value to selected_indices parameter.\n\n    If output's expected domain differs from input's domain, parameter\n    same_input_output_domain should be set to False.\n\n    If Selected Data and Data domains differ, override method\n    _compare_selected_annotated_domains.\n    \"\"\"\n\n    def init(self, same_table_attributes=True, output_all_on_no_selection=False):\n        self.data = Table(\"iris\")\n        self.same_input_output_domain = True\n        self.same_table_attributes = same_table_attributes\n        self.output_all_on_no_selection = output_all_on_no_selection\n\n    def test_outputs(self, timeout=DEFAULT_TIMEOUT):\n        self.send_signal(self.signal_name, self.signal_data)\n\n        self.wait_until_finished(timeout=timeout)\n\n        # check selected data output\n        output = self.get_output(\"Selected Data\")\n        if self.output_all_on_no_selection:\n            self.assertEqual(output, self.signal_data)\n        else:\n            self.assertIsNone(output)\n\n        # check annotated data output\n        feature_name = ANNOTATED_DATA_FEATURE_NAME\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(0, np.sum([i[feature_name] for i in annotated]))\n\n        # select data instances\n        selected_indices = self._select_data()\n\n        # check selected data output\n        selected = self.get_output(\"Selected Data\")\n        n_sel, n_attr = len(selected), len(self.data.domain.attributes)\n        self.assertGreater(n_sel, 0)\n        self.assertEqual(selected.domain == self.data.domain,\n                         self.same_input_output_domain)\n        np.testing.assert_array_equal(selected.X[:, :n_attr],\n                                      self.data.X[selected_indices])\n        if self.same_table_attributes:\n            self.assertEqual(selected.attributes, self.data.attributes)\n\n        # check annotated data output\n        annotated = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        self.assertEqual(n_sel, np.sum([i[feature_name] for i in annotated]))\n        if self.same_table_attributes:\n            self.assertEqual(annotated.attributes, self.data.attributes)\n\n        # compare selected and annotated data domains\n        self._compare_selected_annotated_domains(selected, annotated)\n\n        # check output when data is removed\n        self.send_signal(self.signal_name, None)\n        self.assertIsNone(self.get_output(\"Selected Data\"))\n        self.assertIsNone(self.get_output(ANNOTATED_DATA_SIGNAL_NAME))\n\n    def _select_data(self):\n        raise NotImplementedError(\"Subclasses should implement select_data\")\n\n    def _compare_selected_annotated_domains(self, selected, annotated):\n        selected_vars = selected.domain.variables + selected.domain.metas\n        annotated_vars = annotated.domain.variables + annotated.domain.metas\n        self.assertLess(set(selected_vars), set(annotated_vars))\n\n\nclass ProjectionWidgetTestMixin:\n    \"\"\"Class for projection widget testing\"\"\"\n\n    def init(self):\n        self.data = Table(\"iris\")\n\n    def _select_data(self):\n        rect = QRectF(QPointF(-20, -20), QPointF(20, 20))\n        self.widget.graph.select_by_rectangle(rect)\n        return self.widget.graph.get_selection()\n\n    def _compare_selected_annotated_domains(self, selected, annotated):\n        selected_vars = selected.domain.variables\n        annotated_vars = annotated.domain.variables\n        self.assertLessEqual(set(selected_vars), set(annotated_vars))\n\n    def test_setup_graph(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Plot should exist after data has been sent in order to be\n        properly set/updated\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assertTrue(\n            self.signal_manager.wait_for_finished(self.widget, timeout),\n            f\"Did not finish in the specified {timeout}ms timeout\"\n        )\n\n        self.assertIsNotNone(self.widget.graph.scatterplot_item)\n\n    def test_default_attrs(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Check default values for 'Color', 'Shape', 'Size' and 'Label'\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertIs(self.widget.attr_color, self.data.domain.class_var)\n        self.assertIsNone(self.widget.attr_label)\n        self.assertIsNone(self.widget.attr_shape)\n        self.assertIsNone(self.widget.attr_size)\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertIsNone(self.widget.attr_color)\n\n    def test_attr_models(self):\n        \"\"\"Check possible values for 'Color', 'Shape', 'Size' and 'Label'\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        controls = self.widget.controls\n        self.assertEqual(len(controls.attr_color.model()), 8)\n        self.assertEqual(len(controls.attr_shape.model()), 3)\n        self.assertTrue(5 < len(controls.attr_size.model()) < 8)\n        self.assertEqual(len(controls.attr_label.model()), 8)\n\n        # color and label should contain all variables\n        # size should contain only continuous variables\n        # shape should contain only discrete variables\n        for var in self.data.domain.variables + self.data.domain.metas:\n            self.assertIn(var, controls.attr_color.model())\n            self.assertIn(var, controls.attr_label.model())\n            if var.is_continuous:\n                self.assertIn(var, controls.attr_size.model())\n                self.assertNotIn(var, controls.attr_shape.model())\n            if var.is_discrete:\n                self.assertNotIn(var, controls.attr_size.model())\n                self.assertIn(var, controls.attr_shape.model())\n\n    def test_attr_label_metas(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Set 'Label' from string meta attribute\"\"\"\n        cont = Continuize(multinomial_treatment=Continuize.AsOrdinal)\n        data = cont(Table(\"zoo\"))\n        self.send_signal(self.widget.Inputs.data, data)\n        self.wait_until_finished(timeout=timeout)\n        simulate.combobox_activate_item(self.widget.controls.attr_label,\n                                        data.domain[-1].name)\n\n    def test_handle_primitive_metas(self):\n        \"\"\"Set 'Color' from continuous meta attribute\"\"\"\n        d, attrs = self.data.domain, self.data.domain.attributes\n        data = self.data.transform(Domain(attrs[:2], d.class_vars, attrs[2:]))\n        self.send_signal(self.widget.Inputs.data, data)\n        simulate.combobox_activate_item(self.widget.controls.attr_color,\n                                        data.domain.metas[0].name)\n\n    def test_datasets(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Test widget for datasets with missing values and constant features\"\"\"\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n            self.wait_until_finished(timeout=timeout)\n\n    def test_none_data(self):\n        \"\"\"Test widget for empty dataset\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data[:0])\n\n    def test_plot_once(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Test if data is plotted only once but committed on every input change\"\"\"\n        table = Table(\"heart_disease\")\n        self.widget.setup_plot = Mock()\n        self.widget.commit = self.widget.unconditional_commit = Mock()\n        self.send_signal(self.widget.Inputs.data, table)\n        self.widget.setup_plot.assert_called_once()\n        self.widget.commit.assert_called_once()\n\n        self.wait_until_finished(timeout=timeout)\n        self.widget.setup_plot.assert_called_once()\n        self.widget.commit.assert_called_once()\n\n        self.widget.commit.reset_mock()\n        self.send_signal(self.widget.Inputs.data_subset, table[::10])\n        self.widget.setup_plot.assert_called_once()\n        self.widget.commit.assert_called_once()\n\n    def test_subset_data_color(self, timeout=DEFAULT_TIMEOUT):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertTrue(\n            self.signal_manager.wait_for_finished(self.widget, timeout),\n            f\"Did not finish in the specified {timeout}ms timeout\"\n        )\n        self.send_signal(self.widget.Inputs.data_subset, self.data[:10])\n        subset = [brush.color().name() == \"#46befa\" for brush in\n                  self.widget.graph.scatterplot_item.data['brush'][:10]]\n        other = [brush.color().name() == \"#000000\" for brush in\n                 self.widget.graph.scatterplot_item.data['brush'][10:]]\n        self.assertTrue(all(subset))\n        self.assertTrue(all(other))\n\n    def test_class_density(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Check class density update\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.cb_class_density.click()\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.cb_class_density.click()\n\n    def test_dragging_tooltip(self):\n        \"\"\"Dragging tooltip depends on data being jittered\"\"\"\n        text = QTextDocumentFragment.fromHtml(self.widget.graph.tiptexts[0]).toPlainText()\n        self.send_signal(self.widget.Inputs.data, Table(\"heart_disease\"))\n        self.assertEqual(self.widget.graph.tip_textitem.toPlainText(), text)\n\n    def test_sparse_data(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Test widget for sparse data\"\"\"\n        table = Table(\"iris\").to_sparse()\n        self.assertTrue(sp.issparse(table.X))\n        self.send_signal(self.widget.Inputs.data, table)\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data_subset, table[::30])\n        self.assertEqual(len(self.widget.subset_data), 5)\n\n    def test_invalidated_embedding(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Check if graph has been replotted when sending same data\"\"\"\n        self.widget.graph.update_coordinates = Mock()\n        self.widget.graph.update_point_props = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.wait_until_finished(timeout=timeout)\n\n        self.widget.graph.update_coordinates.assert_called()\n        self.widget.graph.update_point_props.assert_called()\n\n        self.widget.graph.update_coordinates.reset_mock()\n        self.widget.graph.update_point_props.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.wait_until_finished(timeout=timeout)\n\n        self.widget.graph.update_coordinates.assert_not_called()\n        self.widget.graph.update_point_props.assert_called_once()\n\n    def test_saved_selection(self, timeout=DEFAULT_TIMEOUT):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertTrue(\n            self.signal_manager.wait_for_finished(self.widget, timeout),\n            f\"Did not finish in the specified {timeout}ms timeout\"\n        )\n\n        self.widget.graph.select_by_indices(list(range(0, len(self.data), 10)))\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        w = self.create_widget(self.widget.__class__, stored_settings=settings)\n\n        self.send_signal(self.widget.Inputs.data, self.data, widget=w)\n        self.assertTrue(\n            self.signal_manager.wait_for_finished(w, timeout),\n            f\"Did not finish in the specified {timeout}ms timeout\"\n        )\n\n        self.assertEqual(np.sum(w.graph.selection), 15)\n        np.testing.assert_equal(self.widget.graph.selection, w.graph.selection)\n\n    def test_send_report(self, timeout=DEFAULT_TIMEOUT):\n        \"\"\"Test report \"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.report_button.click()\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.report_button.click()\n\n    def test_hidden_effective_variables(self, timeout=DEFAULT_TIMEOUT):\n        hidden_var1 = ContinuousVariable(\"c1\")\n        hidden_var1.attributes[\"hidden\"] = True\n        hidden_var2 = ContinuousVariable(\"c2\")\n        hidden_var2.attributes[\"hidden\"] = True\n        class_vars = [DiscreteVariable(\"cls\", values=(\"a\", \"b\"))]\n        table = Table(Domain([hidden_var1, hidden_var2], class_vars),\n                      np.array([[0., 1.], [2., 3.]]),\n                      np.array([[0.], [1.]]))\n        self.send_signal(self.widget.Inputs.data, table)\n        self.wait_until_finished(timeout=timeout)\n        self.send_signal(self.widget.Inputs.data, table)\n\n    def test_in_out_summary(self, timeout=DEFAULT_TIMEOUT):\n        info = self.widget.info\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertIn(info._StateInfo__input_summary.details,\n                      [\"\", \"No data on input\"])\n        self.assertIn(info._StateInfo__output_summary.details,\n                      [\"\", \"No data on output\"])\n\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertTrue(\n            self.signal_manager.wait_for_finished(self.widget, timeout),\n            f\"Did not finish in the specified {timeout}ms timeout\"\n        )\n        ind = self._select_data()\n        self.assertEqual(info._StateInfo__input_summary.brief,\n                         str(len(self.data)))\n        self.assertEqual(info._StateInfo__output_summary.brief, str(len(ind)))\n        self.assertGreater(info._StateInfo__input_summary.details, \"\")\n        self.assertGreater(info._StateInfo__output_summary.details, \"\")\n        self.assertNotIn(info._StateInfo__input_summary.details,\n                         [\"\", \"No data on input\"])\n        self.assertNotIn(info._StateInfo__output_summary.details,\n                         [\"\", \"No data on output\"])\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertIn(info._StateInfo__input_summary.details,\n                      [\"\", \"No data on input\"])\n        self.assertIn(info._StateInfo__output_summary.details,\n                      [\"\", \"No data on output\"])\n\n    def test_visual_settings(self, timeout=DEFAULT_TIMEOUT):\n        graph = self.widget.graph\n        font = QFont()\n        font.setItalic(True)\n        font.setFamily(\"Helvetica\")\n\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.wait_until_finished(timeout=timeout)\n\n        key, value = (\"Fonts\", \"Font family\", \"Font family\"), \"Helvetica\"\n        self.widget.set_visual_settings(key, value)\n\n        key, value = (\"Fonts\", \"Title\", \"Font size\"), 20\n        self.widget.set_visual_settings(key, value)\n        key, value = (\"Fonts\", \"Title\", \"Italic\"), True\n        self.widget.set_visual_settings(key, value)\n        font.setPointSize(20)\n        self.assertFontEqual(graph.parameter_setter.title_item.item.font(), font)\n\n        key, value = (\"Fonts\", \"Label\", \"Font size\"), 10\n        self.widget.set_visual_settings(key, value)\n        key, value = (\"Fonts\", \"Label\", \"Italic\"), True\n        self.widget.set_visual_settings(key, value)\n        simulate.combobox_activate_item(self.widget.controls.attr_label,\n                                        self.data.domain[0].name)\n        font.setPointSize(10)\n        self.assertFontEqual(graph.labels[0].textItem.font(), font)\n\n        key, value = (\"Fonts\", \"Categorical legend\", \"Font size\"), 14\n        self.widget.set_visual_settings(key, value)\n        key, value = (\"Fonts\", \"Categorical legend\", \"Italic\"), True\n        self.widget.set_visual_settings(key, value)\n        font.setPointSize(14)\n        legend_item = list(graph.parameter_setter.cat_legend_items)[0]\n        self.assertFontEqual(legend_item[1].item.font(), font)\n\n        key, value = (\"Fonts\", \"Numerical legend\", \"Font size\"), 12\n        self.widget.set_visual_settings(key, value)\n        key, value = (\"Fonts\", \"Numerical legend\", \"Italic\"), True\n        self.widget.set_visual_settings(key, value)\n        simulate.combobox_activate_item(self.widget.controls.attr_color,\n                                        self.data.domain[0].name)\n        variables = self.data.domain.variables + self.data.domain.metas\n        discrete_var = next(\n            (x for x in variables if isinstance(x, DiscreteVariable)), None\n        )\n        if discrete_var:\n            # activate item only when discrete variable available\n            simulate.combobox_activate_item(\n                self.widget.controls.attr_shape, discrete_var.name\n            )\n        font.setPointSize(12)\n        self.assertFontEqual(graph.parameter_setter.num_legend.items[0][0].font, font)\n\n        key, value = (\"Annotations\", \"Title\", \"Title\"), \"Foo\"\n        self.widget.set_visual_settings(key, value)\n        self.assertEqual(graph.parameter_setter.title_item.item.toPlainText(), \"Foo\")\n        self.assertEqual(graph.parameter_setter.title_item.text, \"Foo\")\n\n    def assertFontEqual(self, font1, font2):\n        self.assertEqual(font1.family(), font2.family())\n        self.assertEqual(font1.pointSize(), font2.pointSize())\n        self.assertEqual(font1.italic(), font2.italic())\n\n\nclass AnchorProjectionWidgetTestMixin(ProjectionWidgetTestMixin):\n    def test_embedding_missing_values(self):\n        table = Table(\"heart_disease\")\n        table.X[0] = np.nan\n        self.send_signal(self.widget.Inputs.data, table)\n        self.assertFalse(np.all(self.widget.valid_data))\n        output = self.get_output(ANNOTATED_DATA_SIGNAL_NAME)\n        embedding_mask = np.all(np.isnan(output.metas[:, :2]), axis=1)\n        np.testing.assert_array_equal(~embedding_mask, self.widget.valid_data)\n        # reload\n        self.send_signal(self.widget.Inputs.data, table)\n\n    def test_sparse_data(self, timeout=DEFAULT_TIMEOUT):\n        table = Table(\"iris\")\n        table.X = sp.csr_matrix(table.X)\n        self.assertTrue(sp.issparse(table.X))\n        self.send_signal(self.widget.Inputs.data, table)\n        self.assertTrue(self.widget.Error.sparse_data.is_shown())\n        self.send_signal(self.widget.Inputs.data_subset, table[::30])\n        self.assertEqual(len(self.widget.subset_data), 5)\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Error.sparse_data.is_shown())\n\n    def test_manual_move(self):\n        data = self.data.copy()\n        data[1, 0] = np.nan\n        nvalid, nsample = len(self.data) - 1, self.widget.SAMPLE_SIZE\n        self.send_signal(self.widget.Inputs.data, data)\n        self.widget.graph.select_by_indices(list(range(0, len(data), 10)))\n\n        # remember state\n        selection = self.widget.graph.selection.copy()\n\n        # simulate manual move\n        self.widget._manual_move_start()\n        self.widget._manual_move(0, 1, 1)\n        self.assertEqual(len(self.widget.graph.scatterplot_item.data), nsample)\n        self.widget._manual_move_finish(0, 1, 2)\n\n        # check new state\n        self.assertEqual(len(self.widget.graph.scatterplot_item.data), nvalid)\n        np.testing.assert_equal(self.widget.graph.selection, selection)\n\n    def test_visual_settings(self, timeout=DEFAULT_TIMEOUT):\n        super().test_visual_settings(timeout)\n\n        graph = self.widget.graph\n        font = QFont()\n        font.setItalic(True)\n        font.setFamily(\"Helvetica\")\n\n        key, value = (\"Fonts\", \"Anchor\", \"Font size\"), 10\n        self.widget.set_visual_settings(key, value)\n        key, value = (\"Fonts\", \"Anchor\", \"Italic\"), True\n        self.widget.set_visual_settings(key, value)\n        font.setPointSize(10)\n        for item in graph.anchor_items:\n            if isinstance(item, AnchorItem):\n                item = item._label\n            self.assertFontEqual(item.textItem.font(), font)\n\n\nclass datasets:\n    @staticmethod\n    def path(filename):\n        dirname = os.path.join(os.path.dirname(__file__), \"datasets\")\n        return os.path.join(dirname, filename)\n\n    @classmethod\n    def missing_data_1(cls):\n        \"\"\"\n        Dataset with 3 continuous features (X{1,2,3}) where all the columns\n        and rows contain at least one NaN value.\n\n        One discrete class D with NaN values\n        Mixed continuous/discrete/string metas ({X,D,S}M)\n\n        Returns\n        -------\n        data : Orange.data.Table\n        \"\"\"\n        return Table(cls.path(\"missing_data_1.tab\"))\n\n    @classmethod\n    def missing_data_2(cls):\n        \"\"\"\n        Dataset with 3 continuous features (X{1,2,3}) where all the columns\n        and rows contain at least one NaN value and X1, X2 are constant.\n\n        One discrete constant class D with NaN values.\n        Mixed continuous/discrete/string class metas ({X,D,S}M)\n\n        Returns\n        -------\n        data : Orange.data.Table\n        \"\"\"\n        return Table(cls.path(\"missing_data_2.tab\"))\n\n    @classmethod\n    def missing_data_3(cls):\n        \"\"\"\n        Dataset with 3 discrete features D{1,2,3} where all the columns and\n        rows contain at least one NaN value\n\n        One discrete class D with NaN values\n        Mixes continuous/discrete/string metas ({X,D,S}M)\n\n        Returns\n        -------\n        data : Orange.data.Table\n        \"\"\"\n        return Table(cls.path(\"missing_data_3.tab\"))\n\n    @classmethod\n    def data_one_column_vals(cls, value=np.nan):\n        \"\"\"\n        Dataset with two continuous features and one discrete. One continuous\n        columns has custom set values (default nan).\n\n        Returns\n        -------\n        data : Orange.data.Table\n        \"\"\"\n        table = Table.from_list(\n            Domain(\n                [ContinuousVariable(\"a\"),\n                 ContinuousVariable(\"b\"),\n                 DiscreteVariable(\"c\", values=(\"y\", \"n\"))]\n            ),\n            list(zip(\n                [42.48, 16.84, 15.23, 23.8],\n                [\"\", \"\", \"\", \"\"],\n                \"ynyn\"\n            )))\n        table[:, 1] = value\n        return table\n\n    @classmethod\n    def data_one_column_nans(cls):\n        \"\"\"\n        Dataset with two continuous features and one discrete. One continuous\n        columns has missing values (NaN).\n\n        Returns\n        -------\n        data : Orange.data.Table\n        \"\"\"\n        return cls.data_one_column_vals(value=np.nan)\n\n    @classmethod\n    def data_one_column_infs(cls):\n        return cls.data_one_column_vals(value=np.inf)\n\n    @classmethod\n    def datasets(cls):\n        \"\"\"\n        Yields multiple datasets.\n\n        Returns\n        -------\n        data : Generator of Orange.data.Table\n        \"\"\"\n        ds_cls = Table(cls.path(\"testing_dataset_cls\"))\n        ds_reg = Table(cls.path(\"testing_dataset_reg\"))\n        for ds in (ds_cls, ds_reg):\n            d, a = ds.domain, ds.domain.attributes\n            for i in range(0, len(a), 2):\n                yield ds.transform(Domain(a[i: i + 2], d.class_vars, d.metas))\n            yield ds.transform(Domain(a[:2] + a[8: 10], d.class_vars, d.metas))\n        yield cls.missing_data_1()\n        yield cls.missing_data_2()\n        yield cls.missing_data_3()\n        yield cls.data_one_column_nans()\n        yield ds_cls\n        yield ds_reg\n\n\n@contextmanager\ndef open_widget_classes():\n    with patch.object(OWWidget, \"__init_subclass__\"):\n        yield\n",
        "# pylint: disable=protected-access\nimport unittest\n\n\nfrom unittest.mock import Mock, patch\nfrom AnyQt.QtCore import Qt\n\nfrom orangewidget.widget import StateInfo\n\nfrom Orange.widgets.data.owtable import OWDataTable\nfrom Orange.widgets.tests.base import WidgetTest, WidgetOutputsTestMixin\nfrom Orange.data import Table, Domain\nfrom Orange.widgets.utils.state_summary import format_summary_details\nfrom Orange.data.sql.table import SqlTable\nfrom Orange.tests.sql.base import DataBaseTest as dbt\n\n\nclass TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls,\n                                    output_all_on_no_selection=True)\n\n        cls.signal_name = \"Data\"\n        cls.signal_data = cls.data  # pylint: disable=no-member\n\n    def setUp(self):\n        self.widget = self.create_widget(OWDataTable)\n\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        conn, self.iris = self.create_iris_sql_table()\n        self.table = SqlTable(conn, self.iris)\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    def test_input_data(self):\n        \"\"\"Check number of tabs with data on the input\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n        self.send_signal(self.widget.Inputs.data, self.data, 2)\n        self.assertEqual(self.widget.tabs.count(), 2)\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        self.assertEqual(self.widget.tabs.count(), 1)\n\n    def test_data_model(self):\n        self.send_signal(self.widget.Inputs.data, self.data, 1)\n        self.assertEqual(self.widget.tabs.widget(0).model().rowCount(),\n                         len(self.data))\n\n    def test_reset_select(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._select_data()\n        self.send_signal(self.widget.Inputs.data, Table('heart_disease'))\n        self.assertListEqual([], self.widget.selected_cols)\n        self.assertListEqual([], self.widget.selected_rows)\n\n    def _select_data(self):\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain), 10))\n        self.widget.set_selection()\n        return self.widget.selected_rows\n\n    def test_attrs_appear_in_corner_text(self):\n        iris = Table(\"iris\")\n        domain = iris.domain\n        new_domain = Domain(\n            domain.attributes[1:], iris.domain.class_var, domain.attributes[:1])\n        new_domain.metas[0].attributes = {\"c\": \"foo\"}\n        new_domain.attributes[0].attributes = {\"a\": \"bar\", \"c\": \"baz\"}\n        new_domain.class_var.attributes = {\"b\": \"foo\"}\n        self.widget.set_corner_text = Mock()\n        self.send_signal(self.widget.Inputs.data, iris.transform(new_domain))\n        # false positive, pylint: disable=unsubscriptable-object\n        self.assertEqual(\n            self.widget.set_corner_text.call_args[0][1], \"\\na\\nb\\nc\")\n\n    def test_unconditional_commit_on_new_signal(self):\n        with patch.object(self.widget, 'unconditional_commit') as commit:\n            self.widget.auto_commit = False\n            commit.reset_mock()\n            self.send_signal(self.widget.Inputs.data, self.data)\n            commit.assert_called()\n\n    def test_pending_selection(self):\n        widget = self.create_widget(OWDataTable, stored_settings=dict(\n            selected_rows=[5, 6, 7, 8, 9],\n            selected_cols=list(range(len(self.data.domain)))))\n        self.send_signal(widget.Inputs.data, None, 1)\n        self.send_signal(widget.Inputs.data, self.data, 1)\n        output = self.get_output(widget.Outputs.selected_data)\n        self.assertEqual(5, len(output))\n\n    def test_sorting(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.selected_rows = [0, 1, 2, 3, 4]\n        self.widget.selected_cols = list(range(len(self.data.domain)))\n        self.widget.set_selection()\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_original = output.tolist()\n\n        self.widget.tabs.currentWidget().sortByColumn(1, Qt.AscendingOrder)\n\n        output = self.get_output(self.widget.Outputs.selected_data)\n        output, _ = output.get_column_view(0)\n        output_sorted = output.tolist()\n        \n        # the two outputs should not be the same.\n        self.assertTrue(output_original != output_sorted)\n\n        # check if output after sorting is actually sorted.\n        self.assertTrue(sorted(output_original) == output_sorted)\n        self.assertTrue(sorted(output_sorted) == output_sorted)\n\n    def test_summary(self):\n        \"\"\"Check if status bar is updated when data is received\"\"\"\n        info = self.widget.info\n        no_input, no_output = \"No data on input\", \"No data on output\"\n\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self.widget.tabs.currentWidget().selectAll()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        data = Table(\"iris\")\n        self.send_signal(self.widget.Inputs.data, data, 2)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self._select_data()\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n        self.widget.tabs.setCurrentWidget(self.widget._inputs[1].view)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 1)\n        summary, details = f\"{len(data)}\", format_summary_details(data)\n        self.assertEqual(info._StateInfo__input_summary.brief, summary)\n        self.assertEqual(info._StateInfo__input_summary.details, details)\n        output = self.get_output(self.widget.Outputs.selected_data)\n        summary, details = f\"{len(output)}\", format_summary_details(output)\n        self.assertEqual(info._StateInfo__output_summary.brief, summary)\n        self.assertEqual(info._StateInfo__output_summary.details, details)\n\n        self.send_signal(self.widget.Inputs.data, None, 2)\n        self.assertIsInstance(info._StateInfo__input_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__input_summary.details, no_input)\n        self.assertIsInstance(info._StateInfo__output_summary, StateInfo.Empty)\n        self.assertEqual(info._StateInfo__output_summary.details, no_output)\n\n    def test_info(self):\n        info_text = self.widget.info_text\n        no_input = \"No data.\"\n        self.assertEqual(info_text.text(), no_input)\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n"
    ],
    "test_file_names": [
        "test_1.py",
        "test_2.py"
    ],
    "setup_res_code": 0,
    "setup_res_stdout": "Starting Orange installation attempts...\nAttempting installation with Python 3.7...\nrunning build_ext\nCompiling Orange/classification/_tree_scorers.pyx because it changed.\nCompiling Orange/data/_contingency.pyx because it changed.\nCompiling Orange/data/_io.pyx because it changed.\nCompiling Orange/data/_valuecount.pyx because it changed.\nCompiling Orange/data/_variable.pyx because it changed.\nCompiling Orange/distance/_distance.pyx because it changed.\nCompiling Orange/preprocess/_discretize.pyx because it changed.\nCompiling Orange/preprocess/_relieff.pyx because it changed.\nCompiling Orange/projection/_som.pyx because it changed.\n[1/9] Cythonizing Orange/classification/_tree_scorers.pyx\n[2/9] Cythonizing Orange/data/_contingency.pyx\n[3/9] Cythonizing Orange/data/_io.pyx\n[4/9] Cythonizing Orange/data/_valuecount.pyx\n[5/9] Cythonizing Orange/data/_variable.pyx\n[6/9] Cythonizing Orange/distance/_distance.pyx\n[7/9] Cythonizing Orange/preprocess/_discretize.pyx\n[8/9] Cythonizing Orange/preprocess/_relieff.pyx\n[9/9] Cythonizing Orange/projection/_som.pyx\nbuilding 'Orange.classification._tree_scorers' extension\ncreating build\ncreating build/temp.linux-x86_64-3.7\ncreating build/temp.linux-x86_64-3.7/Orange\ncreating build/temp.linux-x86_64-3.7/Orange/classification\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/classification/_tree_scorers.c -o build/temp.linux-x86_64-3.7/Orange/classification/_tree_scorers.o\ncreating build/lib.linux-x86_64-3.7\ncreating build/lib.linux-x86_64-3.7/Orange\ncreating build/lib.linux-x86_64-3.7/Orange/classification\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/classification/_tree_scorers.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._contingency' extension\ncreating build/temp.linux-x86_64-3.7/Orange/data\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_contingency.c -o build/temp.linux-x86_64-3.7/Orange/data/_contingency.o\ncreating build/lib.linux-x86_64-3.7/Orange/data\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_contingency.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._io' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_io.c -o build/temp.linux-x86_64-3.7/Orange/data/_io.o\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_io.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/data/_io.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._valuecount' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_valuecount.c -o build/temp.linux-x86_64-3.7/Orange/data/_valuecount.o\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_valuecount.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._variable' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/data/_variable.c -o build/temp.linux-x86_64-3.7/Orange/data/_variable.o\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/data/_variable.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.distance._distance' extension\ncreating build/temp.linux-x86_64-3.7/Orange/distance\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/distance/_distance.c -o build/temp.linux-x86_64-3.7/Orange/distance/_distance.o\ncreating build/lib.linux-x86_64-3.7/Orange/distance\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/distance/_distance.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._discretize' extension\ncreating build/temp.linux-x86_64-3.7/Orange/preprocess\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/preprocess/_discretize.c -o build/temp.linux-x86_64-3.7/Orange/preprocess/_discretize.o\ncreating build/lib.linux-x86_64-3.7/Orange/preprocess\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/preprocess/_discretize.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._relieff' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/preprocess/_relieff.cpp -o build/temp.linux-x86_64-3.7/Orange/preprocess/_relieff.o\nc++ -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/preprocess/_relieff.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.projection._som' extension\ncreating build/temp.linux-x86_64-3.7/Orange/projection\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/projection/_som.c -o build/temp.linux-x86_64-3.7/Orange/projection/_som.o\ncreating build/lib.linux-x86_64-3.7/Orange/projection\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/projection/_som.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.classification._simple_tree' extension\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/classification/_simple_tree.c -o build/temp.linux-x86_64-3.7/Orange/classification/_simple_tree.o\ncc -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/classification/_simple_tree.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.widgets.utils._grid_density' extension\ncreating build/temp.linux-x86_64-3.7/Orange/widgets\ncreating build/temp.linux-x86_64-3.7/Orange/widgets/utils\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c Orange/widgets/utils/_grid_density.cpp -o build/temp.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.o\ncreating build/lib.linux-x86_64-3.7/Orange/widgets\ncreating build/lib.linux-x86_64-3.7/Orange/widgets/utils\nc++ -pthread -shared -L/tools/deps/lib build/temp.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.o -L/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib -lm -lpython3.7m -o build/lib.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_io.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so -> Orange/distance\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so -> Orange/projection\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so -> Orange/widgets/utils\nrunning develop\nrunning egg_info\ncreating Orange3.egg-info\nwriting Orange3.egg-info/PKG-INFO\nwriting dependency_links to Orange3.egg-info/dependency_links.txt\nwriting entry points to Orange3.egg-info/entry_points.txt\nwriting requirements to Orange3.egg-info/requires.txt\nwriting top-level names to Orange3.egg-info/top_level.txt\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\nreading manifest file 'Orange3.egg-info/SOURCES.txt'\nreading manifest template 'MANIFEST.in'\nadding license file 'LICENSE'\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\nrunning build_ext\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_io.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-3.7/Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so -> Orange/distance\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-3.7/Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so -> Orange/projection\ncopying build/lib.linux-x86_64-3.7/Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-3.7/Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so -> Orange/widgets/utils\nCreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.28.0.dev0+d2366dc to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d\nProcessing dependencies for Orange3==3.28.0.dev0+d2366dc\nSearching for XlsxWriter==3.2.0\nBest match: XlsxWriter 3.2.0\nAdding XlsxWriter 3.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for xlrd==2.0.1\nBest match: xlrd 2.0.1\nAdding xlrd 2.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for setuptools==59.8.0\nBest match: setuptools 59.8.0\nAdding setuptools 59.8.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for serverfiles==0.3.1\nBest match: serverfiles 0.3.1\nAdding serverfiles 0.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for scipy==1.7.3\nBest match: scipy 1.7.3\nAdding scipy 1.7.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for scikit-learn==1.0.2\nBest match: scikit-learn 1.0.2\nAdding scikit-learn 1.0.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for requests==2.31.0\nBest match: requests 2.31.0\nAdding requests 2.31.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for PyYAML==6.0.1\nBest match: PyYAML 6.0.1\nAdding PyYAML 6.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for python-louvain==0.16\nBest match: python-louvain 0.16\nAdding python-louvain 0.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for pyqtgraph==0.12.4\nBest match: pyqtgraph 0.12.4\nAdding pyqtgraph 0.12.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for pip==24.0\nBest match: pip 24.0\nAdding pip 24.0 to easy-install.pth file\nInstalling pip script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for pandas==1.3.5\nBest match: pandas 1.3.5\nAdding pandas 1.3.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for orange-widget-base==4.22.0\nBest match: orange-widget-base 4.22.0\nAdding orange-widget-base 4.22.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for orange-canvas-core==0.1.35\nBest match: orange-canvas-core 0.1.35\nAdding orange-canvas-core 0.1.35 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for openpyxl==3.1.3\nBest match: openpyxl 3.1.3\nAdding openpyxl 3.1.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for openTSNE==1.0.1\nBest match: openTSNE 1.0.1\nAdding openTSNE 1.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for numpy==1.17.5\nBest match: numpy 1.17.5\nAdding numpy 1.17.5 to easy-install.pth file\nInstalling f2py script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for networkx==2.6.3\nBest match: networkx 2.6.3\nAdding networkx 2.6.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for matplotlib==3.5.3\nBest match: matplotlib 3.5.3\nAdding matplotlib 3.5.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for keyrings.alt==4.2.0\nBest match: keyrings.alt 4.2.0\nAdding keyrings.alt 4.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for keyring==24.1.1\nBest match: keyring 24.1.1\nAdding keyring 24.1.1 to easy-install.pth file\nInstalling keyring script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for joblib==1.3.2\nBest match: joblib 1.3.2\nAdding joblib 1.3.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for httpx==0.16.1\nBest match: httpx 0.16.1\nAdding httpx 0.16.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for chardet==5.2.0\nBest match: chardet 5.2.0\nAdding chardet 5.2.0 to easy-install.pth file\nInstalling chardetect script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for Bottleneck==1.4.0\nBest match: Bottleneck 1.4.0\nAdding Bottleneck 1.4.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for baycomp==1.0.3\nBest match: baycomp 1.0.3\nAdding baycomp 1.0.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for PyQtWebEngine==5.15.6\nBest match: PyQtWebEngine 5.15.6\nAdding PyQtWebEngine 5.15.6 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for PyQt5==5.15.10\nBest match: PyQt5 5.15.10\nAdding PyQt5 5.15.10 to easy-install.pth file\nInstalling pylupdate5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\nInstalling pyrcc5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\nInstalling pyuic5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for AnyQt==0.2.0\nBest match: AnyQt 0.2.0\nAdding AnyQt 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for threadpoolctl==3.1.0\nBest match: threadpoolctl 3.1.0\nAdding threadpoolctl 3.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for idna==3.10\nBest match: idna 3.10\nAdding idna 3.10 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for certifi==2024.12.14\nBest match: certifi 2024.12.14\nAdding certifi 2024.12.14 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for charset-normalizer==3.4.1\nBest match: charset-normalizer 3.4.1\nAdding charset-normalizer 3.4.1 to easy-install.pth file\nInstalling normalizer script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for urllib3==2.0.7\nBest match: urllib3 2.0.7\nAdding urllib3 2.0.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for python-dateutil==2.9.0.post0\nBest match: python-dateutil 2.9.0.post0\nAdding python-dateutil 2.9.0.post0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for pytz==2024.2\nBest match: pytz 2024.2\nAdding pytz 2024.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for typing-extensions==4.7.1\nBest match: typing-extensions 4.7.1\nAdding typing-extensions 4.7.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for requests-cache==1.1.1\nBest match: requests-cache 1.1.1\nAdding requests-cache 1.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for packaging==24.0\nBest match: packaging 24.0\nAdding packaging 24.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for importlib-metadata==6.7.0\nBest match: importlib-metadata 6.7.0\nAdding importlib-metadata 6.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for docutils==0.20.1\nBest match: docutils 0.20.1\nAdding docutils 0.20.1 to easy-install.pth file\nInstalling docutils script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for commonmark==0.9.1\nBest match: commonmark 0.9.1\nAdding commonmark 0.9.1 to easy-install.pth file\nInstalling cmark script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for dictdiffer==0.9.0\nBest match: dictdiffer 0.9.0\nAdding dictdiffer 0.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for qasync==0.25.0\nBest match: qasync 0.25.0\nAdding qasync 0.25.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for et-xmlfile==1.1.0\nBest match: et-xmlfile 1.1.0\nAdding et-xmlfile 1.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for cycler==0.11.0\nBest match: cycler 0.11.0\nAdding cycler 0.11.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for pyparsing==3.1.4\nBest match: pyparsing 3.1.4\nAdding pyparsing 3.1.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for fonttools==4.38.0\nBest match: fonttools 4.38.0\nAdding fonttools 4.38.0 to easy-install.pth file\nInstalling fonttools script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for kiwisolver==1.4.5\nBest match: kiwisolver 1.4.5\nAdding kiwisolver 1.4.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for Pillow==9.5.0\nBest match: Pillow 9.5.0\nAdding Pillow 9.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for jaraco.classes==3.2.3\nBest match: jaraco.classes 3.2.3\nAdding jaraco.classes 3.2.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for jeepney==0.8.0\nBest match: jeepney 0.8.0\nAdding jeepney 0.8.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for importlib-resources==5.12.0\nBest match: importlib-resources 5.12.0\nAdding importlib-resources 5.12.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for SecretStorage==3.3.3\nBest match: SecretStorage 3.3.3\nAdding SecretStorage 3.3.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for rfc3986==1.5.0\nBest match: rfc3986 1.5.0\nAdding rfc3986 1.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for httpcore==0.12.3\nBest match: httpcore 0.12.3\nAdding httpcore 0.12.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for sniffio==1.3.1\nBest match: sniffio 1.3.1\nAdding sniffio 1.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for PyQtWebEngine-Qt5==5.15.16\nBest match: PyQtWebEngine-Qt5 5.15.16\nAdding PyQtWebEngine-Qt5 5.15.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for PyQt5-sip==12.13.0\nBest match: PyQt5-sip 12.13.0\nAdding PyQt5-sip 12.13.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for PyQt5-Qt5==5.15.16\nBest match: PyQt5-Qt5 5.15.16\nAdding PyQt5-Qt5 5.15.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for six==1.17.0\nBest match: six 1.17.0\nAdding six 1.17.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for cattrs==23.1.2\nBest match: cattrs 23.1.2\nAdding cattrs 23.1.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for url-normalize==1.4.3\nBest match: url-normalize 1.4.3\nAdding url-normalize 1.4.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for platformdirs==4.0.0\nBest match: platformdirs 4.0.0\nAdding platformdirs 4.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for attrs==24.2.0\nBest match: attrs 24.2.0\nAdding attrs 24.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for zipp==3.15.0\nBest match: zipp 3.15.0\nAdding zipp 3.15.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for more-itertools==9.1.0\nBest match: more-itertools 9.1.0\nAdding more-itertools 9.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for cryptography==44.0.0\nBest match: cryptography 44.0.0\nAdding cryptography 44.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for h11==0.14.0\nBest match: h11 0.14.0\nAdding h11 0.14.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for exceptiongroup==1.2.2\nBest match: exceptiongroup 1.2.2\nAdding exceptiongroup 1.2.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for cffi==1.15.1\nBest match: cffi 1.15.1\nAdding cffi 1.15.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nSearching for pycparser==2.21\nBest match: pycparser 2.21\nAdding pycparser 2.21 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.28.0.dev0+d2366dc\nVerifying Orange installation...\n✅ Orange installation successful!\nSuccessfully installed orange using Python 3.7\n",
    "setup_res_stderr": "Using CPython 3.7.9\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nResolved 18 packages in 65ms\nPrepared 18 packages in 18ms\nInstalled 18 packages in 110ms\n + cython==0.29.37\n + exceptiongroup==1.2.2\n + importlib-metadata==6.7.0\n + iniconfig==2.0.0\n + numpy==1.17.5\n + packaging==24.0\n + pluggy==1.2.0\n + pyqt5==5.15.10\n + pyqt5-qt5==5.15.16\n + pyqt5-sip==12.13.0\n + pyqtwebengine==5.15.6\n + pyqtwebengine-qt5==5.15.16\n + pytest==7.4.4\n + setuptools==59.8.0\n + tomli==2.0.1\n + typing-extensions==4.7.1\n + wheel==0.42.0\n + zipp==3.15.0\nResolved 53 packages in 392ms\nInstalled 47 packages in 797ms\n + baycomp==1.0.3\n + bottleneck==1.4.0\n + certifi==2024.12.14\n + cffi==1.15.1\n + chardet==5.2.0\n + charset-normalizer==3.4.1\n + cryptography==44.0.0\n + cycler==0.11.0\n + et-xmlfile==1.1.0\n + fonttools==4.38.0\n + h11==0.14.0\n + httpcore==0.12.3\n + httpx==0.16.1\n + idna==3.10\n + importlib-resources==5.12.0\n + jaraco-classes==3.2.3\n + jeepney==0.8.0\n + joblib==1.3.2\n + keyring==24.1.1\n + keyrings-alt==4.2.0\n + kiwisolver==1.4.5\n + matplotlib==3.5.3\n + more-itertools==9.1.0\n + networkx==2.6.3\n + openpyxl==3.1.3\n + opentsne==1.0.1\n + pandas==1.3.5\n + pillow==9.5.0\n + pip==24.0\n + pycparser==2.21\n + pyparsing==3.1.4\n + python-dateutil==2.9.0.post0\n + python-louvain==0.16\n + pytz==2024.2\n + pyyaml==6.0.1\n + requests==2.31.0\n + rfc3986==1.5.0\n + scikit-learn==1.0.2\n + scipy==1.7.3\n + secretstorage==3.3.3\n + serverfiles==0.3.1\n + six==1.17.0\n + sniffio==1.3.1\n + threadpoolctl==3.1.0\n + urllib3==2.0.7\n + xlrd==2.0.1\n + xlsxwriter==3.2.0\nResolved 39 packages in 63ms\nInstalled 13 packages in 306ms\n + anyqt==0.2.0\n + attrs==24.2.0\n + cattrs==23.1.2\n + commonmark==0.9.1\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + orange-canvas-core==0.1.35\n + orange-widget-base==4.22.0\n + platformdirs==4.0.0\n + pyqtgraph==0.12.4\n + qasync==0.25.0\n + requests-cache==1.1.1\n + url-normalize==1.4.3\nResolved 2 packages in 3ms\nInstalled 2 packages in 32ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nResolved 19 packages in 32ms\nInstalled 5 packages in 1.15s\n + catboost==1.2.7\n + graphviz==0.20.1\n + plotly==5.18.0\n + tenacity==8.2.3\n + xgboost==1.6.2\nAudited 2 packages in 2ms\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/classification/_tree_scorers.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_2find_threshold_entropy’:\nOrange/classification/_tree_scorers.c:3413:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 3413 |   __pyx_t_7 = ((__pyx_v_N <= __pyx_v_min_leaf) != 0);\n      |                           ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_6find_threshold_MSE’:\nOrange/classification/_tree_scorers.c:4869:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 4869 |   __pyx_t_1 = ((__pyx_v_N <= __pyx_v_min_leaf) != 0);\n      |                           ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_8find_binarization_MSE’:\nOrange/classification/_tree_scorers.c:5615:43: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5615 |           for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {\n      |                                           ^\nOrange/classification/_tree_scorers.c:5736:39: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5736 |           __pyx_t_20 = ((__pyx_v_left >= __pyx_v_min_leaf) != 0);\n      |                                       ^~\nOrange/classification/_tree_scorers.c:5742:53: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5742 |           __pyx_t_20 = (((__pyx_v_N - __pyx_v_left) >= __pyx_v_min_leaf) != 0);\n      |                                                     ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_14compute_predictions_csr’:\nOrange/classification/_tree_scorers.c:7202:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7202 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_16compute_predictions_csc’:\nOrange/classification/_tree_scorers.c:7857:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7857 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c:7917:143: warning: comparison of integer expressions of different signedness: ‘__pyx_t_5numpy_int32_t’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]\n 7917 |               __pyx_t_15 = (((*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_14 * __pyx_v_indices.strides[0]) ))) != __pyx_v_i) != 0);\n      |                                                                                                                                               ^~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_contingency.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/data/_io.c: In function ‘__pyx_pf_6Orange_4data_3_io_sparse_read_float.constprop’:\nOrange/data/_io.c:4120:43: warning: ‘__pyx_v_decs’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4120 |           __pyx_v_value = ((__pyx_v_value * __pyx_v_decs) + (__pyx_v_c & 0xf));\n      |                            ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/data/_io.c:4318:24: warning: ‘__pyx_v_value’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4318 |           __pyx_t_10 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 223, __pyx_L5_error)\n      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:683:40: warning: ‘__pyx_v_attr_index’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n  683 |   #define PyInt_FromLong               PyLong_FromLong\n      |                                        ^~~~~~~~~~~~~~~\nOrange/data/_io.c:1590:7: note: ‘__pyx_v_attr_index’ was declared here\n 1590 |   int __pyx_v_attr_index;\n      |       ^~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:3183:25: warning: ‘__pyx_v_atomp’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3183 |           __pyx_v_atomp = (__pyx_v_atomp + 1);\n      |           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_valuecount.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/distance/_distance.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_discretize.c:774:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_relieff.cpp:790:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/projection/_som.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_5update_hex’:\nOrange/projection/_som.c:3863:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3863 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:3862:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3862 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pf_6Orange_10projection_4_som_8update_sparse.constprop’:\nOrange/projection/_som.c:4934:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4934 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4933:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4933 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_7get_winners_sparse’:\nOrange/projection/_som.c:4732:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4732 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4307:7: note: ‘__pyx_v_win_y’ was declared here\n 4307 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4721:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4721 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4306:7: note: ‘__pyx_v_win_x’ was declared here\n 4306 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pf_6Orange_10projection_4_som_10update_sparse_hex.constprop’:\nOrange/projection/_som.c:5682:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5682 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:5681:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5681 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_1get_winners’:\nOrange/projection/_som.c:3184:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3184 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2887:7: note: ‘__pyx_v_win_y’ was declared here\n 2887 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:3173:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3173 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_22, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2886:7: note: ‘__pyx_v_win_x’ was declared here\n 2886 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_3update’:\nOrange/projection/_som.c:3357:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3357 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/classification/_simple_tree.c: In function ‘gain_ratio_c’:\nOrange/classification/_simple_tree.c:63:9: warning: implicit declaration of function ‘qsort_r’; did you mean ‘qsort’? [-Wimplicit-function-declaration]\n   63 |         qsort_r(base, nel, size, compar, thunk)\n      |         ^~~~~~~\nOrange/classification/_simple_tree.c:147:9: note: in expansion of macro ‘QSORT_R_FUNC’\n  147 |         QSORT_R_FUNC(examples, size, sizeof(struct Example), (void*) &compar_attr, compar_examples);\n      |         ^~~~~~~~~~~~\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/setuptools/command/easy_install.py:159: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.\n  EasyInstallDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d/.venv/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.\n  setuptools.SetuptoolsDeprecationWarning,\nwarning: no files found matching 'README*' under directory 'Orange'\nwarning: no files found matching 'LICENSE' under directory 'Orange'\nwarning: no files found matching '*.basket' under directory 'Orange/datasets'\nwarning: no files found matching '*.js' under directory 'Orange/widgets'\nwarning: no files found matching '*.css' under directory 'Orange/widgets'\nwarning: no files found matching '*.html' under directory 'Orange/widgets'\nwarning: no files found matching 'COPYING'\n",
    "new_commit_res_code": 0,
    "new_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d\ncollected 23 items\n\nr2e_tests/test_1.py ssss.s.                                              [ 30%]\nr2e_tests/test_2.py sss.............                                     [100%]\n\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestWidgetTest::test_minimum_size\nPASSED r2e_tests/test_1.py::TestWidgetTest::test_process_events_handles_timeouts\nPASSED r2e_tests/test_2.py::TestOWDataTable::test_attrs_appear_in_corner_text\nPASSED r2e_tests/test_2.py::TestOWDataTable::test_data_model\nPASSED r2e_tests/test_2.py::TestOWDataTable::test_image_export\nPASSED r2e_tests/test_2.py::TestOWDataTable::test_info\nPASSED r2e_tests/test_2.py::TestOWDataTable::test_input_data\nPASSED r2e_tests/test_2.py::TestOWDataTable::test_minimum_size\nPASSED r2e_tests/test_2.py::TestOWDataTable::test_msg_base_class\nPASSED r2e_tests/test_2.py::TestOWDataTable::test_outputs\nPASSED r2e_tests/test_2.py::TestOWDataTable::test_pending_selection\nPASSED r2e_tests/test_2.py::TestOWDataTable::test_reset_select\nPASSED r2e_tests/test_2.py::TestOWDataTable::test_sorting\nPASSED r2e_tests/test_2.py::TestOWDataTable::test_summary\nPASSED r2e_tests/test_2.py::TestOWDataTable::test_unconditional_commit_on_new_signal\nSKIPPED [3] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:244: image exporting not tested as .widget was not set\nSKIPPED [2] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:238: minimum size not tested as .widget was not set\nSKIPPED [3] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:250: msg base class not tested as .widget was not set\n======================== 15 passed, 8 skipped in 4.24s =========================\nWidgets left: 0    Max widgets: 1027 \n\n",
    "new_commit_res_stderr": "",
    "old_commit_res_code": 1,
    "old_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_d2366dc6fd20611fea0fc49733f82dc8d396062d\ncollected 23 items\n\nr2e_tests/test_1.py ssss.s.                                              [ 30%]\nr2e_tests/test_2.py sssEEEEEEEEEEEEE                                     [100%]\n\n==================================== ERRORS ====================================\n______ ERROR at setup of TestOWDataTable.test_attrs_appear_in_corner_text ______\n\ncls = <class 'r2e_tests.test_2.TestOWDataTable'>\n\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls,\n>                                   output_all_on_no_selection=True)\nE       TypeError: init() got an unexpected keyword argument 'output_all_on_no_selection'\n\nr2e_tests/test_2.py:23: TypeError\n______________ ERROR at setup of TestOWDataTable.test_data_model _______________\n\ncls = <class 'r2e_tests.test_2.TestOWDataTable'>\n\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls,\n>                                   output_all_on_no_selection=True)\nE       TypeError: init() got an unexpected keyword argument 'output_all_on_no_selection'\n\nr2e_tests/test_2.py:23: TypeError\n_____________ ERROR at setup of TestOWDataTable.test_image_export ______________\n\ncls = <class 'r2e_tests.test_2.TestOWDataTable'>\n\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls,\n>                                   output_all_on_no_selection=True)\nE       TypeError: init() got an unexpected keyword argument 'output_all_on_no_selection'\n\nr2e_tests/test_2.py:23: TypeError\n_________________ ERROR at setup of TestOWDataTable.test_info __________________\n\ncls = <class 'r2e_tests.test_2.TestOWDataTable'>\n\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls,\n>                                   output_all_on_no_selection=True)\nE       TypeError: init() got an unexpected keyword argument 'output_all_on_no_selection'\n\nr2e_tests/test_2.py:23: TypeError\n______________ ERROR at setup of TestOWDataTable.test_input_data _______________\n\ncls = <class 'r2e_tests.test_2.TestOWDataTable'>\n\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls,\n>                                   output_all_on_no_selection=True)\nE       TypeError: init() got an unexpected keyword argument 'output_all_on_no_selection'\n\nr2e_tests/test_2.py:23: TypeError\n_____________ ERROR at setup of TestOWDataTable.test_minimum_size ______________\n\ncls = <class 'r2e_tests.test_2.TestOWDataTable'>\n\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls,\n>                                   output_all_on_no_selection=True)\nE       TypeError: init() got an unexpected keyword argument 'output_all_on_no_selection'\n\nr2e_tests/test_2.py:23: TypeError\n____________ ERROR at setup of TestOWDataTable.test_msg_base_class _____________\n\ncls = <class 'r2e_tests.test_2.TestOWDataTable'>\n\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls,\n>                                   output_all_on_no_selection=True)\nE       TypeError: init() got an unexpected keyword argument 'output_all_on_no_selection'\n\nr2e_tests/test_2.py:23: TypeError\n________________ ERROR at setup of TestOWDataTable.test_outputs ________________\n\ncls = <class 'r2e_tests.test_2.TestOWDataTable'>\n\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls,\n>                                   output_all_on_no_selection=True)\nE       TypeError: init() got an unexpected keyword argument 'output_all_on_no_selection'\n\nr2e_tests/test_2.py:23: TypeError\n___________ ERROR at setup of TestOWDataTable.test_pending_selection ___________\n\ncls = <class 'r2e_tests.test_2.TestOWDataTable'>\n\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls,\n>                                   output_all_on_no_selection=True)\nE       TypeError: init() got an unexpected keyword argument 'output_all_on_no_selection'\n\nr2e_tests/test_2.py:23: TypeError\n_____________ ERROR at setup of TestOWDataTable.test_reset_select ______________\n\ncls = <class 'r2e_tests.test_2.TestOWDataTable'>\n\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls,\n>                                   output_all_on_no_selection=True)\nE       TypeError: init() got an unexpected keyword argument 'output_all_on_no_selection'\n\nr2e_tests/test_2.py:23: TypeError\n________________ ERROR at setup of TestOWDataTable.test_sorting ________________\n\ncls = <class 'r2e_tests.test_2.TestOWDataTable'>\n\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls,\n>                                   output_all_on_no_selection=True)\nE       TypeError: init() got an unexpected keyword argument 'output_all_on_no_selection'\n\nr2e_tests/test_2.py:23: TypeError\n________________ ERROR at setup of TestOWDataTable.test_summary ________________\n\ncls = <class 'r2e_tests.test_2.TestOWDataTable'>\n\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls,\n>                                   output_all_on_no_selection=True)\nE       TypeError: init() got an unexpected keyword argument 'output_all_on_no_selection'\n\nr2e_tests/test_2.py:23: TypeError\n__ ERROR at setup of TestOWDataTable.test_unconditional_commit_on_new_signal ___\n\ncls = <class 'r2e_tests.test_2.TestOWDataTable'>\n\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        WidgetOutputsTestMixin.init(cls,\n>                                   output_all_on_no_selection=True)\nE       TypeError: init() got an unexpected keyword argument 'output_all_on_no_selection'\n\nr2e_tests/test_2.py:23: TypeError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestWidgetTest::test_minimum_size\nPASSED r2e_tests/test_1.py::TestWidgetTest::test_process_events_handles_timeouts\nSKIPPED [3] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:244: image exporting not tested as .widget was not set\nSKIPPED [2] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:238: minimum size not tested as .widget was not set\nSKIPPED [3] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:250: msg base class not tested as .widget was not set\nERROR r2e_tests/test_2.py::TestOWDataTable::test_attrs_appear_in_corner_text\nERROR r2e_tests/test_2.py::TestOWDataTable::test_data_model - TypeError: init...\nERROR r2e_tests/test_2.py::TestOWDataTable::test_image_export - TypeError: in...\nERROR r2e_tests/test_2.py::TestOWDataTable::test_info - TypeError: init() got...\nERROR r2e_tests/test_2.py::TestOWDataTable::test_input_data - TypeError: init...\nERROR r2e_tests/test_2.py::TestOWDataTable::test_minimum_size - TypeError: in...\nERROR r2e_tests/test_2.py::TestOWDataTable::test_msg_base_class - TypeError: ...\nERROR r2e_tests/test_2.py::TestOWDataTable::test_outputs - TypeError: init() ...\nERROR r2e_tests/test_2.py::TestOWDataTable::test_pending_selection - TypeErro...\nERROR r2e_tests/test_2.py::TestOWDataTable::test_reset_select - TypeError: in...\nERROR r2e_tests/test_2.py::TestOWDataTable::test_sorting - TypeError: init() ...\nERROR r2e_tests/test_2.py::TestOWDataTable::test_summary - TypeError: init() ...\nERROR r2e_tests/test_2.py::TestOWDataTable::test_unconditional_commit_on_new_signal\n=================== 2 passed, 8 skipped, 13 errors in 2.10s ====================\nWidgets left: 0    Max widgets: 0 \n\n",
    "old_commit_res_stderr": ""
}
Orange/widgets/data/owtable.py Orange/widgets/data/tests/test_owtable.py Orange/widgets/tests/base.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** Initializing OWDataTable with 'output_all_on_no_selection' Raises TypeError

**Description:**
When attempting to initialize the `OWDataTable` widget with the `output_all_on_no_selection` parameter set to `True`, a `TypeError` is raised because the widget does not recognize this parameter.

**Example Code:**
```python
from Orange.widgets.data.owtable import OWDataTable

# Attempt to initialize OWDataTable with output_all_on_no_selection
widget = OWDataTable(output_all_on_no_selection=True)
```

**Expected Behavior:**
The `OWDataTable` should accept the `output_all_on_no_selection` parameter and automatically select all rows by default when no specific selection is made.

**Actual Behavior:**
A `TypeError` is raised with the following message:
```
TypeError: __init__() got an unexpected keyword argument 'output_all_on_no_selection'
```
This prevents the widget from being configured to select all rows by default, hindering its intended functionality.

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### Orange/widgets/data/owtable.py
import sys
import threading
import itertools
import concurrent.futures

from collections import OrderedDict, namedtuple

from math import isnan

import numpy
from scipy.sparse import issparse

from AnyQt.QtWidgets import (
    QTableView, QHeaderView, QAbstractButton, QApplication, QStyleOptionHeader,
    QStyle, QStylePainter, QStyledItemDelegate
)
from AnyQt.QtGui import QColor, QClipboard
from AnyQt.QtCore import (
    Qt, QSize, QEvent, QObject, QMetaObject,
    QAbstractProxyModel, QIdentityProxyModel, QModelIndex,
    QItemSelectionModel, QItemSelection, QItemSelectionRange,
)
from AnyQt.QtCore import pyqtSlot as Slot

import Orange.data
from Orange.data.storage import Storage
from Orange.data.table import Table
from Orange.data.sql.table import SqlTable
from Orange.statistics import basic_stats

from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.utils.itemselectionmodel import (
    BlockSelectionModel, ranges, selection_blocks
)
from Orange.widgets.utils.tableview import TableView, \
    table_selection_to_mime_data
from Orange.widgets.utils.widgetpreview import WidgetPreview
from Orange.widgets.widget import OWWidget, Input, Output
from Orange.widgets.utils import datacaching
from Orange.widgets.utils.annotated_data import (create_annotated_table,
                                                 ANNOTATED_DATA_SIGNAL_NAME)
from Orange.widgets.utils.itemmodels import TableModel
from Orange.widgets.utils.state_summary import format_summary_details


class RichTableModel(TableModel):
    """A TableModel with some extra bells and whistles/

    (adds support for gui.BarRole, include variable labels and icons
    in the header)
    """
    #: Rich header data flags.
    Name, Labels, Icon = 1, 2, 4

    def __init__(self, sourcedata, parent=None):
        super().__init__(sourcedata, parent)

        self._header_flags = RichTableModel.Name
        self._continuous = [var.is_continuous for var in self.vars]
        labels = []
        for var in self.vars:
            if isinstance(var, Orange.data.Variable):
                labels.extend(var.attributes.keys())
        self._labels = list(sorted(
            {label for label in labels if not label.startswith("_")}))

    def data(self, index, role=Qt.DisplayRole,
             # for faster local lookup
             _BarRole=gui.TableBarItem.BarRole):
        # pylint: disable=arguments-differ
        if role == _BarRole and self._continuous[index.column()]:
            val = super().data(index, TableModel.ValueRole)
            if val is None or isnan(val):
                return None

            dist = super().data(index, TableModel.VariableStatsRole)
            if dist is not None and dist.max > dist.min:
                return (val - dist.min) / (dist.max - dist.min)
            else:
                return None
        elif role == Qt.TextAlignmentRole and self._continuous[index.column()]:
            return Qt.AlignRight | Qt.AlignVCenter
        else:
            return super().data(index, role)

    def headerData(self, section, orientation, role):
        if orientation == Qt.Horizontal and role == Qt.DisplayRole:
            var = super().headerData(
                section, orientation, TableModel.VariableRole)
            if var is None:
                return super().headerData(
                    section, orientation, Qt.DisplayRole)

            lines = []
            if self._header_flags & RichTableModel.Name:
                lines.append(var.name)
            if self._header_flags & RichTableModel.Labels:
                lines.extend(str(var.attributes.get(label, ""))
                             for label in self._labels)
            return "\n".join(lines)
        elif orientation == Qt.Horizontal and role == Qt.DecorationRole and \
                self._header_flags & RichTableModel.Icon:
            var = super().headerData(
                section, orientation, TableModel.VariableRole)
            if var is not None:
                return gui.attributeIconDict[var]
            else:
                return None
        else:
            return super().headerData(section, orientation, role)

    def setRichHeaderFlags(self, flags):
        if flags != self._header_flags:
            self._header_flags = flags
            self.headerDataChanged.emit(
                Qt.Horizontal, 0, self.columnCount() - 1)

    def richHeaderFlags(self):
        return self._header_flags


class TableSliceProxy(QIdentityProxyModel):
    def __init__(self, parent=None, rowSlice=slice(0, -1), **kwargs):
        super().__init__(parent, **kwargs)
        self.__rowslice = rowSlice

    def setRowSlice(self, rowslice):
        if rowslice.step is not None and rowslice.step != 1:
            raise ValueError("invalid stride")

        if self.__rowslice != rowslice:
            self.beginResetModel()
            self.__rowslice = rowslice
            self.endResetModel()

    def mapToSource(self, proxyindex):
        model = self.sourceModel()
        if model is None or not proxyindex.isValid():
            return QModelIndex()

        row, col = proxyindex.row(), proxyindex.column()
        row = row + self.__rowslice.start
        assert 0 <= row < model.rowCount()
        return model.createIndex(row, col, proxyindex.internalPointer())

    def mapFromSource(self, sourceindex):
        model = self.sourceModel()
        if model is None or not sourceindex.isValid():
            return QModelIndex()
        row, col = sourceindex.row(), sourceindex.column()
        row = row - self.__rowslice.start
        assert 0 <= row < self.rowCount()
        return self.createIndex(row, col, sourceindex.internalPointer())

    def rowCount(self, parent=QModelIndex()):
        if parent.isValid():
            return 0
        count = super().rowCount()
        start, stop, step = self.__rowslice.indices(count)
        assert step == 1
        return stop - start


TableSlot = namedtuple("TableSlot", ["input_id", "table", "summary", "view"])


class DataTableView(gui.HScrollStepMixin, TableView):
    dataset: Table
    input_slot: TableSlot


class OWDataTable(OWWidget):
    name = "Data Table"
    description = "View the dataset in a spreadsheet."
    icon = "icons/Table.svg"
    priority = 50
    keywords = []

    buttons_area_orientation = Qt.Vertical

    class Inputs:
        data = Input("Data", Table, multiple=True)

    class Outputs:
        selected_data = Output("Selected Data", Table, default=True)
        annotated_data = Output(ANNOTATED_DATA_SIGNAL_NAME, Table)

    show_distributions = Setting(False)
    dist_color_RGB = Setting((220, 220, 220, 255))
    show_attribute_labels = Setting(True)
    select_rows = Setting(True)
    auto_commit = Setting(True)

    color_by_class = Setting(True)
    selected_rows = Setting([], schema_only=True)
    selected_cols = Setting([], schema_only=True)

    def __init__(self):
        super().__init__()

        self._inputs = OrderedDict()

        self.__pending_selected_rows = self.selected_rows
        self.selected_rows = None
        self.__pending_selected_cols = self.selected_cols
        self.selected_cols = None

        self.dist_color = QColor(*self.dist_color_RGB)

        info_box = gui.vBox(self.controlArea, "Info")
        self.info_text = gui.widgetLabel(info_box)
        self._set_input_summary(None)
        self._set_output_summary(None)
        gui.separator(self.controlArea)

        box = gui.vBox(self.controlArea, "Variables")
        self.c_show_attribute_labels = gui.checkBox(
            box, self, "show_attribute_labels",
            "Show variable labels (if present)",
            callback=self._on_show_variable_labels_changed)

        gui.checkBox(box, self, "show_distributions",
                     'Visualize numeric values',
                     callback=self._on_distribution_color_changed)
        gui.checkBox(box, self, "color_by_class", 'Color by instance classes',
                     callback=self._on_distribution_color_changed)

        box = gui.vBox(self.controlArea, "Selection")

        gui.checkBox(box, self, "select_rows", "Select full rows",
                     callback=self._on_select_rows_changed)

        gui.rubber(self.controlArea)

        reset = gui.button(
            None, self, "Restore Original Order", callback=self.restore_order,
            tooltip="Show rows in the original order", autoDefault=False)
        self.buttonsArea.layout().insertWidget(0, reset)
        gui.auto_send(self.buttonsArea, self, "auto_commit")

        # GUI with tabs
        self.tabs = gui.tabWidget(self.mainArea)
        self.tabs.currentChanged.connect(self._on_current_tab_changed)

    def copy_to_clipboard(self):
        self.copy()

    @staticmethod
    def sizeHint():
        return QSize(800, 500)

    @Inputs.data
    def set_dataset(self, data, tid=None):
        """Set the input dataset."""
        if data is not None:
            datasetname = getattr(data, "name", "Data")
            if tid in self._inputs:
                # update existing input slot
                slot = self._inputs[tid]
                view = slot.view
                # reset the (header) view state.
                view.setModel(None)
                view.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)
                assert self.tabs.indexOf(view) != -1
                self.tabs.setTabText(self.tabs.indexOf(view), datasetname)
            else:
                view = DataTableView()
                view.setSortingEnabled(True)

                if self.select_rows:
                    view.setSelectionBehavior(QTableView.SelectRows)

                header = view.horizontalHeader()
                header.setSectionsMovable(True)
                header.setSectionsClickable(True)
                header.setSortIndicatorShown(True)
                header.setSortIndicator(-1, Qt.AscendingOrder)

                # QHeaderView does not 'reset' the model sort column,
                # because there is no guaranty (requirement) that the
                # models understand the -1 sort column.
                def sort_reset(index, order):
                    if view.model() is not None and index == -1:
                        view.model().sort(index, order)

                header.sortIndicatorChanged.connect(sort_reset)
                self.tabs.addTab(view, datasetname)

            view.dataset = data
            self.tabs.setCurrentWidget(view)

            self._setup_table_view(view, data)
            slot = TableSlot(tid, data, table_summary(data), view)
            view.input_slot = slot
            self._inputs[tid] = slot

            self.tabs.setCurrentIndex(self.tabs.indexOf(view))

            self._set_input_summary(slot)

            if isinstance(slot.summary.len, concurrent.futures.Future):
                def update(_):
                    QMetaObject.invokeMethod(
                        self, "_update_info", Qt.QueuedConnection)

                slot.summary.len.add_done_callback(update)

        elif tid in self._inputs:
            slot = self._inputs.pop(tid)
            view = slot.view
            view.hide()
            view.deleteLater()
            self.tabs.removeTab(self.tabs.indexOf(view))

            current = self.tabs.currentWidget()
            if current is not None:
                self._set_input_summary(current.input_slot)
        else:
            self._set_input_summary(None)

        self.tabs.tabBar().setVisible(self.tabs.count() > 1)

        if data and self.__pending_selected_rows is not None:
            self.selected_rows = self.__pending_selected_rows
            self.__pending_selected_rows = None
        else:
            self.selected_rows = []

        if data and self.__pending_selected_cols is not None:
            self.selected_cols = self.__pending_selected_cols
            self.__pending_selected_cols = None
        else:
            self.selected_cols = []

        self.set_selection()
        self.unconditional_commit()

    def _setup_table_view(self, view, data):
        """Setup the `view` (QTableView) with `data` (Orange.data.Table)
        """
        if data is None:
            view.setModel(None)
            return

        datamodel = RichTableModel(data)

        rowcount = data.approx_len()

        if self.color_by_class and data.domain.has_discrete_class:
            color_schema = [
                QColor(*c) for c in data.domain.class_var.colors]
        else:
            color_schema = None
        if self.show_distributions:
            view.setItemDelegate(
                gui.TableBarItem(
                    self, color=self.dist_color, color_schema=color_schema)
            )
        else:
            view.setItemDelegate(QStyledItemDelegate(self))

        # Enable/disable view sorting based on data's type
        view.setSortingEnabled(is_sortable(data))
        header = view.horizontalHeader()
        header.setSectionsClickable(is_sortable(data))
        header.setSortIndicatorShown(is_sortable(data))
        header.sortIndicatorChanged.connect(self.update_selection)

        view.setModel(datamodel)

        vheader = view.verticalHeader()
        option = view.viewOptions()
        size = view.style().sizeFromContents(
            QStyle.CT_ItemViewItem, option,
            QSize(20, 20), view)

        vheader.setDefaultSectionSize(size.height() + 2)
        vheader.setMinimumSectionSize(5)
        vheader.setSectionResizeMode(QHeaderView.Fixed)

        # Limit the number of rows displayed in the QTableView
        # (workaround for QTBUG-18490 / QTBUG-28631)
        maxrows = (2 ** 31 - 1) // (vheader.defaultSectionSize() + 2)
        if rowcount > maxrows:
            sliceproxy = TableSliceProxy(
                parent=view, rowSlice=slice(0, maxrows))
            sliceproxy.setSourceModel(datamodel)
            # First reset the view (without this the header view retains
            # it's state - at this point invalid/broken)
            view.setModel(None)
            view.setModel(sliceproxy)

        assert view.model().rowCount() <= maxrows
        assert vheader.sectionSize(0) > 1 or datamodel.rowCount() == 0

        # update the header (attribute names)
        self._update_variable_labels(view)

        selmodel = BlockSelectionModel(
            view.model(), parent=view, selectBlocks=not self.select_rows)
        view.setSelectionModel(selmodel)
        view.selectionFinished.connect(self.update_selection)

    #noinspection PyBroadException
    def set_corner_text(self, table, text):
        """Set table corner text."""
        # As this is an ugly hack, do everything in
        # try - except blocks, as it may stop working in newer Qt.
        # pylint: disable=broad-except
        if not hasattr(table, "btn") and not hasattr(table, "btnfailed"):
            try:
                btn = table.findChild(QAbstractButton)

                class Efc(QObject):
                    @staticmethod
                    def eventFilter(o, e):
                        if (isinstance(o, QAbstractButton) and
                                e.type() == QEvent.Paint):
                            # paint by hand (borrowed from QTableCornerButton)
                            btn = o
                            opt = QStyleOptionHeader()
                            opt.initFrom(btn)
                            state = QStyle.State_None
                            if btn.isEnabled():
                                state |= QStyle.State_Enabled
                            if btn.isActiveWindow():
                                state |= QStyle.State_Active
                            if btn.isDown():
                                state |= QStyle.State_Sunken
                            opt.state = state
                            opt.rect = btn.rect()
                            opt.text = btn.text()
                            opt.position = QStyleOptionHeader.OnlyOneSection
                            painter = QStylePainter(btn)
                            painter.drawControl(QStyle.CE_Header, opt)
                            return True     # eat event
                        return False
                table.efc = Efc()
                # disconnect default handler for clicks and connect a new one, which supports
                # both selection and deselection of all data
                btn.clicked.disconnect()
                btn.installEventFilter(table.efc)
                btn.clicked.connect(self._on_select_all)
                table.btn = btn

                if sys.platform == "darwin":
                    btn.setAttribute(Qt.WA_MacSmallSize)

            except Exception:
                table.btnfailed = True

        if hasattr(table, "btn"):
            try:
                btn = table.btn
                btn.setText(text)
                opt = QStyleOptionHeader()
                opt.text = btn.text()
                s = btn.style().sizeFromContents(
                    QStyle.CT_HeaderSection,
                    opt, QSize(),
                    btn).expandedTo(QApplication.globalStrut())
                if s.isValid():
                    table.verticalHeader().setMinimumWidth(s.width())
            except Exception:
                pass

    def _set_input_summary(self, slot):
        def format_summary(summary):
            if isinstance(summary, ApproxSummary):
                length = summary.len.result() if summary.len.done() else \
                    summary.approx_len
            elif isinstance(summary, Summary):
                length = summary.len
            return length

        summary, details = self.info.NoInput, ""
        if slot:
            summary = format_summary(slot.summary)
            details = format_summary_details(slot.table)
        self.info.set_input_summary(summary, details)

        self.info_text.setText("\n".join(self._info_box_text(slot)))

    @staticmethod
    def _info_box_text(slot):
        def format_part(part):
            if isinstance(part, DenseArray):
                if not part.nans:
                    return ""
                perc = 100 * part.nans / (part.nans + part.non_nans)
                return f" ({perc:.1f} % missing data)"

            if isinstance(part, SparseArray):
                tag = "sparse"
            elif isinstance(part, SparseBoolArray):
                tag = "tags"
            else:  # isinstance(part, NotAvailable)
                return ""
            dens = 100 * part.non_nans / (part.nans + part.non_nans)
            return f" ({tag}, density {dens:.2f} %)"

        def desc(n, part):
            if n == 0:
                return f"No {part}s"
            elif n == 1:
                return f"1 {part}"
            else:
                return f"{n} {part}s"

        if slot is None:
            return ["No data."]
        summary = slot.summary
        text = []
        if isinstance(summary, ApproxSummary):
            if summary.len.done():
                text.append(f"{summary.len.result()} instances")
            else:
                text.append(f"~{summary.approx_len} instances")
        elif isinstance(summary, Summary):
            text.append(f"{summary.len} instances")
            if sum(p.nans for p in [summary.X, summary.Y, summary.M]) == 0:
                text[-1] += " (no missing data)"

        text.append(desc(len(summary.domain.attributes), "feature")
                    + format_part(summary.X))

        if not summary.domain.class_vars:
            text.append("No target variable.")
        else:
            if len(summary.domain.class_vars) > 1:
                c_text = desc(len(summary.domain.class_vars), "outcome")
            elif summary.domain.has_continuous_class:
                c_text = "Numeric outcome"
            else:
                c_text = "Target with " \
                    + desc(len(summary.domain.class_var.values), "value")
            text.append(c_text + format_part(summary.Y))

        text.append(desc(len(summary.domain.metas), "meta attribute")
                    + format_part(summary.M))
        return text

    def _set_output_summary(self, output):
        summary = len(output) if output else self.info.NoOutput
        details = format_summary_details(output) if output else ""
        self.info.set_output_summary(summary, details)

    def _on_select_all(self, _):
        data_info = self.tabs.currentWidget().input_slot.summary
        if len(self.selected_rows) == data_info.len \
                and len(self.selected_cols) == len(data_info.domain):
            self.tabs.currentWidget().clearSelection()
        else:
            self.tabs.currentWidget().selectAll()

    def _on_current_tab_changed(self, index):
        """Update the status bar on current tab change"""
        view = self.tabs.widget(index)
        if view is not None and view.model() is not None:
            self._set_input_summary(view.input_slot)
            self.update_selection()
        else:
            self._set_input_summary(None)

    def _update_variable_labels(self, view):
        "Update the variable labels visibility for `view`"
        model = view.model()
        if isinstance(model, TableSliceProxy):
            model = model.sourceModel()

        if self.show_attribute_labels:
            model.setRichHeaderFlags(
                RichTableModel.Labels | RichTableModel.Name)

            labelnames = set()
            domain = model.source.domain
            for a in itertools.chain(domain.metas, domain.variables):
                labelnames.update(a.attributes.keys())
            labelnames = sorted(
                [label for label in labelnames if not label.startswith("_")])
            self.set_corner_text(view, "\n".join([""] + labelnames))
        else:
            model.setRichHeaderFlags(RichTableModel.Name)
            self.set_corner_text(view, "")

    def _on_show_variable_labels_changed(self):
        """The variable labels (var.attribues) visibility was changed."""
        for slot in self._inputs.values():
            self._update_variable_labels(slot.view)

    def _on_distribution_color_changed(self):
        for ti in range(self.tabs.count()):
            widget = self.tabs.widget(ti)
            model = widget.model()
            while isinstance(model, QAbstractProxyModel):
                model = model.sourceModel()
            data = model.source
            class_var = data.domain.class_var
            if self.color_by_class and class_var and class_var.is_discrete:
                color_schema = [QColor(*c) for c in class_var.colors]
            else:
                color_schema = None
            if self.show_distributions:
                delegate = gui.TableBarItem(self, color=self.dist_color,
                                            color_schema=color_schema)
            else:
                delegate = QStyledItemDelegate(self)
            widget.setItemDelegate(delegate)
        tab = self.tabs.currentWidget()
        if tab:
            tab.reset()

    def _on_select_rows_changed(self):
        for slot in self._inputs.values():
            selection_model = slot.view.selectionModel()
            selection_model.setSelectBlocks(not self.select_rows)
            if self.select_rows:
                slot.view.setSelectionBehavior(QTableView.SelectRows)
                # Expand the current selection to full row selection.
                selection_model.select(
                    selection_model.selection(),
                    QItemSelectionModel.Select | QItemSelectionModel.Rows
                )
            else:
                slot.view.setSelectionBehavior(QTableView.SelectItems)

    def restore_order(self):
        """Restore the original data order of the current view."""
        table = self.tabs.currentWidget()
        if table is not None:
            table.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)

    @Slot()
    def _update_info(self):
        current = self.tabs.currentWidget()
        if current is not None and current.model() is not None:
            self._set_input_summary(current.input_slot)

    def update_selection(self, *_):
        self.commit()

    def set_selection(self):
        if self.selected_rows and self.selected_cols:
            view = self.tabs.currentWidget()
            model = view.model()
            if model.rowCount() <= self.selected_rows[-1] or \
                    model.columnCount() <= self.selected_cols[-1]:
                return

            selection = QItemSelection()
            rowranges = list(ranges(self.selected_rows))
            colranges = list(ranges(self.selected_cols))

            for rowstart, rowend in rowranges:
                for colstart, colend in colranges:
                    selection.append(
                        QItemSelectionRange(
                            view.model().index(rowstart, colstart),
                            view.model().index(rowend - 1, colend - 1)
                        )
                    )
            view.selectionModel().select(
                selection, QItemSelectionModel.ClearAndSelect)

    @staticmethod
    def get_selection(view):
        """
        Return the selected row and column indices of the selection in view.
        """
        selmodel = view.selectionModel()

        selection = selmodel.selection()
        model = view.model()
        # map through the proxies into input table.
        while isinstance(model, QAbstractProxyModel):
            selection = model.mapSelectionToSource(selection)
            model = model.sourceModel()

        assert isinstance(selmodel, BlockSelectionModel)
        assert isinstance(model, TableModel)

        row_spans, col_spans = selection_blocks(selection)
        rows = list(itertools.chain.from_iterable(itertools.starmap(range, row_spans)))
        cols = list(itertools.chain.from_iterable(itertools.starmap(range, col_spans)))
        rows = numpy.array(rows, dtype=numpy.intp)
        # map the rows through the applied sorting (if any)
        rows = model.mapToSourceRows(rows)
        rows = rows.tolist()
        return rows, cols

    @staticmethod
    def _get_model(view):
        model = view.model()
        while isinstance(model, QAbstractProxyModel):
            model = model.sourceModel()
        return model

    def commit(self):
        """
        Commit/send the current selected row/column selection.
        """
        selected_data = table = rowsel = None
        view = self.tabs.currentWidget()
        if view and view.model() is not None:
            model = self._get_model(view)
            table = model.source  # The input data table

            # Selections of individual instances are not implemented
            # for SqlTables
            if isinstance(table, SqlTable):
                self._set_output_summary(selected_data)
                self.Outputs.selected_data.send(selected_data)
                self.Outputs.annotated_data.send(None)
                return

            rowsel, colsel = self.get_selection(view)
            self.selected_rows, self.selected_cols = rowsel, colsel

            domain = table.domain

            if len(colsel) < len(domain) + len(domain.metas):
                # only a subset of the columns is selected
                allvars = domain.class_vars + domain.metas + domain.attributes
                columns = [(c, model.headerData(c, Qt.Horizontal,
                                                TableModel.DomainRole))
                           for c in colsel]
                assert all(role is not None for _, role in columns)

                def select_vars(role):
                    """select variables for role (TableModel.DomainRole)"""
                    return [allvars[c] for c, r in columns if r == role]

                attrs = select_vars(TableModel.Attribute)
                if attrs and issparse(table.X):
                    # for sparse data you can only select all attributes
                    attrs = table.domain.attributes
                class_vars = select_vars(TableModel.ClassVar)
                metas = select_vars(TableModel.Meta)
                domain = Orange.data.Domain(attrs, class_vars, metas)

            # Avoid a copy if none rows are selected.
            if not rowsel:
                selected_data = None
            else:
                selected_data = table.from_table(domain, table, rowsel)

        self._set_output_summary(selected_data)
        self.Outputs.selected_data.send(selected_data)
        self.Outputs.annotated_data.send(create_annotated_table(table, rowsel))

    def copy(self):
        """
        Copy current table selection to the clipboard.
        """
        view = self.tabs.currentWidget()
        if view is not None:
            mime = table_selection_to_mime_data(view)
            QApplication.clipboard().setMimeData(
                mime, QClipboard.Clipboard
            )

    def send_report(self):
        view = self.tabs.currentWidget()
        if not view or not view.model():
            return
        model = self._get_model(view)
        self.report_data_brief(model.source)
        self.report_table(view)


# Table Summary

# Basic statistics for X/Y/metas arrays
DenseArray = namedtuple(
    "DenseArray", ["nans", "non_nans", "stats"])
SparseArray = namedtuple(
    "SparseArray", ["nans", "non_nans", "stats"])
SparseBoolArray = namedtuple(
    "SparseBoolArray", ["nans", "non_nans", "stats"])
NotAvailable = namedtuple("NotAvailable", [])

#: Orange.data.Table summary
Summary = namedtuple(
    "Summary",
    ["len", "domain", "X", "Y", "M"])

#: Orange.data.sql.table.SqlTable summary
ApproxSummary = namedtuple(
    "ApproxSummary",
    ["approx_len", "len", "domain", "X", "Y", "M"])


def table_summary(table):
    if isinstance(table, SqlTable):
        approx_len = table.approx_len()
        len_future = concurrent.futures.Future()

        def _len():
            len_future.set_result(len(table))
        threading.Thread(target=_len).start()  # KILL ME !!!

        return ApproxSummary(approx_len, len_future, table.domain,
                             NotAvailable(), NotAvailable(), NotAvailable())
    else:
        domain = table.domain
        n_instances = len(table)
        # dist = basic_stats.DomainBasicStats(table, include_metas=True)
        bstats = datacaching.getCached(
            table, basic_stats.DomainBasicStats, (table, True)
        )

        dist = bstats.stats
        # pylint: disable=unbalanced-tuple-unpacking
        X_dist, Y_dist, M_dist = numpy.split(
            dist, numpy.cumsum([len(domain.attributes),
                                len(domain.class_vars)]))

        def parts(array, density, col_dist):
            array = numpy.atleast_2d(array)
            nans = sum([dist.nans for dist in col_dist])
            non_nans = sum([dist.non_nans for dist in col_dist])
            if density == Storage.DENSE:
                return DenseArray(nans, non_nans, col_dist)
            elif density == Storage.SPARSE:
                return SparseArray(nans, non_nans, col_dist)
            elif density == Storage.SPARSE_BOOL:
                return SparseBoolArray(nans, non_nans, col_dist)
            elif density == Storage.MISSING:
                return NotAvailable()
            else:
                assert False
                return None

        X_part = parts(table.X, table.X_density(), X_dist)
        Y_part = parts(table.Y, table.Y_density(), Y_dist)
        M_part = parts(table.metas, table.metas_density(), M_dist)
        return Summary(n_instances, domain, X_part, Y_part, M_part)


def is_sortable(table):
    if isinstance(table, SqlTable):
        return False
    elif isinstance(table, Orange.data.Table):
        return True
    else:
        return False


if __name__ == "__main__":  # pragma: no cover
    WidgetPreview(OWDataTable).run(
        [(Table("iris"), "iris"),
         (Table("brown-selected"), "brown-selected"),
         (Table("housing"), "housing")])

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
[ISSUE]
**Title:** Initializing OWDataTable with 'output_all_on_no_selection' Raises TypeError

**Description:**
When attempting to initialize the `OWDataTable` widget with the `output_all_on_no_selection` parameter set to `True`, a `TypeError` is raised because the widget does not recognize this parameter.

**Example Code:**
```python
from Orange.widgets.data.owtable import OWDataTable

# Attempt to initialize OWDataTable with output_all_on_no_selection
widget = OWDataTable(output_all_on_no_selection=True)
```

**Expected Behavior:**
The `OWDataTable` should accept the `output_all_on_no_selection` parameter and automatically select all rows by default when no specific selection is made.

**Actual Behavior:**
A `TypeError` is raised with the following message:
```
TypeError: __init__() got an unexpected keyword argument 'output_all_on_no_selection'
```
This prevents the widget from being configured to select all rows by default, hindering its intended functionality.

[/ISSUE]
{
    "TestWidgetTest.test_minimum_size": "PASSED",
    "TestWidgetTest.test_process_events_handles_timeouts": "PASSED",
    "TestOWDataTable.test_attrs_appear_in_corner_text": "PASSED",
    "TestOWDataTable.test_data_model": "PASSED",
    "TestOWDataTable.test_image_export": "PASSED",
    "TestOWDataTable.test_info": "PASSED",
    "TestOWDataTable.test_input_data": "PASSED",
    "TestOWDataTable.test_minimum_size": "PASSED",
    "TestOWDataTable.test_msg_base_class": "PASSED",
    "TestOWDataTable.test_outputs": "PASSED",
    "TestOWDataTable.test_pending_selection": "PASSED",
    "TestOWDataTable.test_reset_select": "PASSED",
    "TestOWDataTable.test_sorting": "PASSED",
    "TestOWDataTable.test_summary": "PASSED",
    "TestOWDataTable.test_unconditional_commit_on_new_signal": "PASSED"
}
diff --git a/Orange/widgets/data/owtable.py b/Orange/widgets/data/owtable.py
index 505145276..4e13adf4e 100644
--- a/Orange/widgets/data/owtable.py
+++ b/Orange/widgets/data/owtable.py
@@ -196,6 +196,8 @@ class OWDataTable(OWWidget):
     selected_rows = Setting([], schema_only=True)
     selected_cols = Setting([], schema_only=True)
 
+    settings_version = 2
+
     def __init__(self):
         super().__init__()
 
@@ -739,9 +741,9 @@ class OWDataTable(OWWidget):
                 metas = select_vars(TableModel.Meta)
                 domain = Orange.data.Domain(attrs, class_vars, metas)
 
-            # Avoid a copy if none rows are selected.
+            # Send all data by default
             if not rowsel:
-                selected_data = None
+                selected_data = table
             else:
                 selected_data = table.from_table(domain, table, rowsel)
 

{"Orange/widgets/data/owtable.py": "import sys\nimport threading\nimport itertools\nimport concurrent.futures\n\nfrom collections import OrderedDict, namedtuple\n\nfrom math import isnan\n\nimport numpy\nfrom scipy.sparse import issparse\n\nfrom AnyQt.QtWidgets import (\n    QTableView, QHeaderView, QAbstractButton, QApplication, QStyleOptionHeader,\n    QStyle, QStylePainter, QStyledItemDelegate\n)\nfrom AnyQt.QtGui import QColor, QClipboard\nfrom AnyQt.QtCore import (\n    Qt, QSize, QEvent, QObject, QMetaObject,\n    QAbstractProxyModel, QIdentityProxyModel, QModelIndex,\n    QItemSelectionModel, QItemSelection, QItemSelectionRange,\n)\nfrom AnyQt.QtCore import pyqtSlot as Slot\n\nimport Orange.data\nfrom Orange.data.storage import Storage\nfrom Orange.data.table import Table\nfrom Orange.data.sql.table import SqlTable\nfrom Orange.statistics import basic_stats\n\nfrom Orange.widgets import gui\nfrom Orange.widgets.settings import Setting\nfrom Orange.widgets.utils.itemselectionmodel import (\n    BlockSelectionModel, ranges, selection_blocks\n)\nfrom Orange.widgets.utils.tableview import TableView, \\\n    table_selection_to_mime_data\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\nfrom Orange.widgets.widget import OWWidget, Input, Output\nfrom Orange.widgets.utils import datacaching\nfrom Orange.widgets.utils.annotated_data import (create_annotated_table,\n                                                 ANNOTATED_DATA_SIGNAL_NAME)\nfrom Orange.widgets.utils.itemmodels import TableModel\nfrom Orange.widgets.utils.state_summary import format_summary_details\n\n\nclass RichTableModel(TableModel):\n    \"\"\"A TableModel with some extra bells and whistles/\n\n    (adds support for gui.BarRole, include variable labels and icons\n    in the header)\n    \"\"\"\n    #: Rich header data flags.\n    Name, Labels, Icon = 1, 2, 4\n\n    def __init__(self, sourcedata, parent=None):\n        super().__init__(sourcedata, parent)\n\n        self._header_flags = RichTableModel.Name\n        self._continuous = [var.is_continuous for var in self.vars]\n        labels = []\n        for var in self.vars:\n            if isinstance(var, Orange.data.Variable):\n                labels.extend(var.attributes.keys())\n        self._labels = list(sorted(\n            {label for label in labels if not label.startswith(\"_\")}))\n\n    def data(self, index, role=Qt.DisplayRole,\n             # for faster local lookup\n             _BarRole=gui.TableBarItem.BarRole):\n        # pylint: disable=arguments-differ\n        if role == _BarRole and self._continuous[index.column()]:\n            val = super().data(index, TableModel.ValueRole)\n            if val is None or isnan(val):\n                return None\n\n            dist = super().data(index, TableModel.VariableStatsRole)\n            if dist is not None and dist.max > dist.min:\n                return (val - dist.min) / (dist.max - dist.min)\n            else:\n                return None\n        elif role == Qt.TextAlignmentRole and self._continuous[index.column()]:\n            return Qt.AlignRight | Qt.AlignVCenter\n        else:\n            return super().data(index, role)\n\n    def headerData(self, section, orientation, role):\n        if orientation == Qt.Horizontal and role == Qt.DisplayRole:\n            var = super().headerData(\n                section, orientation, TableModel.VariableRole)\n            if var is None:\n                return super().headerData(\n                    section, orientation, Qt.DisplayRole)\n\n            lines = []\n            if self._header_flags & RichTableModel.Name:\n                lines.append(var.name)\n            if self._header_flags & RichTableModel.Labels:\n                lines.extend(str(var.attributes.get(label, \"\"))\n                             for label in self._labels)\n            return \"\\n\".join(lines)\n        elif orientation == Qt.Horizontal and role == Qt.DecorationRole and \\\n                self._header_flags & RichTableModel.Icon:\n            var = super().headerData(\n                section, orientation, TableModel.VariableRole)\n            if var is not None:\n                return gui.attributeIconDict[var]\n            else:\n                return None\n        else:\n            return super().headerData(section, orientation, role)\n\n    def setRichHeaderFlags(self, flags):\n        if flags != self._header_flags:\n            self._header_flags = flags\n            self.headerDataChanged.emit(\n                Qt.Horizontal, 0, self.columnCount() - 1)\n\n    def richHeaderFlags(self):\n        return self._header_flags\n\n\nclass TableSliceProxy(QIdentityProxyModel):\n    def __init__(self, parent=None, rowSlice=slice(0, -1), **kwargs):\n        super().__init__(parent, **kwargs)\n        self.__rowslice = rowSlice\n\n    def setRowSlice(self, rowslice):\n        if rowslice.step is not None and rowslice.step != 1:\n            raise ValueError(\"invalid stride\")\n\n        if self.__rowslice != rowslice:\n            self.beginResetModel()\n            self.__rowslice = rowslice\n            self.endResetModel()\n\n    def mapToSource(self, proxyindex):\n        model = self.sourceModel()\n        if model is None or not proxyindex.isValid():\n            return QModelIndex()\n\n        row, col = proxyindex.row(), proxyindex.column()\n        row = row + self.__rowslice.start\n        assert 0 <= row < model.rowCount()\n        return model.createIndex(row, col, proxyindex.internalPointer())\n\n    def mapFromSource(self, sourceindex):\n        model = self.sourceModel()\n        if model is None or not sourceindex.isValid():\n            return QModelIndex()\n        row, col = sourceindex.row(), sourceindex.column()\n        row = row - self.__rowslice.start\n        assert 0 <= row < self.rowCount()\n        return self.createIndex(row, col, sourceindex.internalPointer())\n\n    def rowCount(self, parent=QModelIndex()):\n        if parent.isValid():\n            return 0\n        count = super().rowCount()\n        start, stop, step = self.__rowslice.indices(count)\n        assert step == 1\n        return stop - start\n\n\nTableSlot = namedtuple(\"TableSlot\", [\"input_id\", \"table\", \"summary\", \"view\"])\n\n\nclass DataTableView(gui.HScrollStepMixin, TableView):\n    dataset: Table\n    input_slot: TableSlot\n\n\nclass OWDataTable(OWWidget):\n    name = \"Data Table\"\n    description = \"View the dataset in a spreadsheet.\"\n    icon = \"icons/Table.svg\"\n    priority = 50\n    keywords = []\n\n    buttons_area_orientation = Qt.Vertical\n\n    class Inputs:\n        data = Input(\"Data\", Table, multiple=True)\n\n    class Outputs:\n        selected_data = Output(\"Selected Data\", Table, default=True)\n        annotated_data = Output(ANNOTATED_DATA_SIGNAL_NAME, Table)\n\n    show_distributions = Setting(False)\n    dist_color_RGB = Setting((220, 220, 220, 255))\n    show_attribute_labels = Setting(True)\n    select_rows = Setting(True)\n    auto_commit = Setting(True)\n\n    color_by_class = Setting(True)\n    selected_rows = Setting([], schema_only=True)\n    selected_cols = Setting([], schema_only=True)\n\n    def __init__(self):\n        super().__init__()\n\n        self._inputs = OrderedDict()\n\n        self.__pending_selected_rows = self.selected_rows\n        self.selected_rows = None\n        self.__pending_selected_cols = self.selected_cols\n        self.selected_cols = None\n\n        self.dist_color = QColor(*self.dist_color_RGB)\n\n        info_box = gui.vBox(self.controlArea, \"Info\")\n        self.info_text = gui.widgetLabel(info_box)\n        self._set_input_summary(None)\n        self._set_output_summary(None)\n        gui.separator(self.controlArea)\n\n        box = gui.vBox(self.controlArea, \"Variables\")\n        self.c_show_attribute_labels = gui.checkBox(\n            box, self, \"show_attribute_labels\",\n            \"Show variable labels (if present)\",\n            callback=self._on_show_variable_labels_changed)\n\n        gui.checkBox(box, self, \"show_distributions\",\n                     'Visualize numeric values',\n                     callback=self._on_distribution_color_changed)\n        gui.checkBox(box, self, \"color_by_class\", 'Color by instance classes',\n                     callback=self._on_distribution_color_changed)\n\n        box = gui.vBox(self.controlArea, \"Selection\")\n\n        gui.checkBox(box, self, \"select_rows\", \"Select full rows\",\n                     callback=self._on_select_rows_changed)\n\n        gui.rubber(self.controlArea)\n\n        reset = gui.button(\n            None, self, \"Restore Original Order\", callback=self.restore_order,\n            tooltip=\"Show rows in the original order\", autoDefault=False)\n        self.buttonsArea.layout().insertWidget(0, reset)\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n        # GUI with tabs\n        self.tabs = gui.tabWidget(self.mainArea)\n        self.tabs.currentChanged.connect(self._on_current_tab_changed)\n\n    def copy_to_clipboard(self):\n        self.copy()\n\n    @staticmethod\n    def sizeHint():\n        return QSize(800, 500)\n\n    @Inputs.data\n    def set_dataset(self, data, tid=None):\n        \"\"\"Set the input dataset.\"\"\"\n        if data is not None:\n            datasetname = getattr(data, \"name\", \"Data\")\n            if tid in self._inputs:\n                # update existing input slot\n                slot = self._inputs[tid]\n                view = slot.view\n                # reset the (header) view state.\n                view.setModel(None)\n                view.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)\n                assert self.tabs.indexOf(view) != -1\n                self.tabs.setTabText(self.tabs.indexOf(view), datasetname)\n            else:\n                view = DataTableView()\n                view.setSortingEnabled(True)\n\n                if self.select_rows:\n                    view.setSelectionBehavior(QTableView.SelectRows)\n\n                header = view.horizontalHeader()\n                header.setSectionsMovable(True)\n                header.setSectionsClickable(True)\n                header.setSortIndicatorShown(True)\n                header.setSortIndicator(-1, Qt.AscendingOrder)\n\n                # QHeaderView does not 'reset' the model sort column,\n                # because there is no guaranty (requirement) that the\n                # models understand the -1 sort column.\n                def sort_reset(index, order):\n                    if view.model() is not None and index == -1:\n                        view.model().sort(index, order)\n\n                header.sortIndicatorChanged.connect(sort_reset)\n                self.tabs.addTab(view, datasetname)\n\n            view.dataset = data\n            self.tabs.setCurrentWidget(view)\n\n            self._setup_table_view(view, data)\n            slot = TableSlot(tid, data, table_summary(data), view)\n            view.input_slot = slot\n            self._inputs[tid] = slot\n\n            self.tabs.setCurrentIndex(self.tabs.indexOf(view))\n\n            self._set_input_summary(slot)\n\n            if isinstance(slot.summary.len, concurrent.futures.Future):\n                def update(_):\n                    QMetaObject.invokeMethod(\n                        self, \"_update_info\", Qt.QueuedConnection)\n\n                slot.summary.len.add_done_callback(update)\n\n        elif tid in self._inputs:\n            slot = self._inputs.pop(tid)\n            view = slot.view\n            view.hide()\n            view.deleteLater()\n            self.tabs.removeTab(self.tabs.indexOf(view))\n\n            current = self.tabs.currentWidget()\n            if current is not None:\n                self._set_input_summary(current.input_slot)\n        else:\n            self._set_input_summary(None)\n\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n\n        if data and self.__pending_selected_rows is not None:\n            self.selected_rows = self.__pending_selected_rows\n            self.__pending_selected_rows = None\n        else:\n            self.selected_rows = []\n\n        if data and self.__pending_selected_cols is not None:\n            self.selected_cols = self.__pending_selected_cols\n            self.__pending_selected_cols = None\n        else:\n            self.selected_cols = []\n\n        self.set_selection()\n        self.unconditional_commit()\n\n    def _setup_table_view(self, view, data):\n        \"\"\"Setup the `view` (QTableView) with `data` (Orange.data.Table)\n        \"\"\"\n        if data is None:\n            view.setModel(None)\n            return\n\n        datamodel = RichTableModel(data)\n\n        rowcount = data.approx_len()\n\n        if self.color_by_class and data.domain.has_discrete_class:\n            color_schema = [\n                QColor(*c) for c in data.domain.class_var.colors]\n        else:\n            color_schema = None\n        if self.show_distributions:\n            view.setItemDelegate(\n                gui.TableBarItem(\n                    self, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(QStyledItemDelegate(self))\n\n        # Enable/disable view sorting based on data's type\n        view.setSortingEnabled(is_sortable(data))\n        header = view.horizontalHeader()\n        header.setSectionsClickable(is_sortable(data))\n        header.setSortIndicatorShown(is_sortable(data))\n        header.sortIndicatorChanged.connect(self.update_selection)\n\n        view.setModel(datamodel)\n\n        vheader = view.verticalHeader()\n        option = view.viewOptions()\n        size = view.style().sizeFromContents(\n            QStyle.CT_ItemViewItem, option,\n            QSize(20, 20), view)\n\n        vheader.setDefaultSectionSize(size.height() + 2)\n        vheader.setMinimumSectionSize(5)\n        vheader.setSectionResizeMode(QHeaderView.Fixed)\n\n        # Limit the number of rows displayed in the QTableView\n        # (workaround for QTBUG-18490 / QTBUG-28631)\n        maxrows = (2 ** 31 - 1) // (vheader.defaultSectionSize() + 2)\n        if rowcount > maxrows:\n            sliceproxy = TableSliceProxy(\n                parent=view, rowSlice=slice(0, maxrows))\n            sliceproxy.setSourceModel(datamodel)\n            # First reset the view (without this the header view retains\n            # it's state - at this point invalid/broken)\n            view.setModel(None)\n            view.setModel(sliceproxy)\n\n        assert view.model().rowCount() <= maxrows\n        assert vheader.sectionSize(0) > 1 or datamodel.rowCount() == 0\n\n        # update the header (attribute names)\n        self._update_variable_labels(view)\n\n        selmodel = BlockSelectionModel(\n            view.model(), parent=view, selectBlocks=not self.select_rows)\n        view.setSelectionModel(selmodel)\n        view.selectionFinished.connect(self.update_selection)\n\n    #noinspection PyBroadException\n    def set_corner_text(self, table, text):\n        \"\"\"Set table corner text.\"\"\"\n        # As this is an ugly hack, do everything in\n        # try - except blocks, as it may stop working in newer Qt.\n        # pylint: disable=broad-except\n        if not hasattr(table, \"btn\") and not hasattr(table, \"btnfailed\"):\n            try:\n                btn = table.findChild(QAbstractButton)\n\n                class Efc(QObject):\n                    @staticmethod\n                    def eventFilter(o, e):\n                        if (isinstance(o, QAbstractButton) and\n                                e.type() == QEvent.Paint):\n                            # paint by hand (borrowed from QTableCornerButton)\n                            btn = o\n                            opt = QStyleOptionHeader()\n                            opt.initFrom(btn)\n                            state = QStyle.State_None\n                            if btn.isEnabled():\n                                state |= QStyle.State_Enabled\n                            if btn.isActiveWindow():\n                                state |= QStyle.State_Active\n                            if btn.isDown():\n                                state |= QStyle.State_Sunken\n                            opt.state = state\n                            opt.rect = btn.rect()\n                            opt.text = btn.text()\n                            opt.position = QStyleOptionHeader.OnlyOneSection\n                            painter = QStylePainter(btn)\n                            painter.drawControl(QStyle.CE_Header, opt)\n                            return True     # eat event\n                        return False\n                table.efc = Efc()\n                # disconnect default handler for clicks and connect a new one, which supports\n                # both selection and deselection of all data\n                btn.clicked.disconnect()\n                btn.installEventFilter(table.efc)\n                btn.clicked.connect(self._on_select_all)\n                table.btn = btn\n\n                if sys.platform == \"darwin\":\n                    btn.setAttribute(Qt.WA_MacSmallSize)\n\n            except Exception:\n                table.btnfailed = True\n\n        if hasattr(table, \"btn\"):\n            try:\n                btn = table.btn\n                btn.setText(text)\n                opt = QStyleOptionHeader()\n                opt.text = btn.text()\n                s = btn.style().sizeFromContents(\n                    QStyle.CT_HeaderSection,\n                    opt, QSize(),\n                    btn).expandedTo(QApplication.globalStrut())\n                if s.isValid():\n                    table.verticalHeader().setMinimumWidth(s.width())\n            except Exception:\n                pass\n\n    def _set_input_summary(self, slot):\n        def format_summary(summary):\n            if isinstance(summary, ApproxSummary):\n                length = summary.len.result() if summary.len.done() else \\\n                    summary.approx_len\n            elif isinstance(summary, Summary):\n                length = summary.len\n            return length\n\n        summary, details = self.info.NoInput, \"\"\n        if slot:\n            summary = format_summary(slot.summary)\n            details = format_summary_details(slot.table)\n        self.info.set_input_summary(summary, details)\n\n        self.info_text.setText(\"\\n\".join(self._info_box_text(slot)))\n\n    @staticmethod\n    def _info_box_text(slot):\n        def format_part(part):\n            if isinstance(part, DenseArray):\n                if not part.nans:\n                    return \"\"\n                perc = 100 * part.nans / (part.nans + part.non_nans)\n                return f\" ({perc:.1f} % missing data)\"\n\n            if isinstance(part, SparseArray):\n                tag = \"sparse\"\n            elif isinstance(part, SparseBoolArray):\n                tag = \"tags\"\n            else:  # isinstance(part, NotAvailable)\n                return \"\"\n            dens = 100 * part.non_nans / (part.nans + part.non_nans)\n            return f\" ({tag}, density {dens:.2f} %)\"\n\n        def desc(n, part):\n            if n == 0:\n                return f\"No {part}s\"\n            elif n == 1:\n                return f\"1 {part}\"\n            else:\n                return f\"{n} {part}s\"\n\n        if slot is None:\n            return [\"No data.\"]\n        summary = slot.summary\n        text = []\n        if isinstance(summary, ApproxSummary):\n            if summary.len.done():\n                text.append(f\"{summary.len.result()} instances\")\n            else:\n                text.append(f\"~{summary.approx_len} instances\")\n        elif isinstance(summary, Summary):\n            text.append(f\"{summary.len} instances\")\n            if sum(p.nans for p in [summary.X, summary.Y, summary.M]) == 0:\n                text[-1] += \" (no missing data)\"\n\n        text.append(desc(len(summary.domain.attributes), \"feature\")\n                    + format_part(summary.X))\n\n        if not summary.domain.class_vars:\n            text.append(\"No target variable.\")\n        else:\n            if len(summary.domain.class_vars) > 1:\n                c_text = desc(len(summary.domain.class_vars), \"outcome\")\n            elif summary.domain.has_continuous_class:\n                c_text = \"Numeric outcome\"\n            else:\n                c_text = \"Target with \" \\\n                    + desc(len(summary.domain.class_var.values), \"value\")\n            text.append(c_text + format_part(summary.Y))\n\n        text.append(desc(len(summary.domain.metas), \"meta attribute\")\n                    + format_part(summary.M))\n        return text\n\n    def _set_output_summary(self, output):\n        summary = len(output) if output else self.info.NoOutput\n        details = format_summary_details(output) if output else \"\"\n        self.info.set_output_summary(summary, details)\n\n    def _on_select_all(self, _):\n        data_info = self.tabs.currentWidget().input_slot.summary\n        if len(self.selected_rows) == data_info.len \\\n                and len(self.selected_cols) == len(data_info.domain):\n            self.tabs.currentWidget().clearSelection()\n        else:\n            self.tabs.currentWidget().selectAll()\n\n    def _on_current_tab_changed(self, index):\n        \"\"\"Update the status bar on current tab change\"\"\"\n        view = self.tabs.widget(index)\n        if view is not None and view.model() is not None:\n            self._set_input_summary(view.input_slot)\n            self.update_selection()\n        else:\n            self._set_input_summary(None)\n\n    def _update_variable_labels(self, view):\n        \"Update the variable labels visibility for `view`\"\n        model = view.model()\n        if isinstance(model, TableSliceProxy):\n            model = model.sourceModel()\n\n        if self.show_attribute_labels:\n            model.setRichHeaderFlags(\n                RichTableModel.Labels | RichTableModel.Name)\n\n            labelnames = set()\n            domain = model.source.domain\n            for a in itertools.chain(domain.metas, domain.variables):\n                labelnames.update(a.attributes.keys())\n            labelnames = sorted(\n                [label for label in labelnames if not label.startswith(\"_\")])\n            self.set_corner_text(view, \"\\n\".join([\"\"] + labelnames))\n        else:\n            model.setRichHeaderFlags(RichTableModel.Name)\n            self.set_corner_text(view, \"\")\n\n    def _on_show_variable_labels_changed(self):\n        \"\"\"The variable labels (var.attribues) visibility was changed.\"\"\"\n        for slot in self._inputs.values():\n            self._update_variable_labels(slot.view)\n\n    def _on_distribution_color_changed(self):\n        for ti in range(self.tabs.count()):\n            widget = self.tabs.widget(ti)\n            model = widget.model()\n            while isinstance(model, QAbstractProxyModel):\n                model = model.sourceModel()\n            data = model.source\n            class_var = data.domain.class_var\n            if self.color_by_class and class_var and class_var.is_discrete:\n                color_schema = [QColor(*c) for c in class_var.colors]\n            else:\n                color_schema = None\n            if self.show_distributions:\n                delegate = gui.TableBarItem(self, color=self.dist_color,\n                                            color_schema=color_schema)\n            else:\n                delegate = QStyledItemDelegate(self)\n            widget.setItemDelegate(delegate)\n        tab = self.tabs.currentWidget()\n        if tab:\n            tab.reset()\n\n    def _on_select_rows_changed(self):\n        for slot in self._inputs.values():\n            selection_model = slot.view.selectionModel()\n            selection_model.setSelectBlocks(not self.select_rows)\n            if self.select_rows:\n                slot.view.setSelectionBehavior(QTableView.SelectRows)\n                # Expand the current selection to full row selection.\n                selection_model.select(\n                    selection_model.selection(),\n                    QItemSelectionModel.Select | QItemSelectionModel.Rows\n                )\n            else:\n                slot.view.setSelectionBehavior(QTableView.SelectItems)\n\n    def restore_order(self):\n        \"\"\"Restore the original data order of the current view.\"\"\"\n        table = self.tabs.currentWidget()\n        if table is not None:\n            table.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)\n\n    @Slot()\n    def _update_info(self):\n        current = self.tabs.currentWidget()\n        if current is not None and current.model() is not None:\n            self._set_input_summary(current.input_slot)\n\n    def update_selection(self, *_):\n        self.commit()\n\n    def set_selection(self):\n        if self.selected_rows and self.selected_cols:\n            view = self.tabs.currentWidget()\n            model = view.model()\n            if model.rowCount() <= self.selected_rows[-1] or \\\n                    model.columnCount() <= self.selected_cols[-1]:\n                return\n\n            selection = QItemSelection()\n            rowranges = list(ranges(self.selected_rows))\n            colranges = list(ranges(self.selected_cols))\n\n            for rowstart, rowend in rowranges:\n                for colstart, colend in colranges:\n                    selection.append(\n                        QItemSelectionRange(\n                            view.model().index(rowstart, colstart),\n                            view.model().index(rowend - 1, colend - 1)\n                        )\n                    )\n            view.selectionModel().select(\n                selection, QItemSelectionModel.ClearAndSelect)\n\n    @staticmethod\n    def get_selection(view):\n        \"\"\"\n        Return the selected row and column indices of the selection in view.\n        \"\"\"\n        selmodel = view.selectionModel()\n\n        selection = selmodel.selection()\n        model = view.model()\n        # map through the proxies into input table.\n        while isinstance(model, QAbstractProxyModel):\n            selection = model.mapSelectionToSource(selection)\n            model = model.sourceModel()\n\n        assert isinstance(selmodel, BlockSelectionModel)\n        assert isinstance(model, TableModel)\n\n        row_spans, col_spans = selection_blocks(selection)\n        rows = list(itertools.chain.from_iterable(itertools.starmap(range, row_spans)))\n        cols = list(itertools.chain.from_iterable(itertools.starmap(range, col_spans)))\n        rows = numpy.array(rows, dtype=numpy.intp)\n        # map the rows through the applied sorting (if any)\n        rows = model.mapToSourceRows(rows)\n        rows = rows.tolist()\n        return rows, cols\n\n    @staticmethod\n    def _get_model(view):\n        model = view.model()\n        while isinstance(model, QAbstractProxyModel):\n            model = model.sourceModel()\n        return model\n\n    def commit(self):\n        \"\"\"\n        Commit/send the current selected row/column selection.\n        \"\"\"\n        selected_data = table = rowsel = None\n        view = self.tabs.currentWidget()\n        if view and view.model() is not None:\n            model = self._get_model(view)\n            table = model.source  # The input data table\n\n            # Selections of individual instances are not implemented\n            # for SqlTables\n            if isinstance(table, SqlTable):\n                self._set_output_summary(selected_data)\n                self.Outputs.selected_data.send(selected_data)\n                self.Outputs.annotated_data.send(None)\n                return\n\n            rowsel, colsel = self.get_selection(view)\n            self.selected_rows, self.selected_cols = rowsel, colsel\n\n            domain = table.domain\n\n            if len(colsel) < len(domain) + len(domain.metas):\n                # only a subset of the columns is selected\n                allvars = domain.class_vars + domain.metas + domain.attributes\n                columns = [(c, model.headerData(c, Qt.Horizontal,\n                                                TableModel.DomainRole))\n                           for c in colsel]\n                assert all(role is not None for _, role in columns)\n\n                def select_vars(role):\n                    \"\"\"select variables for role (TableModel.DomainRole)\"\"\"\n                    return [allvars[c] for c, r in columns if r == role]\n\n                attrs = select_vars(TableModel.Attribute)\n                if attrs and issparse(table.X):\n                    # for sparse data you can only select all attributes\n                    attrs = table.domain.attributes\n                class_vars = select_vars(TableModel.ClassVar)\n                metas = select_vars(TableModel.Meta)\n                domain = Orange.data.Domain(attrs, class_vars, metas)\n\n            # Avoid a copy if none rows are selected.\n            if not rowsel:\n                selected_data = None\n            else:\n                selected_data = table.from_table(domain, table, rowsel)\n\n        self._set_output_summary(selected_data)\n        self.Outputs.selected_data.send(selected_data)\n        self.Outputs.annotated_data.send(create_annotated_table(table, rowsel))\n\n    def copy(self):\n        \"\"\"\n        Copy current table selection to the clipboard.\n        \"\"\"\n        view = self.tabs.currentWidget()\n        if view is not None:\n            mime = table_selection_to_mime_data(view)\n            QApplication.clipboard().setMimeData(\n                mime, QClipboard.Clipboard\n            )\n\n    def send_report(self):\n        view = self.tabs.currentWidget()\n        if not view or not view.model():\n            return\n        model = self._get_model(view)\n        self.report_data_brief(model.source)\n        self.report_table(view)\n\n\n# Table Summary\n\n# Basic statistics for X/Y/metas arrays\nDenseArray = namedtuple(\n    \"DenseArray\", [\"nans\", \"non_nans\", \"stats\"])\nSparseArray = namedtuple(\n    \"SparseArray\", [\"nans\", \"non_nans\", \"stats\"])\nSparseBoolArray = namedtuple(\n    \"SparseBoolArray\", [\"nans\", \"non_nans\", \"stats\"])\nNotAvailable = namedtuple(\"NotAvailable\", [])\n\n#: Orange.data.Table summary\nSummary = namedtuple(\n    \"Summary\",\n    [\"len\", \"domain\", \"X\", \"Y\", \"M\"])\n\n#: Orange.data.sql.table.SqlTable summary\nApproxSummary = namedtuple(\n    \"ApproxSummary\",\n    [\"approx_len\", \"len\", \"domain\", \"X\", \"Y\", \"M\"])\n\n\ndef table_summary(table):\n    if isinstance(table, SqlTable):\n        approx_len = table.approx_len()\n        len_future = concurrent.futures.Future()\n\n        def _len():\n            len_future.set_result(len(table))\n        threading.Thread(target=_len).start()  # KILL ME !!!\n\n        return ApproxSummary(approx_len, len_future, table.domain,\n                             NotAvailable(), NotAvailable(), NotAvailable())\n    else:\n        domain = table.domain\n        n_instances = len(table)\n        # dist = basic_stats.DomainBasicStats(table, include_metas=True)\n        bstats = datacaching.getCached(\n            table, basic_stats.DomainBasicStats, (table, True)\n        )\n\n        dist = bstats.stats\n        # pylint: disable=unbalanced-tuple-unpacking\n        X_dist, Y_dist, M_dist = numpy.split(\n            dist, numpy.cumsum([len(domain.attributes),\n                                len(domain.class_vars)]))\n\n        def parts(array, density, col_dist):\n            array = numpy.atleast_2d(array)\n            nans = sum([dist.nans for dist in col_dist])\n            non_nans = sum([dist.non_nans for dist in col_dist])\n            if density == Storage.DENSE:\n                return DenseArray(nans, non_nans, col_dist)\n            elif density == Storage.SPARSE:\n                return SparseArray(nans, non_nans, col_dist)\n            elif density == Storage.SPARSE_BOOL:\n                return SparseBoolArray(nans, non_nans, col_dist)\n            elif density == Storage.MISSING:\n                return NotAvailable()\n            else:\n                assert False\n                return None\n\n        X_part = parts(table.X, table.X_density(), X_dist)\n        Y_part = parts(table.Y, table.Y_density(), Y_dist)\n        M_part = parts(table.metas, table.metas_density(), M_dist)\n        return Summary(n_instances, domain, X_part, Y_part, M_part)\n\n\ndef is_sortable(table):\n    if isinstance(table, SqlTable):\n        return False\n    elif isinstance(table, Orange.data.Table):\n        return True\n    else:\n        return False\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    WidgetPreview(OWDataTable).run(\n        [(Table(\"iris\"), \"iris\"),\n         (Table(\"brown-selected\"), \"brown-selected\"),\n         (Table(\"housing\"), \"housing\")])\n"}
A user will ask you to solve a task. You should first draft your thinking process (inner monologue). Then, generate the solution.

Your response format must follow the template below:
<think>
Your thoughts or/and draft, like working through an exercise on scratch paper. Be as casual and as long as you want until you are confident to generate a correct solution.
</think>
<solution>
Final solution presented to the user.
</solution>
system
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** Initializing OWDataTable with 'output_all_on_no_selection' Raises TypeError

**Description:**
When attempting to initialize the `OWDataTable` widget with the `output_all_on_no_selection` parameter set to `True`, a `TypeError` is raised because the widget does not recognize this parameter.

**Example Code:**
```python
from Orange.widgets.data.owtable import OWDataTable

# Attempt to initialize OWDataTable with output_all_on_no_selection
widget = OWDataTable(output_all_on_no_selection=True)
```

**Expected Behavior:**
The `OWDataTable` should accept the `output_all_on_no_selection` parameter and automatically select all rows by default when no specific selection is made.

**Actual Behavior:**
A `TypeError` is raised with the following message:
```
TypeError: __init__() got an unexpected keyword argument 'output_all_on_no_selection'
```
This prevents the widget from being configured to select all rows by default, hindering its intended functionality.

[/ISSUE]
--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.

--- BEGIN FILE ---
```
### Orange/widgets/data/owtable.py
import sys
import threading
import itertools
import concurrent.futures

from collections import OrderedDict, namedtuple

from math import isnan

import numpy
from scipy.sparse import issparse

from AnyQt.QtWidgets import (
    QTableView, QHeaderView, QAbstractButton, QApplication, QStyleOptionHeader,
    QStyle, QStylePainter, QStyledItemDelegate
)
from AnyQt.QtGui import QColor, QClipboard
from AnyQt.QtCore import (
    Qt, QSize, QEvent, QObject, QMetaObject,
    QAbstractProxyModel, QIdentityProxyModel, QModelIndex,
    QItemSelectionModel, QItemSelection, QItemSelectionRange,
)
from AnyQt.QtCore import pyqtSlot as Slot

import Orange.data
from Orange.data.storage import Storage
from Orange.data.table import Table
from Orange.data.sql.table import SqlTable
from Orange.statistics import basic_stats

from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.utils.itemselectionmodel import (
    BlockSelectionModel, ranges, selection_blocks
)
from Orange.widgets.utils.tableview import TableView, \
    table_selection_to_mime_data
from Orange.widgets.utils.widgetpreview import WidgetPreview
from Orange.widgets.widget import OWWidget, Input, Output
from Orange.widgets.utils import datacaching
from Orange.widgets.utils.annotated_data import (create_annotated_table,
                                                 ANNOTATED_DATA_SIGNAL_NAME)
from Orange.widgets.utils.itemmodels import TableModel
from Orange.widgets.utils.state_summary import format_summary_details


class RichTableModel(TableModel):
    """A TableModel with some extra bells and whistles/

    (adds support for gui.BarRole, include variable labels and icons
    in the header)
    """
    #: Rich header data flags.
    Name, Labels, Icon = 1, 2, 4

    def __init__(self, sourcedata, parent=None):
        super().__init__(sourcedata, parent)

        self._header_flags = RichTableModel.Name
        self._continuous = [var.is_continuous for var in self.vars]
        labels = []
        for var in self.vars:
            if isinstance(var, Orange.data.Variable):
                labels.extend(var.attributes.keys())
        self._labels = list(sorted(
            {label for label in labels if not label.startswith("_")}))

    def data(self, index, role=Qt.DisplayRole,
             # for faster local lookup
             _BarRole=gui.TableBarItem.BarRole):
        # pylint: disable=arguments-differ
        if role == _BarRole and self._continuous[index.column()]:
            val = super().data(index, TableModel.ValueRole)
            if val is None or isnan(val):
                return None

            dist = super().data(index, TableModel.VariableStatsRole)
            if dist is not None and dist.max > dist.min:
                return (val - dist.min) / (dist.max - dist.min)
            else:
                return None
        elif role == Qt.TextAlignmentRole and self._continuous[index.column()]:
            return Qt.AlignRight | Qt.AlignVCenter
        else:
            return super().data(index, role)

    def headerData(self, section, orientation, role):
        if orientation == Qt.Horizontal and role == Qt.DisplayRole:
            var = super().headerData(
                section, orientation, TableModel.VariableRole)
            if var is None:
                return super().headerData(
                    section, orientation, Qt.DisplayRole)

            lines = []
            if self._header_flags & RichTableModel.Name:
                lines.append(var.name)
            if self._header_flags & RichTableModel.Labels:
                lines.extend(str(var.attributes.get(label, ""))
                             for label in self._labels)
            return "\n".join(lines)
        elif orientation == Qt.Horizontal and role == Qt.DecorationRole and \
                self._header_flags & RichTableModel.Icon:
            var = super().headerData(
                section, orientation, TableModel.VariableRole)
            if var is not None:
                return gui.attributeIconDict[var]
            else:
                return None
        else:
            return super().headerData(section, orientation, role)

    def setRichHeaderFlags(self, flags):
        if flags != self._header_flags:
            self._header_flags = flags
            self.headerDataChanged.emit(
                Qt.Horizontal, 0, self.columnCount() - 1)

    def richHeaderFlags(self):
        return self._header_flags


class TableSliceProxy(QIdentityProxyModel):
    def __init__(self, parent=None, rowSlice=slice(0, -1), **kwargs):
        super().__init__(parent, **kwargs)
        self.__rowslice = rowSlice

    def setRowSlice(self, rowslice):
        if rowslice.step is not None and rowslice.step != 1:
            raise ValueError("invalid stride")

        if self.__rowslice != rowslice:
            self.beginResetModel()
            self.__rowslice = rowslice
            self.endResetModel()

    def mapToSource(self, proxyindex):
        model = self.sourceModel()
        if model is None or not proxyindex.isValid():
            return QModelIndex()

        row, col = proxyindex.row(), proxyindex.column()
        row = row + self.__rowslice.start
        assert 0 <= row < model.rowCount()
        return model.createIndex(row, col, proxyindex.internalPointer())

    def mapFromSource(self, sourceindex):
        model = self.sourceModel()
        if model is None or not sourceindex.isValid():
            return QModelIndex()
        row, col = sourceindex.row(), sourceindex.column()
        row = row - self.__rowslice.start
        assert 0 <= row < self.rowCount()
        return self.createIndex(row, col, sourceindex.internalPointer())

    def rowCount(self, parent=QModelIndex()):
        if parent.isValid():
            return 0
        count = super().rowCount()
        start, stop, step = self.__rowslice.indices(count)
        assert step == 1
        return stop - start


TableSlot = namedtuple("TableSlot", ["input_id", "table", "summary", "view"])


class DataTableView(gui.HScrollStepMixin, TableView):
    dataset: Table
    input_slot: TableSlot


class OWDataTable(OWWidget):
    name = "Data Table"
    description = "View the dataset in a spreadsheet."
    icon = "icons/Table.svg"
    priority = 50
    keywords = []

    buttons_area_orientation = Qt.Vertical

    class Inputs:
        data = Input("Data", Table, multiple=True)

    class Outputs:
        selected_data = Output("Selected Data", Table, default=True)
        annotated_data = Output(ANNOTATED_DATA_SIGNAL_NAME, Table)

    show_distributions = Setting(False)
    dist_color_RGB = Setting((220, 220, 220, 255))
    show_attribute_labels = Setting(True)
    select_rows = Setting(True)
    auto_commit = Setting(True)

    color_by_class = Setting(True)
    selected_rows = Setting([], schema_only=True)
    selected_cols = Setting([], schema_only=True)

    def __init__(self):
        super().__init__()

        self._inputs = OrderedDict()

        self.__pending_selected_rows = self.selected_rows
        self.selected_rows = None
        self.__pending_selected_cols = self.selected_cols
        self.selected_cols = None

        self.dist_color = QColor(*self.dist_color_RGB)

        info_box = gui.vBox(self.controlArea, "Info")
        self.info_text = gui.widgetLabel(info_box)
        self._set_input_summary(None)
        self._set_output_summary(None)
        gui.separator(self.controlArea)

        box = gui.vBox(self.controlArea, "Variables")
        self.c_show_attribute_labels = gui.checkBox(
            box, self, "show_attribute_labels",
            "Show variable labels (if present)",
            callback=self._on_show_variable_labels_changed)

        gui.checkBox(box, self, "show_distributions",
                     'Visualize numeric values',
                     callback=self._on_distribution_color_changed)
        gui.checkBox(box, self, "color_by_class", 'Color by instance classes',
                     callback=self._on_distribution_color_changed)

        box = gui.vBox(self.controlArea, "Selection")

        gui.checkBox(box, self, "select_rows", "Select full rows",
                     callback=self._on_select_rows_changed)

        gui.rubber(self.controlArea)

        reset = gui.button(
            None, self, "Restore Original Order", callback=self.restore_order,
            tooltip="Show rows in the original order", autoDefault=False)
        self.buttonsArea.layout().insertWidget(0, reset)
        gui.auto_send(self.buttonsArea, self, "auto_commit")

        # GUI with tabs
        self.tabs = gui.tabWidget(self.mainArea)
        self.tabs.currentChanged.connect(self._on_current_tab_changed)

    def copy_to_clipboard(self):
        self.copy()

    @staticmethod
    def sizeHint():
        return QSize(800, 500)

    @Inputs.data
    def set_dataset(self, data, tid=None):
        """Set the input dataset."""
        if data is not None:
            datasetname = getattr(data, "name", "Data")
            if tid in self._inputs:
                # update existing input slot
                slot = self._inputs[tid]
                view = slot.view
                # reset the (header) view state.
                view.setModel(None)
                view.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)
                assert self.tabs.indexOf(view) != -1
                self.tabs.setTabText(self.tabs.indexOf(view), datasetname)
            else:
                view = DataTableView()
                view.setSortingEnabled(True)

                if self.select_rows:
                    view.setSelectionBehavior(QTableView.SelectRows)

                header = view.horizontalHeader()
                header.setSectionsMovable(True)
                header.setSectionsClickable(True)
                header.setSortIndicatorShown(True)
                header.setSortIndicator(-1, Qt.AscendingOrder)

                # QHeaderView does not 'reset' the model sort column,
                # because there is no guaranty (requirement) that the
                # models understand the -1 sort column.
                def sort_reset(index, order):
                    if view.model() is not None and index == -1:
                        view.model().sort(index, order)

                header.sortIndicatorChanged.connect(sort_reset)
                self.tabs.addTab(view, datasetname)

            view.dataset = data
            self.tabs.setCurrentWidget(view)

            self._setup_table_view(view, data)
            slot = TableSlot(tid, data, table_summary(data), view)
            view.input_slot = slot
            self._inputs[tid] = slot

            self.tabs.setCurrentIndex(self.tabs.indexOf(view))

            self._set_input_summary(slot)

            if isinstance(slot.summary.len, concurrent.futures.Future):
                def update(_):
                    QMetaObject.invokeMethod(
                        self, "_update_info", Qt.QueuedConnection)

                slot.summary.len.add_done_callback(update)

        elif tid in self._inputs:
            slot = self._inputs.pop(tid)
            view = slot.view
            view.hide()
            view.deleteLater()
            self.tabs.removeTab(self.tabs.indexOf(view))

            current = self.tabs.currentWidget()
            if current is not None:
                self._set_input_summary(current.input_slot)
        else:
            self._set_input_summary(None)

        self.tabs.tabBar().setVisible(self.tabs.count() > 1)

        if data and self.__pending_selected_rows is not None:
            self.selected_rows = self.__pending_selected_rows
            self.__pending_selected_rows = None
        else:
            self.selected_rows = []

        if data and self.__pending_selected_cols is not None:
            self.selected_cols = self.__pending_selected_cols
            self.__pending_selected_cols = None
        else:
            self.selected_cols = []

        self.set_selection()
        self.unconditional_commit()

    def _setup_table_view(self, view, data):
        """Setup the `view` (QTableView) with `data` (Orange.data.Table)
        """
        if data is None:
            view.setModel(None)
            return

        datamodel = RichTableModel(data)

        rowcount = data.approx_len()

        if self.color_by_class and data.domain.has_discrete_class:
            color_schema = [
                QColor(*c) for c in data.domain.class_var.colors]
        else:
            color_schema = None
        if self.show_distributions:
            view.setItemDelegate(
                gui.TableBarItem(
                    self, color=self.dist_color, color_schema=color_schema)
            )
        else:
            view.setItemDelegate(QStyledItemDelegate(self))

        # Enable/disable view sorting based on data's type
        view.setSortingEnabled(is_sortable(data))
        header = view.horizontalHeader()
        header.setSectionsClickable(is_sortable(data))
        header.setSortIndicatorShown(is_sortable(data))
        header.sortIndicatorChanged.connect(self.update_selection)

        view.setModel(datamodel)

        vheader = view.verticalHeader()
        option = view.viewOptions()
        size = view.style().sizeFromContents(
            QStyle.CT_ItemViewItem, option,
            QSize(20, 20), view)

        vheader.setDefaultSectionSize(size.height() + 2)
        vheader.setMinimumSectionSize(5)
        vheader.setSectionResizeMode(QHeaderView.Fixed)

        # Limit the number of rows displayed in the QTableView
        # (workaround for QTBUG-18490 / QTBUG-28631)
        maxrows = (2 ** 31 - 1) // (vheader.defaultSectionSize() + 2)
        if rowcount > maxrows:
            sliceproxy = TableSliceProxy(
                parent=view, rowSlice=slice(0, maxrows))
            sliceproxy.setSourceModel(datamodel)
            # First reset the view (without this the header view retains
            # it's state - at this point invalid/broken)
            view.setModel(None)
            view.setModel(sliceproxy)

        assert view.model().rowCount() <= maxrows
        assert vheader.sectionSize(0) > 1 or datamodel.rowCount() == 0

        # update the header (attribute names)
        self._update_variable_labels(view)

        selmodel = BlockSelectionModel(
            view.model(), parent=view, selectBlocks=not self.select_rows)
        view.setSelectionModel(selmodel)
        view.selectionFinished.connect(self.update_selection)

    #noinspection PyBroadException
    def set_corner_text(self, table, text):
        """Set table corner text."""
        # As this is an ugly hack, do everything in
        # try - except blocks, as it may stop working in newer Qt.
        # pylint: disable=broad-except
        if not hasattr(table, "btn") and not hasattr(table, "btnfailed"):
            try:
                btn = table.findChild(QAbstractButton)

                class Efc(QObject):
                    @staticmethod
                    def eventFilter(o, e):
                        if (isinstance(o, QAbstractButton) and
                                e.type() == QEvent.Paint):
                            # paint by hand (borrowed from QTableCornerButton)
                            btn = o
                            opt = QStyleOptionHeader()
                            opt.initFrom(btn)
                            state = QStyle.State_None
                            if btn.isEnabled():
                                state |= QStyle.State_Enabled
                            if btn.isActiveWindow():
                                state |= QStyle.State_Active
                            if btn.isDown():
                                state |= QStyle.State_Sunken
                            opt.state = state
                            opt.rect = btn.rect()
                            opt.text = btn.text()
                            opt.position = QStyleOptionHeader.OnlyOneSection
                            painter = QStylePainter(btn)
                            painter.drawControl(QStyle.CE_Header, opt)
                            return True     # eat event
                        return False
                table.efc = Efc()
                # disconnect default handler for clicks and connect a new one, which supports
                # both selection and deselection of all data
                btn.clicked.disconnect()
                btn.installEventFilter(table.efc)
                btn.clicked.connect(self._on_select_all)
                table.btn = btn

                if sys.platform == "darwin":
                    btn.setAttribute(Qt.WA_MacSmallSize)

            except Exception:
                table.btnfailed = True

        if hasattr(table, "btn"):
            try:
                btn = table.btn
                btn.setText(text)
                opt = QStyleOptionHeader()
                opt.text = btn.text()
                s = btn.style().sizeFromContents(
                    QStyle.CT_HeaderSection,
                    opt, QSize(),
                    btn).expandedTo(QApplication.globalStrut())
                if s.isValid():
                    table.verticalHeader().setMinimumWidth(s.width())
            except Exception:
                pass

    def _set_input_summary(self, slot):
        def format_summary(summary):
            if isinstance(summary, ApproxSummary):
                length = summary.len.result() if summary.len.done() else \
                    summary.approx_len
            elif isinstance(summary, Summary):
                length = summary.len
            return length

        summary, details = self.info.NoInput, ""
        if slot:
            summary = format_summary(slot.summary)
            details = format_summary_details(slot.table)
        self.info.set_input_summary(summary, details)

        self.info_text.setText("\n".join(self._info_box_text(slot)))

    @staticmethod
    def _info_box_text(slot):
        def format_part(part):
            if isinstance(part, DenseArray):
                if not part.nans:
                    return ""
                perc = 100 * part.nans / (part.nans + part.non_nans)
                return f" ({perc:.1f} % missing data)"

            if isinstance(part, SparseArray):
                tag = "sparse"
            elif isinstance(part, SparseBoolArray):
                tag = "tags"
            else:  # isinstance(part, NotAvailable)
                return ""
            dens = 100 * part.non_nans / (part.nans + part.non_nans)
            return f" ({tag}, density {dens:.2f} %)"

        def desc(n, part):
            if n == 0:
                return f"No {part}s"
            elif n == 1:
                return f"1 {part}"
            else:
                return f"{n} {part}s"

        if slot is None:
            return ["No data."]
        summary = slot.summary
        text = []
        if isinstance(summary, ApproxSummary):
            if summary.len.done():
                text.append(f"{summary.len.result()} instances")
            else:
                text.append(f"~{summary.approx_len} instances")
        elif isinstance(summary, Summary):
            text.append(f"{summary.len} instances")
            if sum(p.nans for p in [summary.X, summary.Y, summary.M]) == 0:
                text[-1] += " (no missing data)"

        text.append(desc(len(summary.domain.attributes), "feature")
                    + format_part(summary.X))

        if not summary.domain.class_vars:
            text.append("No target variable.")
        else:
            if len(summary.domain.class_vars) > 1:
                c_text = desc(len(summary.domain.class_vars), "outcome")
            elif summary.domain.has_continuous_class:
                c_text = "Numeric outcome"
            else:
                c_text = "Target with " \
                    + desc(len(summary.domain.class_var.values), "value")
            text.append(c_text + format_part(summary.Y))

        text.append(desc(len(summary.domain.metas), "meta attribute")
                    + format_part(summary.M))
        return text

    def _set_output_summary(self, output):
        summary = len(output) if output else self.info.NoOutput
        details = format_summary_details(output) if output else ""
        self.info.set_output_summary(summary, details)

    def _on_select_all(self, _):
        data_info = self.tabs.currentWidget().input_slot.summary
        if len(self.selected_rows) == data_info.len \
                and len(self.selected_cols) == len(data_info.domain):
            self.tabs.currentWidget().clearSelection()
        else:
            self.tabs.currentWidget().selectAll()

    def _on_current_tab_changed(self, index):
        """Update the status bar on current tab change"""
        view = self.tabs.widget(index)
        if view is not None and view.model() is not None:
            self._set_input_summary(view.input_slot)
            self.update_selection()
        else:
            self._set_input_summary(None)

    def _update_variable_labels(self, view):
        "Update the variable labels visibility for `view`"
        model = view.model()
        if isinstance(model, TableSliceProxy):
            model = model.sourceModel()

        if self.show_attribute_labels:
            model.setRichHeaderFlags(
                RichTableModel.Labels | RichTableModel.Name)

            labelnames = set()
            domain = model.source.domain
            for a in itertools.chain(domain.metas, domain.variables):
                labelnames.update(a.attributes.keys())
            labelnames = sorted(
                [label for label in labelnames if not label.startswith("_")])
            self.set_corner_text(view, "\n".join([""] + labelnames))
        else:
            model.setRichHeaderFlags(RichTableModel.Name)
            self.set_corner_text(view, "")

    def _on_show_variable_labels_changed(self):
        """The variable labels (var.attribues) visibility was changed."""
        for slot in self._inputs.values():
            self._update_variable_labels(slot.view)

    def _on_distribution_color_changed(self):
        for ti in range(self.tabs.count()):
            widget = self.tabs.widget(ti)
            model = widget.model()
            while isinstance(model, QAbstractProxyModel):
                model = model.sourceModel()
            data = model.source
            class_var = data.domain.class_var
            if self.color_by_class and class_var and class_var.is_discrete:
                color_schema = [QColor(*c) for c in class_var.colors]
            else:
                color_schema = None
            if self.show_distributions:
                delegate = gui.TableBarItem(self, color=self.dist_color,
                                            color_schema=color_schema)
            else:
                delegate = QStyledItemDelegate(self)
            widget.setItemDelegate(delegate)
        tab = self.tabs.currentWidget()
        if tab:
            tab.reset()

    def _on_select_rows_changed(self):
        for slot in self._inputs.values():
            selection_model = slot.view.selectionModel()
            selection_model.setSelectBlocks(not self.select_rows)
            if self.select_rows:
                slot.view.setSelectionBehavior(QTableView.SelectRows)
                # Expand the current selection to full row selection.
                selection_model.select(
                    selection_model.selection(),
                    QItemSelectionModel.Select | QItemSelectionModel.Rows
                )
            else:
                slot.view.setSelectionBehavior(QTableView.SelectItems)

    def restore_order(self):
        """Restore the original data order of the current view."""
        table = self.tabs.currentWidget()
        if table is not None:
            table.horizontalHeader().setSortIndicator(-1, Qt.AscendingOrder)

    @Slot()
    def _update_info(self):
        current = self.tabs.currentWidget()
        if current is not None and current.model() is not None:
            self._set_input_summary(current.input_slot)

    def update_selection(self, *_):
        self.commit()

    def set_selection(self):
        if self.selected_rows and self.selected_cols:
            view = self.tabs.currentWidget()
            model = view.model()
            if model.rowCount() <= self.selected_rows[-1] or \
                    model.columnCount() <= self.selected_cols[-1]:
                return

            selection = QItemSelection()
            rowranges = list(ranges(self.selected_rows))
            colranges = list(ranges(self.selected_cols))

            for rowstart, rowend in rowranges:
                for colstart, colend in colranges:
                    selection.append(
                        QItemSelectionRange(
                            view.model().index(rowstart, colstart),
                            view.model().index(rowend - 1, colend - 1)
                        )
                    )
            view.selectionModel().select(
                selection, QItemSelectionModel.ClearAndSelect)

    @staticmethod
    def get_selection(view):
        """
        Return the selected row and column indices of the selection in view.
        """
        selmodel = view.selectionModel()

        selection = selmodel.selection()
        model = view.model()
        # map through the proxies into input table.
        while isinstance(model, QAbstractProxyModel):
            selection = model.mapSelectionToSource(selection)
            model = model.sourceModel()

        assert isinstance(selmodel, BlockSelectionModel)
        assert isinstance(model, TableModel)

        row_spans, col_spans = selection_blocks(selection)
        rows = list(itertools.chain.from_iterable(itertools.starmap(range, row_spans)))
        cols = list(itertools.chain.from_iterable(itertools.starmap(range, col_spans)))
        rows = numpy.array(rows, dtype=numpy.intp)
        # map the rows through the applied sorting (if any)
        rows = model.mapToSourceRows(rows)
        rows = rows.tolist()
        return rows, cols

    @staticmethod
    def _get_model(view):
        model = view.model()
        while isinstance(model, QAbstractProxyModel):
            model = model.sourceModel()
        return model

    def commit(self):
        """
        Commit/send the current selected row/column selection.
        """
        selected_data = table = rowsel = None
        view = self.tabs.currentWidget()
        if view and view.model() is not None:
            model = self._get_model(view)
            table = model.source  # The input data table

            # Selections of individual instances are not implemented
            # for SqlTables
            if isinstance(table, SqlTable):
                self._set_output_summary(selected_data)
                self.Outputs.selected_data.send(selected_data)
                self.Outputs.annotated_data.send(None)
                return

            rowsel, colsel = self.get_selection(view)
            self.selected_rows, self.selected_cols = rowsel, colsel

            domain = table.domain

            if len(colsel) < len(domain) + len(domain.metas):
                # only a subset of the columns is selected
                allvars = domain.class_vars + domain.metas + domain.attributes
                columns = [(c, model.headerData(c, Qt.Horizontal,
                                                TableModel.DomainRole))
                           for c in colsel]
                assert all(role is not None for _, role in columns)

                def select_vars(role):
                    """select variables for role (TableModel.DomainRole)"""
                    return [allvars[c] for c, r in columns if r == role]

                attrs = select_vars(TableModel.Attribute)
                if attrs and issparse(table.X):
                    # for sparse data you can only select all attributes
                    attrs = table.domain.attributes
                class_vars = select_vars(TableModel.ClassVar)
                metas = select_vars(TableModel.Meta)
                domain = Orange.data.Domain(attrs, class_vars, metas)

            # Avoid a copy if none rows are selected.
            if not rowsel:
                selected_data = None
            else:
                selected_data = table.from_table(domain, table, rowsel)

        self._set_output_summary(selected_data)
        self.Outputs.selected_data.send(selected_data)
        self.Outputs.annotated_data.send(create_annotated_table(table, rowsel))

    def copy(self):
        """
        Copy current table selection to the clipboard.
        """
        view = self.tabs.currentWidget()
        if view is not None:
            mime = table_selection_to_mime_data(view)
            QApplication.clipboard().setMimeData(
                mime, QClipboard.Clipboard
            )

    def send_report(self):
        view = self.tabs.currentWidget()
        if not view or not view.model():
            return
        model = self._get_model(view)
        self.report_data_brief(model.source)
        self.report_table(view)


# Table Summary

# Basic statistics for X/Y/metas arrays
DenseArray = namedtuple(
    "DenseArray", ["nans", "non_nans", "stats"])
SparseArray = namedtuple(
    "SparseArray", ["nans", "non_nans", "stats"])
SparseBoolArray = namedtuple(
    "SparseBoolArray", ["nans", "non_nans", "stats"])
NotAvailable = namedtuple("NotAvailable", [])

#: Orange.data.Table summary
Summary = namedtuple(
    "Summary",
    ["len", "domain", "X", "Y", "M"])

#: Orange.data.sql.table.SqlTable summary
ApproxSummary = namedtuple(
    "ApproxSummary",
    ["approx_len", "len", "domain", "X", "Y", "M"])


def table_summary(table):
    if isinstance(table, SqlTable):
        approx_len = table.approx_len()
        len_future = concurrent.futures.Future()

        def _len():
            len_future.set_result(len(table))
        threading.Thread(target=_len).start()  # KILL ME !!!

        return ApproxSummary(approx_len, len_future, table.domain,
                             NotAvailable(), NotAvailable(), NotAvailable())
    else:
        domain = table.domain
        n_instances = len(table)
        # dist = basic_stats.DomainBasicStats(table, include_metas=True)
        bstats = datacaching.getCached(
            table, basic_stats.DomainBasicStats, (table, True)
        )

        dist = bstats.stats
        # pylint: disable=unbalanced-tuple-unpacking
        X_dist, Y_dist, M_dist = numpy.split(
            dist, numpy.cumsum([len(domain.attributes),
                                len(domain.class_vars)]))

        def parts(array, density, col_dist):
            array = numpy.atleast_2d(array)
            nans = sum([dist.nans for dist in col_dist])
            non_nans = sum([dist.non_nans for dist in col_dist])
            if density == Storage.DENSE:
                return DenseArray(nans, non_nans, col_dist)
            elif density == Storage.SPARSE:
                return SparseArray(nans, non_nans, col_dist)
            elif density == Storage.SPARSE_BOOL:
                return SparseBoolArray(nans, non_nans, col_dist)
            elif density == Storage.MISSING:
                return NotAvailable()
            else:
                assert False
                return None

        X_part = parts(table.X, table.X_density(), X_dist)
        Y_part = parts(table.Y, table.Y_density(), Y_dist)
        M_part = parts(table.metas, table.metas_density(), M_dist)
        return Summary(n_instances, domain, X_part, Y_part, M_part)


def is_sortable(table):
    if isinstance(table, SqlTable):
        return False
    elif isinstance(table, Orange.data.Table):
        return True
    else:
        return False


if __name__ == "__main__":  # pragma: no cover
    WidgetPreview(OWDataTable).run(
        [(Table("iris"), "iris"),
         (Table("brown-selected"), "brown-selected"),
         (Table("housing"), "housing")])

```
--- END FILE ---

Please first localize the bug based on the issue statement, and then generate *SEARCH/REPLACE* edits to fix the issue.

Every *SEARCH/REPLACE* edit must use this format:
1. The file path
2. The start of search block: <<<<<<< SEARCH
3. A contiguous chunk of lines to search for in the existing source code
4. The dividing line: =======
5. The lines to replace into the source code
6. The end of the replace block: >>>>>>> REPLACE

Here is an example:

```python
### mathweb/flask/app.py
<<<<<<< SEARCH
from flask import Flask
=======
import math
from flask import Flask
>>>>>>> REPLACE
```
</solution>

Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. If you would like to add the line '        print(x)', you must fully write that out, with all those spaces before the code!
Wrap each *SEARCH/REPLACE* edit in a code block as shown in the example above. If you have multiple *SEARCH/REPLACE* edits, use a separate code block for each one.
user