{
    "file_diffs": [
        {
            "old_file_content": "import sys\nimport threading\nimport itertools\nimport concurrent.futures\n\nfrom collections import namedtuple\nfrom typing import List, Optional\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\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.itemdelegates import TableDataDelegate\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, MultiInput, 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 TableBarItemDelegate(gui.TableBarItem, TableDataDelegate):\n    pass\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    class Inputs:\n        data = MultiInput(\"Data\", Table, auto_summary=False, filter_none=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    buttons_area_orientation = Qt.Vertical\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        self._inputs: List[TableSlot] = []\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\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        gui.button(self.buttonsArea, self, \"Restore Original Order\",\n                   callback=self.restore_order,\n                   tooltip=\"Show rows in the original order\",\n                   autoDefault=False,\n                   attribute=Qt.WA_LayoutUsesWidgetRect)\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    def _create_table_view(self):\n        view = DataTableView()\n        view.setSortingEnabled(True)\n        view.setItemDelegate(TableDataDelegate(view))\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        header.sortIndicatorChanged.connect(sort_reset)\n        return view\n\n    @Inputs.data\n    def set_dataset(self, index: int, data: Table):\n        \"\"\"Set the input dataset.\"\"\"\n        datasetname = getattr(data, \"name\", \"Data\")\n        slot = self._inputs[index]\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        view.dataset = data\n        slot = TableSlot(index, data, table_summary(data), view)\n        view.input_slot = slot\n        self._inputs[index] = slot\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.insert\n    def insert_dataset(self, index: int, data: Table):\n        datasetname = getattr(data, \"name\", \"Data\")\n        view = self._create_table_view()\n        slot = TableSlot(None, data, table_summary(data), view)\n        view.dataset = data\n        view.input_slot = slot\n        self._inputs.insert(index, slot)\n        self.tabs.insertTab(index, view, datasetname)\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.remove\n    def remove_dataset(self, index):\n        slot = self._inputs.pop(index)\n        view = slot.view\n        self.tabs.removeTab(self.tabs.indexOf(view))\n        view.setModel(None)\n        view.hide()\n        view.deleteLater()\n\n        current = self.tabs.currentWidget()\n        if current is not None:\n            self._set_input_summary(current.input_slot)\n\n    def handleNewSignals(self):\n        super().handleNewSignals()\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n        data: Optional[Table] = None\n        current = self.tabs.currentWidget()\n        slot = None\n        if current is not None:\n            data = current.dataset\n            slot = current.input_slot\n\n        if slot and isinstance(slot.summary.len, concurrent.futures.Future):\n            def update(_):\n                QMetaObject.invokeMethod(\n                    self, \"_update_info\", Qt.QueuedConnection)\n            slot.summary.len.add_done_callback(update)\n        self._set_input_summary(slot)\n\n        if data is not None 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        datamodel = RichTableModel(data)\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                TableBarItemDelegate(\n                    view, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(TableDataDelegate(view))\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)\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 _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.variables):\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 = TableBarItemDelegate(widget, color=self.dist_color,\n                                                color_schema=color_schema)\n            else:\n                delegate = TableDataDelegate(widget)\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.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.variables) + 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.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        insert_dataset=[\n            (0, Table(\"iris\")),\n            (1, Table(\"brown-selected\")),\n            (2, Table(\"housing\"))\n        ])\n",
            "new_file_content": "import sys\nimport threading\nimport itertools\nimport concurrent.futures\n\nfrom collections import namedtuple\nfrom typing import List, Optional\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\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.itemdelegates import TableDataDelegate\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, MultiInput, 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 TableBarItemDelegate(gui.TableBarItem, TableDataDelegate):\n    pass\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    class Inputs:\n        data = MultiInput(\"Data\", Table, auto_summary=False, filter_none=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    buttons_area_orientation = Qt.Vertical\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        self._inputs: List[TableSlot] = []\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\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        gui.button(self.buttonsArea, self, \"Restore Original Order\",\n                   callback=self.restore_order,\n                   tooltip=\"Show rows in the original order\",\n                   autoDefault=False,\n                   attribute=Qt.WA_LayoutUsesWidgetRect)\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    def _create_table_view(self):\n        view = DataTableView()\n        view.setSortingEnabled(True)\n        view.setItemDelegate(TableDataDelegate(view))\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        header.sortIndicatorChanged.connect(sort_reset)\n        return view\n\n    @Inputs.data\n    def set_dataset(self, index: int, data: Table):\n        \"\"\"Set the input dataset.\"\"\"\n        datasetname = getattr(data, \"name\", \"Data\")\n        slot = self._inputs[index]\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        view.dataset = data\n        slot = TableSlot(index, data, table_summary(data), view)\n        view.input_slot = slot\n        self._inputs[index] = slot\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.insert\n    def insert_dataset(self, index: int, data: Table):\n        datasetname = getattr(data, \"name\", \"Data\")\n        view = self._create_table_view()\n        slot = TableSlot(None, data, table_summary(data), view)\n        view.dataset = data\n        view.input_slot = slot\n        self._inputs.insert(index, slot)\n        self.tabs.insertTab(index, view, datasetname)\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.remove\n    def remove_dataset(self, index):\n        slot = self._inputs.pop(index)\n        view = slot.view\n        self.tabs.removeTab(self.tabs.indexOf(view))\n        view.setModel(None)\n        view.hide()\n        view.deleteLater()\n\n        current = self.tabs.currentWidget()\n        if current is not None:\n            self._set_input_summary(current.input_slot)\n\n    def handleNewSignals(self):\n        super().handleNewSignals()\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n        data: Optional[Table] = None\n        current = self.tabs.currentWidget()\n        slot = None\n        if current is not None:\n            data = current.dataset\n            slot = current.input_slot\n\n        if slot and isinstance(slot.summary.len, concurrent.futures.Future):\n            def update(_):\n                QMetaObject.invokeMethod(\n                    self, \"_update_info\", Qt.QueuedConnection)\n            slot.summary.len.add_done_callback(update)\n        self._set_input_summary(slot)\n\n        if data is not None 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        datamodel = RichTableModel(data)\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                TableBarItemDelegate(\n                    view, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(TableDataDelegate(view))\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)\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 _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.variables):\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:\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 = TableBarItemDelegate(widget, color=self.dist_color,\n                                                color_schema=color_schema)\n            else:\n                delegate = TableDataDelegate(widget)\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:\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.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.variables) + 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.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        insert_dataset=[\n            (0, Table(\"iris\")),\n            (1, Table(\"brown-selected\")),\n            (2, Table(\"housing\"))\n        ])\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/data/owtable.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "f8fa6b302",
                "new_commit_hash": "87fc04ba5",
                "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": 593,
                            "length": 7
                        },
                        "new_range": {
                            "start": 593,
                            "length": 7
                        },
                        "section": "class OWDataTable(OWWidget):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def _on_show_variable_labels_changed(self):",
                                "type": "context"
                            },
                            {
                                "content": "        \"\"\"The variable labels (var.attribues) visibility was changed.\"\"\"",
                                "type": "context"
                            },
                            {
                                "content": "        for slot in self._inputs.values():",
                                "type": "deleted"
                            },
                            {
                                "content": "        for slot in self._inputs:",
                                "type": "added"
                            },
                            {
                                "content": "            self._update_variable_labels(slot.view)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def _on_distribution_color_changed(self):",
                                "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    class Inputs:\n        data = MultiInput(\"Data\", Table, auto_summary=False, filter_none=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    buttons_area_orientation = Qt.Vertical\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        self._inputs: List[TableSlot] = []\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\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        gui.button(self.buttonsArea, self, \"Restore Original Order\",\n                   callback=self.restore_order,\n                   tooltip=\"Show rows in the original order\",\n                   autoDefault=False,\n                   attribute=Qt.WA_LayoutUsesWidgetRect)\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    def _create_table_view(self):\n        view = DataTableView()\n        view.setSortingEnabled(True)\n        view.setItemDelegate(TableDataDelegate(view))\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        header.sortIndicatorChanged.connect(sort_reset)\n        return view\n\n    @Inputs.data\n    def set_dataset(self, index: int, data: Table):\n        \"\"\"Set the input dataset.\"\"\"\n        datasetname = getattr(data, \"name\", \"Data\")\n        slot = self._inputs[index]\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        view.dataset = data\n        slot = TableSlot(index, data, table_summary(data), view)\n        view.input_slot = slot\n        self._inputs[index] = slot\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.insert\n    def insert_dataset(self, index: int, data: Table):\n        datasetname = getattr(data, \"name\", \"Data\")\n        view = self._create_table_view()\n        slot = TableSlot(None, data, table_summary(data), view)\n        view.dataset = data\n        view.input_slot = slot\n        self._inputs.insert(index, slot)\n        self.tabs.insertTab(index, view, datasetname)\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.remove\n    def remove_dataset(self, index):\n        slot = self._inputs.pop(index)\n        view = slot.view\n        self.tabs.removeTab(self.tabs.indexOf(view))\n        view.setModel(None)\n        view.hide()\n        view.deleteLater()\n\n        current = self.tabs.currentWidget()\n        if current is not None:\n            self._set_input_summary(current.input_slot)\n\n    def handleNewSignals(self):\n        super().handleNewSignals()\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n        data: Optional[Table] = None\n        current = self.tabs.currentWidget()\n        slot = None\n        if current is not None:\n            data = current.dataset\n            slot = current.input_slot\n\n        if slot and isinstance(slot.summary.len, concurrent.futures.Future):\n            def update(_):\n                QMetaObject.invokeMethod(\n                    self, \"_update_info\", Qt.QueuedConnection)\n            slot.summary.len.add_done_callback(update)\n        self._set_input_summary(slot)\n\n        if data is not None 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        datamodel = RichTableModel(data)\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                TableBarItemDelegate(\n                    view, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(TableDataDelegate(view))\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)\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 _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.variables):\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 = TableBarItemDelegate(widget, color=self.dist_color,\n                                                color_schema=color_schema)\n            else:\n                delegate = TableDataDelegate(widget)\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.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.variables) + 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.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": 179,
                            "end_lineno": 774,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/widgets/data/owtable.py",
                            "type": "method",
                            "name": "OWDataTable._on_show_variable_labels_changed",
                            "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    class Inputs:\n        data = MultiInput(\"Data\", Table, auto_summary=False, filter_none=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    buttons_area_orientation = Qt.Vertical\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        self._inputs: List[TableSlot] = []\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\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        gui.button(self.buttonsArea, self, \"Restore Original Order\",\n                   callback=self.restore_order,\n                   tooltip=\"Show rows in the original order\",\n                   autoDefault=False,\n                   attribute=Qt.WA_LayoutUsesWidgetRect)\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    def _create_table_view(self):\n        view = DataTableView()\n        view.setSortingEnabled(True)\n        view.setItemDelegate(TableDataDelegate(view))\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        header.sortIndicatorChanged.connect(sort_reset)\n        return view\n\n    @Inputs.data\n    def set_dataset(self, index: int, data: Table):\n        \"\"\"Set the input dataset.\"\"\"\n        datasetname = getattr(data, \"name\", \"Data\")\n        slot = self._inputs[index]\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        view.dataset = data\n        slot = TableSlot(index, data, table_summary(data), view)\n        view.input_slot = slot\n        self._inputs[index] = slot\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.insert\n    def insert_dataset(self, index: int, data: Table):\n        datasetname = getattr(data, \"name\", \"Data\")\n        view = self._create_table_view()\n        slot = TableSlot(None, data, table_summary(data), view)\n        view.dataset = data\n        view.input_slot = slot\n        self._inputs.insert(index, slot)\n        self.tabs.insertTab(index, view, datasetname)\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.remove\n    def remove_dataset(self, index):\n        slot = self._inputs.pop(index)\n        view = slot.view\n        self.tabs.removeTab(self.tabs.indexOf(view))\n        view.setModel(None)\n        view.hide()\n        view.deleteLater()\n\n        current = self.tabs.currentWidget()\n        if current is not None:\n            self._set_input_summary(current.input_slot)\n\n    def handleNewSignals(self):\n        super().handleNewSignals()\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n        data: Optional[Table] = None\n        current = self.tabs.currentWidget()\n        slot = None\n        if current is not None:\n            data = current.dataset\n            slot = current.input_slot\n\n        if slot and isinstance(slot.summary.len, concurrent.futures.Future):\n            def update(_):\n                QMetaObject.invokeMethod(\n                    self, \"_update_info\", Qt.QueuedConnection)\n            slot.summary.len.add_done_callback(update)\n        self._set_input_summary(slot)\n\n        if data is not None 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        datamodel = RichTableModel(data)\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                TableBarItemDelegate(\n                    view, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(TableDataDelegate(view))\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)\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 _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.variables):\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 = TableBarItemDelegate(widget, color=self.dist_color,\n                                                color_schema=color_schema)\n            else:\n                delegate = TableDataDelegate(widget)\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.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.variables) + 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.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": 594,
                            "end_lineno": 597,
                            "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    class Inputs:\n        data = MultiInput(\"Data\", Table, auto_summary=False, filter_none=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    buttons_area_orientation = Qt.Vertical\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        self._inputs: List[TableSlot] = []\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\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        gui.button(self.buttonsArea, self, \"Restore Original Order\",\n                   callback=self.restore_order,\n                   tooltip=\"Show rows in the original order\",\n                   autoDefault=False,\n                   attribute=Qt.WA_LayoutUsesWidgetRect)\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    def _create_table_view(self):\n        view = DataTableView()\n        view.setSortingEnabled(True)\n        view.setItemDelegate(TableDataDelegate(view))\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        header.sortIndicatorChanged.connect(sort_reset)\n        return view\n\n    @Inputs.data\n    def set_dataset(self, index: int, data: Table):\n        \"\"\"Set the input dataset.\"\"\"\n        datasetname = getattr(data, \"name\", \"Data\")\n        slot = self._inputs[index]\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        view.dataset = data\n        slot = TableSlot(index, data, table_summary(data), view)\n        view.input_slot = slot\n        self._inputs[index] = slot\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.insert\n    def insert_dataset(self, index: int, data: Table):\n        datasetname = getattr(data, \"name\", \"Data\")\n        view = self._create_table_view()\n        slot = TableSlot(None, data, table_summary(data), view)\n        view.dataset = data\n        view.input_slot = slot\n        self._inputs.insert(index, slot)\n        self.tabs.insertTab(index, view, datasetname)\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.remove\n    def remove_dataset(self, index):\n        slot = self._inputs.pop(index)\n        view = slot.view\n        self.tabs.removeTab(self.tabs.indexOf(view))\n        view.setModel(None)\n        view.hide()\n        view.deleteLater()\n\n        current = self.tabs.currentWidget()\n        if current is not None:\n            self._set_input_summary(current.input_slot)\n\n    def handleNewSignals(self):\n        super().handleNewSignals()\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n        data: Optional[Table] = None\n        current = self.tabs.currentWidget()\n        slot = None\n        if current is not None:\n            data = current.dataset\n            slot = current.input_slot\n\n        if slot and isinstance(slot.summary.len, concurrent.futures.Future):\n            def update(_):\n                QMetaObject.invokeMethod(\n                    self, \"_update_info\", Qt.QueuedConnection)\n            slot.summary.len.add_done_callback(update)\n        self._set_input_summary(slot)\n\n        if data is not None 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        datamodel = RichTableModel(data)\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                TableBarItemDelegate(\n                    view, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(TableDataDelegate(view))\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)\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 _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.variables):\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 = TableBarItemDelegate(widget, color=self.dist_color,\n                                                color_schema=color_schema)\n            else:\n                delegate = TableDataDelegate(widget)\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.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.variables) + 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.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": 179,
                                "end_lineno": 774,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 619,
                            "length": 7
                        },
                        "new_range": {
                            "start": 619,
                            "length": 7
                        },
                        "section": "class OWDataTable(OWWidget):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "            tab.reset()",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def _on_select_rows_changed(self):",
                                "type": "context"
                            },
                            {
                                "content": "        for slot in self._inputs.values():",
                                "type": "deleted"
                            },
                            {
                                "content": "        for slot in self._inputs:",
                                "type": "added"
                            },
                            {
                                "content": "            selection_model = slot.view.selectionModel()",
                                "type": "context"
                            },
                            {
                                "content": "            selection_model.setSelectBlocks(not self.select_rows)",
                                "type": "context"
                            },
                            {
                                "content": "            if self.select_rows:",
                                "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    class Inputs:\n        data = MultiInput(\"Data\", Table, auto_summary=False, filter_none=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    buttons_area_orientation = Qt.Vertical\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        self._inputs: List[TableSlot] = []\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\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        gui.button(self.buttonsArea, self, \"Restore Original Order\",\n                   callback=self.restore_order,\n                   tooltip=\"Show rows in the original order\",\n                   autoDefault=False,\n                   attribute=Qt.WA_LayoutUsesWidgetRect)\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    def _create_table_view(self):\n        view = DataTableView()\n        view.setSortingEnabled(True)\n        view.setItemDelegate(TableDataDelegate(view))\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        header.sortIndicatorChanged.connect(sort_reset)\n        return view\n\n    @Inputs.data\n    def set_dataset(self, index: int, data: Table):\n        \"\"\"Set the input dataset.\"\"\"\n        datasetname = getattr(data, \"name\", \"Data\")\n        slot = self._inputs[index]\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        view.dataset = data\n        slot = TableSlot(index, data, table_summary(data), view)\n        view.input_slot = slot\n        self._inputs[index] = slot\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.insert\n    def insert_dataset(self, index: int, data: Table):\n        datasetname = getattr(data, \"name\", \"Data\")\n        view = self._create_table_view()\n        slot = TableSlot(None, data, table_summary(data), view)\n        view.dataset = data\n        view.input_slot = slot\n        self._inputs.insert(index, slot)\n        self.tabs.insertTab(index, view, datasetname)\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.remove\n    def remove_dataset(self, index):\n        slot = self._inputs.pop(index)\n        view = slot.view\n        self.tabs.removeTab(self.tabs.indexOf(view))\n        view.setModel(None)\n        view.hide()\n        view.deleteLater()\n\n        current = self.tabs.currentWidget()\n        if current is not None:\n            self._set_input_summary(current.input_slot)\n\n    def handleNewSignals(self):\n        super().handleNewSignals()\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n        data: Optional[Table] = None\n        current = self.tabs.currentWidget()\n        slot = None\n        if current is not None:\n            data = current.dataset\n            slot = current.input_slot\n\n        if slot and isinstance(slot.summary.len, concurrent.futures.Future):\n            def update(_):\n                QMetaObject.invokeMethod(\n                    self, \"_update_info\", Qt.QueuedConnection)\n            slot.summary.len.add_done_callback(update)\n        self._set_input_summary(slot)\n\n        if data is not None 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        datamodel = RichTableModel(data)\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                TableBarItemDelegate(\n                    view, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(TableDataDelegate(view))\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)\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 _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.variables):\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 = TableBarItemDelegate(widget, color=self.dist_color,\n                                                color_schema=color_schema)\n            else:\n                delegate = TableDataDelegate(widget)\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.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.variables) + 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.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": 179,
                            "end_lineno": 774,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/widgets/data/owtable.py",
                            "type": "method",
                            "name": "OWDataTable._on_select_rows_changed",
                            "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    class Inputs:\n        data = MultiInput(\"Data\", Table, auto_summary=False, filter_none=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    buttons_area_orientation = Qt.Vertical\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        self._inputs: List[TableSlot] = []\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\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        gui.button(self.buttonsArea, self, \"Restore Original Order\",\n                   callback=self.restore_order,\n                   tooltip=\"Show rows in the original order\",\n                   autoDefault=False,\n                   attribute=Qt.WA_LayoutUsesWidgetRect)\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    def _create_table_view(self):\n        view = DataTableView()\n        view.setSortingEnabled(True)\n        view.setItemDelegate(TableDataDelegate(view))\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        header.sortIndicatorChanged.connect(sort_reset)\n        return view\n\n    @Inputs.data\n    def set_dataset(self, index: int, data: Table):\n        \"\"\"Set the input dataset.\"\"\"\n        datasetname = getattr(data, \"name\", \"Data\")\n        slot = self._inputs[index]\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        view.dataset = data\n        slot = TableSlot(index, data, table_summary(data), view)\n        view.input_slot = slot\n        self._inputs[index] = slot\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.insert\n    def insert_dataset(self, index: int, data: Table):\n        datasetname = getattr(data, \"name\", \"Data\")\n        view = self._create_table_view()\n        slot = TableSlot(None, data, table_summary(data), view)\n        view.dataset = data\n        view.input_slot = slot\n        self._inputs.insert(index, slot)\n        self.tabs.insertTab(index, view, datasetname)\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.remove\n    def remove_dataset(self, index):\n        slot = self._inputs.pop(index)\n        view = slot.view\n        self.tabs.removeTab(self.tabs.indexOf(view))\n        view.setModel(None)\n        view.hide()\n        view.deleteLater()\n\n        current = self.tabs.currentWidget()\n        if current is not None:\n            self._set_input_summary(current.input_slot)\n\n    def handleNewSignals(self):\n        super().handleNewSignals()\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n        data: Optional[Table] = None\n        current = self.tabs.currentWidget()\n        slot = None\n        if current is not None:\n            data = current.dataset\n            slot = current.input_slot\n\n        if slot and isinstance(slot.summary.len, concurrent.futures.Future):\n            def update(_):\n                QMetaObject.invokeMethod(\n                    self, \"_update_info\", Qt.QueuedConnection)\n            slot.summary.len.add_done_callback(update)\n        self._set_input_summary(slot)\n\n        if data is not None 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        datamodel = RichTableModel(data)\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                TableBarItemDelegate(\n                    view, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(TableDataDelegate(view))\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)\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 _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.variables):\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 = TableBarItemDelegate(widget, color=self.dist_color,\n                                                color_schema=color_schema)\n            else:\n                delegate = TableDataDelegate(widget)\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.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.variables) + 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.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": 621,
                            "end_lineno": 633,
                            "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    class Inputs:\n        data = MultiInput(\"Data\", Table, auto_summary=False, filter_none=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    buttons_area_orientation = Qt.Vertical\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        self._inputs: List[TableSlot] = []\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\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        gui.button(self.buttonsArea, self, \"Restore Original Order\",\n                   callback=self.restore_order,\n                   tooltip=\"Show rows in the original order\",\n                   autoDefault=False,\n                   attribute=Qt.WA_LayoutUsesWidgetRect)\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    def _create_table_view(self):\n        view = DataTableView()\n        view.setSortingEnabled(True)\n        view.setItemDelegate(TableDataDelegate(view))\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        header.sortIndicatorChanged.connect(sort_reset)\n        return view\n\n    @Inputs.data\n    def set_dataset(self, index: int, data: Table):\n        \"\"\"Set the input dataset.\"\"\"\n        datasetname = getattr(data, \"name\", \"Data\")\n        slot = self._inputs[index]\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        view.dataset = data\n        slot = TableSlot(index, data, table_summary(data), view)\n        view.input_slot = slot\n        self._inputs[index] = slot\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.insert\n    def insert_dataset(self, index: int, data: Table):\n        datasetname = getattr(data, \"name\", \"Data\")\n        view = self._create_table_view()\n        slot = TableSlot(None, data, table_summary(data), view)\n        view.dataset = data\n        view.input_slot = slot\n        self._inputs.insert(index, slot)\n        self.tabs.insertTab(index, view, datasetname)\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.remove\n    def remove_dataset(self, index):\n        slot = self._inputs.pop(index)\n        view = slot.view\n        self.tabs.removeTab(self.tabs.indexOf(view))\n        view.setModel(None)\n        view.hide()\n        view.deleteLater()\n\n        current = self.tabs.currentWidget()\n        if current is not None:\n            self._set_input_summary(current.input_slot)\n\n    def handleNewSignals(self):\n        super().handleNewSignals()\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n        data: Optional[Table] = None\n        current = self.tabs.currentWidget()\n        slot = None\n        if current is not None:\n            data = current.dataset\n            slot = current.input_slot\n\n        if slot and isinstance(slot.summary.len, concurrent.futures.Future):\n            def update(_):\n                QMetaObject.invokeMethod(\n                    self, \"_update_info\", Qt.QueuedConnection)\n            slot.summary.len.add_done_callback(update)\n        self._set_input_summary(slot)\n\n        if data is not None 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        datamodel = RichTableModel(data)\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                TableBarItemDelegate(\n                    view, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(TableDataDelegate(view))\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)\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 _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.variables):\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 = TableBarItemDelegate(widget, color=self.dist_color,\n                                                color_schema=color_schema)\n            else:\n                delegate = TableDataDelegate(widget)\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.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.variables) + 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.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": 179,
                                "end_lineno": 774,
                                "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.tests.utils import excepthook_catch\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.variables)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain.variables), 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.variables)))))\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.variables)))\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\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\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\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\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    def test_show_distributions(self):\n        w = self.widget\n        data = Table(\"heart_disease\")[::3].copy()\n        self.send_signal(w.Inputs.data, data, 0)\n        # run through the delegate paint routines\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.color_by_class.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\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.tests.utils import excepthook_catch\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.variables)))\n        self.widget.selected_rows = list(range(0, len(self.data), 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.variables)))))\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.variables)))\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\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\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\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\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    def test_show_distributions(self):\n        w = self.widget\n        data = Table(\"heart_disease\")[::3].copy()\n        self.send_signal(w.Inputs.data, data, 0)\n        # run through the delegate paint routines\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.color_by_class.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n\n    def test_whole_rows(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.select_rows)  # default value\n        with excepthook_catch():\n            w.controls.select_rows.toggle()\n        self.assertFalse(w.select_rows)\n        w.selected_cols = [0, 1]\n        w.selected_rows = [0, 1, 2, 3]\n        w.set_selection()\n        out = self.get_output(w.Outputs.selected_data)\n        self.assertEqual(out.domain,\n                         Domain([self.data.domain.attributes[0]], self.data.domain.class_var))\n        with excepthook_catch():\n            w.controls.select_rows.toggle()\n        out = self.get_output(w.Outputs.selected_data)\n        self.assertTrue(w.select_rows)\n        self.assertEqual(out.domain,\n                         self.data.domain)\n\n    def test_show_attribute_labels(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.show_attribute_labels)  # default value\n        with excepthook_catch():\n            w.controls.show_attribute_labels.toggle()\n        self.assertFalse(w.show_attribute_labels)\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": "9c01ee2ca",
                "new_commit_hash": "10d682c53",
                "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": 60,
                            "length": 7
                        },
                        "new_range": {
                            "start": 60,
                            "length": 7
                        },
                        "section": "class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def _select_data(self):",
                                "type": "context"
                            },
                            {
                                "content": "        self.widget.selected_cols = list(range(len(self.data.domain.variables)))",
                                "type": "context"
                            },
                            {
                                "content": "        self.widget.selected_rows = list(range(0, len(self.data.domain.variables), 10))",
                                "type": "deleted"
                            },
                            {
                                "content": "        self.widget.selected_rows = list(range(0, len(self.data), 10))",
                                "type": "added"
                            },
                            {
                                "content": "        self.widget.set_selection()",
                                "type": "context"
                            },
                            {
                                "content": "        return self.widget.selected_rows",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owtable.py",
                            "type": "method",
                            "name": "TestOWDataTable._select_data",
                            "content": "class 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.variables)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain.variables), 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.variables)))))\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.variables)))\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\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\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\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\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    def test_show_distributions(self):\n        w = self.widget\n        data = Table(\"heart_disease\")[::3].copy()\n        self.send_signal(w.Inputs.data, data, 0)\n        # run through the delegate paint routines\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.color_by_class.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 61,
                            "end_lineno": 65,
                            "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                                    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.variables)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain.variables), 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.variables)))))\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.variables)))\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\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\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\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\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    def test_show_distributions(self):\n        w = self.widget\n        data = Table(\"heart_disease\")[::3].copy()\n        self.send_signal(w.Inputs.data, data, 0)\n        # run through the delegate paint routines\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.color_by_class.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 19,
                                "end_lineno": 169,
                                "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                                    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.variables)))\n        self.widget.selected_rows = list(range(0, len(self.data.domain.variables), 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.variables)))))\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.variables)))\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\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\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\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\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    def test_show_distributions(self):\n        w = self.widget\n        data = Table(\"heart_disease\")[::3].copy()\n        self.send_signal(w.Inputs.data, data, 0)\n        # run through the delegate paint routines\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.color_by_class.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 19,
                            "end_lineno": 169,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 168,
                            "length": 6
                        },
                        "new_range": {
                            "start": 168,
                            "length": 34
                        },
                        "section": "class TestOWDataTable(WidgetTest, WidgetOutputsTestMixin, dbt):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "            w.grab()",
                                "type": "context"
                            },
                            {
                                "content": "        w.controls.show_distributions.toggle()",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_whole_rows(self):",
                                "type": "added"
                            },
                            {
                                "content": "        w = self.widget",
                                "type": "added"
                            },
                            {
                                "content": "        self.send_signal(w.Inputs.data, self.data, 0)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertTrue(w.select_rows)  # default value",
                                "type": "added"
                            },
                            {
                                "content": "        with excepthook_catch():",
                                "type": "added"
                            },
                            {
                                "content": "            w.controls.select_rows.toggle()",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertFalse(w.select_rows)",
                                "type": "added"
                            },
                            {
                                "content": "        w.selected_cols = [0, 1]",
                                "type": "added"
                            },
                            {
                                "content": "        w.selected_rows = [0, 1, 2, 3]",
                                "type": "added"
                            },
                            {
                                "content": "        w.set_selection()",
                                "type": "added"
                            },
                            {
                                "content": "        out = self.get_output(w.Outputs.selected_data)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(out.domain,",
                                "type": "added"
                            },
                            {
                                "content": "                         Domain([self.data.domain.attributes[0]], self.data.domain.class_var))",
                                "type": "added"
                            },
                            {
                                "content": "        with excepthook_catch():",
                                "type": "added"
                            },
                            {
                                "content": "            w.controls.select_rows.toggle()",
                                "type": "added"
                            },
                            {
                                "content": "        out = self.get_output(w.Outputs.selected_data)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertTrue(w.select_rows)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(out.domain,",
                                "type": "added"
                            },
                            {
                                "content": "                         self.data.domain)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_show_attribute_labels(self):",
                                "type": "added"
                            },
                            {
                                "content": "        w = self.widget",
                                "type": "added"
                            },
                            {
                                "content": "        self.send_signal(w.Inputs.data, self.data, 0)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertTrue(w.show_attribute_labels)  # default value",
                                "type": "added"
                            },
                            {
                                "content": "        with excepthook_catch():",
                                "type": "added"
                            },
                            {
                                "content": "            w.controls.show_attribute_labels.toggle()",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertFalse(w.show_attribute_labels)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "if __name__ == \"__main__\":",
                                "type": "context"
                            },
                            {
                                "content": "    unittest.main()",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "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                                    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.variables)))\n        self.widget.selected_rows = list(range(0, len(self.data), 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.variables)))))\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.variables)))\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\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\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\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\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    def test_show_distributions(self):\n        w = self.widget\n        data = Table(\"heart_disease\")[::3].copy()\n        self.send_signal(w.Inputs.data, data, 0)\n        # run through the delegate paint routines\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.color_by_class.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n\n    def test_whole_rows(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.select_rows)  # default value\n        with excepthook_catch():\n            w.controls.select_rows.toggle()\n        self.assertFalse(w.select_rows)\n        w.selected_cols = [0, 1]\n        w.selected_rows = [0, 1, 2, 3]\n        w.set_selection()\n        out = self.get_output(w.Outputs.selected_data)\n        self.assertEqual(out.domain,\n                         Domain([self.data.domain.attributes[0]], self.data.domain.class_var))\n        with excepthook_catch():\n            w.controls.select_rows.toggle()\n        out = self.get_output(w.Outputs.selected_data)\n        self.assertTrue(w.select_rows)\n        self.assertEqual(out.domain,\n                         self.data.domain)\n\n    def test_show_attribute_labels(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.show_attribute_labels)  # default value\n        with excepthook_catch():\n            w.controls.show_attribute_labels.toggle()\n        self.assertFalse(w.show_attribute_labels)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 19,
                            "end_lineno": 197,
                            "parent": null
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owtable.py",
                            "type": "method",
                            "name": "TestOWDataTable.test_whole_rows",
                            "content": "class 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.variables)))\n        self.widget.selected_rows = list(range(0, len(self.data), 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.variables)))))\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.variables)))\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\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\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\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\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    def test_show_distributions(self):\n        w = self.widget\n        data = Table(\"heart_disease\")[::3].copy()\n        self.send_signal(w.Inputs.data, data, 0)\n        # run through the delegate paint routines\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.color_by_class.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n\n    def test_whole_rows(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.select_rows)  # default value\n        with excepthook_catch():\n            w.controls.select_rows.toggle()\n        self.assertFalse(w.select_rows)\n        w.selected_cols = [0, 1]\n        w.selected_rows = [0, 1, 2, 3]\n        w.set_selection()\n        out = self.get_output(w.Outputs.selected_data)\n        self.assertEqual(out.domain,\n                         Domain([self.data.domain.attributes[0]], self.data.domain.class_var))\n        with excepthook_catch():\n            w.controls.select_rows.toggle()\n        out = self.get_output(w.Outputs.selected_data)\n        self.assertTrue(w.select_rows)\n        self.assertEqual(out.domain,\n                         self.data.domain)\n\n    def test_show_attribute_labels(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.show_attribute_labels)  # default value\n        with excepthook_catch():\n            w.controls.show_attribute_labels.toggle()\n        self.assertFalse(w.show_attribute_labels)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 171,
                            "end_lineno": 189,
                            "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                                    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.variables)))\n        self.widget.selected_rows = list(range(0, len(self.data), 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.variables)))))\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.variables)))\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\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\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\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\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    def test_show_distributions(self):\n        w = self.widget\n        data = Table(\"heart_disease\")[::3].copy()\n        self.send_signal(w.Inputs.data, data, 0)\n        # run through the delegate paint routines\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.color_by_class.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n\n    def test_whole_rows(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.select_rows)  # default value\n        with excepthook_catch():\n            w.controls.select_rows.toggle()\n        self.assertFalse(w.select_rows)\n        w.selected_cols = [0, 1]\n        w.selected_rows = [0, 1, 2, 3]\n        w.set_selection()\n        out = self.get_output(w.Outputs.selected_data)\n        self.assertEqual(out.domain,\n                         Domain([self.data.domain.attributes[0]], self.data.domain.class_var))\n        with excepthook_catch():\n            w.controls.select_rows.toggle()\n        out = self.get_output(w.Outputs.selected_data)\n        self.assertTrue(w.select_rows)\n        self.assertEqual(out.domain,\n                         self.data.domain)\n\n    def test_show_attribute_labels(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.show_attribute_labels)  # default value\n        with excepthook_catch():\n            w.controls.show_attribute_labels.toggle()\n        self.assertFalse(w.show_attribute_labels)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 19,
                                "end_lineno": 197,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/data/tests/test_owtable.py",
                            "type": "method",
                            "name": "TestOWDataTable.test_show_attribute_labels",
                            "content": "class 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.variables)))\n        self.widget.selected_rows = list(range(0, len(self.data), 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.variables)))))\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.variables)))\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\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\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\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\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    def test_show_distributions(self):\n        w = self.widget\n        data = Table(\"heart_disease\")[::3].copy()\n        self.send_signal(w.Inputs.data, data, 0)\n        # run through the delegate paint routines\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.color_by_class.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n\n    def test_whole_rows(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.select_rows)  # default value\n        with excepthook_catch():\n            w.controls.select_rows.toggle()\n        self.assertFalse(w.select_rows)\n        w.selected_cols = [0, 1]\n        w.selected_rows = [0, 1, 2, 3]\n        w.set_selection()\n        out = self.get_output(w.Outputs.selected_data)\n        self.assertEqual(out.domain,\n                         Domain([self.data.domain.attributes[0]], self.data.domain.class_var))\n        with excepthook_catch():\n            w.controls.select_rows.toggle()\n        out = self.get_output(w.Outputs.selected_data)\n        self.assertTrue(w.select_rows)\n        self.assertEqual(out.domain,\n                         self.data.domain)\n\n    def test_show_attribute_labels(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.show_attribute_labels)  # default value\n        with excepthook_catch():\n            w.controls.show_attribute_labels.toggle()\n        self.assertFalse(w.show_attribute_labels)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 191,
                            "end_lineno": 197,
                            "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                                    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.variables)))\n        self.widget.selected_rows = list(range(0, len(self.data), 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.variables)))))\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.variables)))\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\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\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\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\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    def test_show_distributions(self):\n        w = self.widget\n        data = Table(\"heart_disease\")[::3].copy()\n        self.send_signal(w.Inputs.data, data, 0)\n        # run through the delegate paint routines\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.color_by_class.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n\n    def test_whole_rows(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.select_rows)  # default value\n        with excepthook_catch():\n            w.controls.select_rows.toggle()\n        self.assertFalse(w.select_rows)\n        w.selected_cols = [0, 1]\n        w.selected_rows = [0, 1, 2, 3]\n        w.set_selection()\n        out = self.get_output(w.Outputs.selected_data)\n        self.assertEqual(out.domain,\n                         Domain([self.data.domain.attributes[0]], self.data.domain.class_var))\n        with excepthook_catch():\n            w.controls.select_rows.toggle()\n        out = self.get_output(w.Outputs.selected_data)\n        self.assertTrue(w.select_rows)\n        self.assertEqual(out.domain,\n                         self.data.domain)\n\n    def test_show_attribute_labels(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.show_attribute_labels)  # default value\n        with excepthook_catch():\n            w.controls.show_attribute_labels.toggle()\n        self.assertFalse(w.show_attribute_labels)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 19,
                                "end_lineno": 197,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc^",
    "new_commit_hash": "c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc",
    "commit_message": "OWTable: fix select whole rows regression\n\nAnd add a test for the feature.",
    "commit_date": "2021-09-23T11:54:37+02:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc",
    "test_file_codes": [
        "# pylint: disable=protected-access\nimport unittest\n\n\nfrom unittest.mock import Mock, patch\nfrom AnyQt.QtCore import Qt\n\nfrom orangewidget.tests.utils import excepthook_catch\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.variables)))\n        self.widget.selected_rows = list(range(0, len(self.data), 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.variables)))))\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.variables)))\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\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\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\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\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    def test_show_distributions(self):\n        w = self.widget\n        data = Table(\"heart_disease\")[::3].copy()\n        self.send_signal(w.Inputs.data, data, 0)\n        # run through the delegate paint routines\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.color_by_class.toggle()\n        with excepthook_catch():\n            w.grab()\n        w.controls.show_distributions.toggle()\n\n    def test_whole_rows(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.select_rows)  # default value\n        with excepthook_catch():\n            w.controls.select_rows.toggle()\n        self.assertFalse(w.select_rows)\n        w.selected_cols = [0, 1]\n        w.selected_rows = [0, 1, 2, 3]\n        w.set_selection()\n        out = self.get_output(w.Outputs.selected_data)\n        self.assertEqual(out.domain,\n                         Domain([self.data.domain.attributes[0]], self.data.domain.class_var))\n        with excepthook_catch():\n            w.controls.select_rows.toggle()\n        out = self.get_output(w.Outputs.selected_data)\n        self.assertTrue(w.select_rows)\n        self.assertEqual(out.domain,\n                         self.data.domain)\n\n    def test_show_attribute_labels(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.show_attribute_labels)  # default value\n        with excepthook_catch():\n            w.controls.show_attribute_labels.toggle()\n        self.assertFalse(w.show_attribute_labels)\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n"
    ],
    "test_file_names": [
        "test_1.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.31.0.dev0+c4c4775 to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc\nProcessing dependencies for Orange3==3.31.0.dev0+c4c4775\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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for qtconsole==5.4.4\nBest match: qtconsole 5.4.4\nAdding qtconsole 5.4.4 to easy-install.pth file\nInstalling jupyter-qtconsole script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for pygments==2.17.2\nBest match: pygments 2.17.2\nAdding pygments 2.17.2 to easy-install.pth file\nInstalling pygmentize script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for httpx==0.19.0\nBest match: httpx 0.19.0\nAdding httpx 0.19.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling pyrcc5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling pyuic5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for ipykernel==6.16.2\nBest match: ipykernel 6.16.2\nAdding ipykernel 6.16.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for traitlets==5.9.0\nBest match: traitlets 5.9.0\nAdding traitlets 5.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for jupyter-client==7.4.9\nBest match: jupyter-client 7.4.9\nAdding jupyter-client 7.4.9 to easy-install.pth file\nInstalling jupyter-kernel script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling jupyter-kernelspec script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling jupyter-run script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for ipython-genutils==0.2.0\nBest match: ipython-genutils 0.2.0\nAdding ipython-genutils 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for jupyter-core==4.12.0\nBest match: jupyter-core 4.12.0\nAdding jupyter-core 4.12.0 to easy-install.pth file\nInstalling jupyter script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling jupyter-migrate script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling jupyter-troubleshoot script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for pyzmq==26.2.0\nBest match: pyzmq 26.2.0\nAdding pyzmq 26.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for QtPy==2.4.2\nBest match: QtPy 2.4.2\nAdding QtPy 2.4.2 to easy-install.pth file\nInstalling qtpy script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for httpcore==0.13.7\nBest match: httpcore 0.13.7\nAdding httpcore 0.13.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for ipython==7.34.0\nBest match: ipython 7.34.0\nAdding ipython 7.34.0 to easy-install.pth file\nInstalling iptest script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling iptest3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling ipython script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\nInstalling ipython3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for matplotlib-inline==0.1.6\nBest match: matplotlib-inline 0.1.6\nAdding matplotlib-inline 0.1.6 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for nest-asyncio==1.6.0\nBest match: nest-asyncio 1.6.0\nAdding nest-asyncio 1.6.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for psutil==6.1.1\nBest match: psutil 6.1.1\nAdding psutil 6.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for debugpy==1.7.0\nBest match: debugpy 1.7.0\nAdding debugpy 1.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for tornado==6.2\nBest match: tornado 6.2\nAdding tornado 6.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for entrypoints==0.4\nBest match: entrypoints 0.4\nAdding entrypoints 0.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for anyio==3.7.1\nBest match: anyio 3.7.1\nAdding anyio 3.7.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for h11==0.12.0\nBest match: h11 0.12.0\nAdding h11 0.12.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for jedi==0.19.2\nBest match: jedi 0.19.2\nAdding jedi 0.19.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for pexpect==4.9.0\nBest match: pexpect 4.9.0\nAdding pexpect 4.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for prompt-toolkit==3.0.48\nBest match: prompt-toolkit 3.0.48\nAdding prompt-toolkit 3.0.48 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for backcall==0.2.0\nBest match: backcall 0.2.0\nAdding backcall 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for decorator==5.1.1\nBest match: decorator 5.1.1\nAdding decorator 5.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for pickleshare==0.7.5\nBest match: pickleshare 0.7.5\nAdding pickleshare 0.7.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for parso==0.8.4\nBest match: parso 0.8.4\nAdding parso 0.8.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for ptyprocess==0.7.0\nBest match: ptyprocess 0.7.0\nAdding ptyprocess 0.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nSearching for wcwidth==0.2.13\nBest match: wcwidth 0.2.13\nAdding wcwidth 0.2.13 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.31.0.dev0+c4c4775\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 103ms\nPrepared 18 packages in 14ms\nInstalled 18 packages in 157ms\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 55 packages in 357ms\nInstalled 48 packages in 669ms\n + anyio==3.7.1\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.12.0\n + httpcore==0.13.7\n + httpx==0.19.0\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 59 packages in 403ms\nInstalled 38 packages in 560ms\n + anyqt==0.2.0\n + attrs==24.2.0\n + backcall==0.2.0\n + cattrs==23.1.2\n + commonmark==0.9.1\n + debugpy==1.7.0\n + decorator==5.1.1\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + entrypoints==0.4\n + ipykernel==6.16.2\n + ipython==7.34.0\n + ipython-genutils==0.2.0\n + jedi==0.19.2\n + jupyter-client==7.4.9\n + jupyter-core==4.12.0\n + matplotlib-inline==0.1.6\n + nest-asyncio==1.6.0\n + orange-canvas-core==0.1.35\n + orange-widget-base==4.22.0\n + parso==0.8.4\n + pexpect==4.9.0\n + pickleshare==0.7.5\n + platformdirs==4.0.0\n + prompt-toolkit==3.0.48\n + psutil==6.1.1\n + ptyprocess==0.7.0\n + pygments==2.17.2\n + pyqtgraph==0.12.4\n + pyzmq==26.2.0\n + qasync==0.25.0\n + qtconsole==5.4.4\n + qtpy==2.4.2\n + requests-cache==1.1.1\n + tornado==6.2\n + traitlets==5.9.0\n + url-normalize==1.4.3\n + wcwidth==0.2.13\nResolved 2 packages in 5ms\nInstalled 2 packages in 36ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nResolved 19 packages in 28ms\nInstalled 5 packages in 1.40s\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 1ms\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc\nplugins: anyio-3.7.1\ncollected 19 items\n\nr2e_tests/test_1.py sss................                                  [100%]\n\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_attrs_appear_in_corner_text\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_data_model\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_image_export\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_info\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_input_data\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_minimum_size\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_outputs\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_pending_selection\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_reset_select\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_show_attribute_labels\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_show_distributions\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_sorting\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_summary\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_unconditional_commit_on_new_signal\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_whole_rows\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:244: image exporting not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:238: minimum size not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:250: msg base class not tested as .widget was not set\n======================== 16 passed, 3 skipped in 5.20s =========================\nWidgets left: 0    Max widgets: 1257 \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_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc\nplugins: anyio-3.7.1\ncollected 19 items\n\nr2e_tests/test_1.py sss..........F....F                                  [100%]\n\n=================================== FAILURES ===================================\n__________________ TestOWDataTable.test_show_attribute_labels __________________\n\nself = <r2e_tests.test_1.TestOWDataTable testMethod=test_show_attribute_labels>\n\n    def test_show_attribute_labels(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.show_attribute_labels)  # default value\n        with excepthook_catch():\n>           w.controls.show_attribute_labels.toggle()\n\nr2e_tests/test_1.py:196: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib/python3.7/contextlib.py:119: in __exit__\n    next(self.gen)\n.venv/lib/python3.7/site-packages/orangewidget/tests/utils.py:167: in excepthook_catch\n    raise seen[0][1]\n.venv/lib/python3.7/site-packages/orangewidget/gui.py:2261: in __call__\n    self.func(**kwds)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <Orange.widgets.data.owtable.OWDataTable object at 0x7e7cf2cf2870>\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():\nE       AttributeError: 'list' object has no attribute 'values'\n\nOrange/widgets/data/owtable.py:596: AttributeError\n----------------------------- Captured stderr call -----------------------------\nTraceback (most recent call last):\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/orangewidget/gui.py\", line 2261, in __call__\n    self.func(**kwds)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/Orange/widgets/data/owtable.py\", line 596, in _on_show_variable_labels_changed\n    for slot in self._inputs.values():\nAttributeError: 'list' object has no attribute 'values'\n_______________________ TestOWDataTable.test_whole_rows ________________________\n\nself = <r2e_tests.test_1.TestOWDataTable testMethod=test_whole_rows>\n\n    def test_whole_rows(self):\n        w = self.widget\n        self.send_signal(w.Inputs.data, self.data, 0)\n        self.assertTrue(w.select_rows)  # default value\n        with excepthook_catch():\n>           w.controls.select_rows.toggle()\n\nr2e_tests/test_1.py:176: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n../../../../.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib/python3.7/contextlib.py:119: in __exit__\n    next(self.gen)\n.venv/lib/python3.7/site-packages/orangewidget/tests/utils.py:167: in excepthook_catch\n    raise seen[0][1]\n.venv/lib/python3.7/site-packages/orangewidget/gui.py:2261: in __call__\n    self.func(**kwds)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <Orange.widgets.data.owtable.OWDataTable object at 0x7e7cf294c9b0>\n\n    def _on_select_rows_changed(self):\n>       for slot in self._inputs.values():\nE       AttributeError: 'list' object has no attribute 'values'\n\nOrange/widgets/data/owtable.py:622: AttributeError\n----------------------------- Captured stderr call -----------------------------\nTraceback (most recent call last):\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/.venv/lib/python3.7/site-packages/orangewidget/gui.py\", line 2261, in __call__\n    self.func(**kwds)\n  File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_c4c47757fb51bc8b774fd9232d5ec4e3ab067cdc/Orange/widgets/data/owtable.py\", line 622, in _on_select_rows_changed\n    for slot in self._inputs.values():\nAttributeError: 'list' object has no attribute 'values'\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_attrs_appear_in_corner_text\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_data_model\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_image_export\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_info\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_input_data\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_minimum_size\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_outputs\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_pending_selection\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_reset_select\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_show_distributions\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_sorting\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_summary\nPASSED r2e_tests/test_1.py::TestOWDataTable::test_unconditional_commit_on_new_signal\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:244: image exporting not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:238: minimum size not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:250: msg base class not tested as .widget was not set\nFAILED r2e_tests/test_1.py::TestOWDataTable::test_show_attribute_labels - Att...\nFAILED r2e_tests/test_1.py::TestOWDataTable::test_whole_rows - AttributeError...\n=================== 2 failed, 14 passed, 3 skipped in 3.71s ====================\nWidgets left: 0    Max widgets: 1257 \n\n",
    "old_commit_res_stderr": ""
}
Orange/widgets/data/owtable.py Orange/widgets/data/tests/test_owtable.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]

**Title:** OWTable Widget: AttributeError When Toggling Row Selection or Variable Labels

**Description**
When using the OWTable widget, attempting to toggle the "Select Whole Rows" or "Show Variable Labels" options results in an `AttributeError`. This error occurs because the widget incorrectly tries to call the `.values()` method on a list object.

**Steps to Reproduce**
1. Initialize the OWTable widget and send data to it.
2. Attempt to toggle the "Select Whole Rows" option:
    ```python
    widget = OWDataTable()
    widget.send_signal(widget.Inputs.data, data, 0)
    widget.controls.select_rows.toggle()  # Raises AttributeError
    ```
3. Alternatively, attempt to toggle the "Show Variable Labels" option:
    ```python
    widget.controls.show_attribute_labels.toggle()  # Raises AttributeError
    ```

**Expected Behavior**
Toggling these options should update the widget's settings without any errors, allowing users to select whole rows or show/hide variable labels as intended.

**Actual Behavior**
An `AttributeError` is raised with the message:
```
AttributeError: 'list' object has no attribute 'values'
```
This prevents the widget from updating the selection or variable labels properly.

[/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 namedtuple
from typing import List, Optional

from math import isnan

import numpy
from scipy.sparse import issparse

from AnyQt.QtWidgets import (
    QTableView, QHeaderView, QAbstractButton, QApplication, QStyleOptionHeader,
    QStyle, QStylePainter
)
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.itemdelegates import TableDataDelegate
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, MultiInput, 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 TableBarItemDelegate(gui.TableBarItem, TableDataDelegate):
    pass


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

    class Inputs:
        data = MultiInput("Data", Table, auto_summary=False, filter_none=True)

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

    buttons_area_orientation = Qt.Vertical

    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)

    settings_version = 2

    def __init__(self):
        super().__init__()
        self._inputs: List[TableSlot] = []
        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)

        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)

        gui.button(self.buttonsArea, self, "Restore Original Order",
                   callback=self.restore_order,
                   tooltip="Show rows in the original order",
                   autoDefault=False,
                   attribute=Qt.WA_LayoutUsesWidgetRect)
        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)

    def _create_table_view(self):
        view = DataTableView()
        view.setSortingEnabled(True)
        view.setItemDelegate(TableDataDelegate(view))

        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)
        return view

    @Inputs.data
    def set_dataset(self, index: int, data: Table):
        """Set the input dataset."""
        datasetname = getattr(data, "name", "Data")
        slot = self._inputs[index]
        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)
        view.dataset = data
        slot = TableSlot(index, data, table_summary(data), view)
        view.input_slot = slot
        self._inputs[index] = slot
        self._setup_table_view(view, data)
        self.tabs.setCurrentWidget(view)

    @Inputs.data.insert
    def insert_dataset(self, index: int, data: Table):
        datasetname = getattr(data, "name", "Data")
        view = self._create_table_view()
        slot = TableSlot(None, data, table_summary(data), view)
        view.dataset = data
        view.input_slot = slot
        self._inputs.insert(index, slot)
        self.tabs.insertTab(index, view, datasetname)
        self._setup_table_view(view, data)
        self.tabs.setCurrentWidget(view)

    @Inputs.data.remove
    def remove_dataset(self, index):
        slot = self._inputs.pop(index)
        view = slot.view
        self.tabs.removeTab(self.tabs.indexOf(view))
        view.setModel(None)
        view.hide()
        view.deleteLater()

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

    def handleNewSignals(self):
        super().handleNewSignals()
        self.tabs.tabBar().setVisible(self.tabs.count() > 1)
        data: Optional[Table] = None
        current = self.tabs.currentWidget()
        slot = None
        if current is not None:
            data = current.dataset
            slot = current.input_slot

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

        if data is not None 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)
        """
        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(
                TableBarItemDelegate(
                    view, color=self.dist_color, color_schema=color_schema)
            )
        else:
            view.setItemDelegate(TableDataDelegate(view))

        # 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)
                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 _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.variables):
            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 = TableBarItemDelegate(widget, color=self.dist_color,
                                                color_schema=color_schema)
            else:
                delegate = TableDataDelegate(widget)
            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.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.variables) + 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)

            # Send all data by default
            if not rowsel:
                selected_data = table
            else:
                selected_data = table.from_table(domain, table, rowsel)

        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(
        insert_dataset=[
            (0, Table("iris")),
            (1, Table("brown-selected")),
            (2, Table("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:** OWTable Widget: AttributeError When Toggling Row Selection or Variable Labels

**Description**
When using the OWTable widget, attempting to toggle the "Select Whole Rows" or "Show Variable Labels" options results in an `AttributeError`. This error occurs because the widget incorrectly tries to call the `.values()` method on a list object.

**Steps to Reproduce**
1. Initialize the OWTable widget and send data to it.
2. Attempt to toggle the "Select Whole Rows" option:
    ```python
    widget = OWDataTable()
    widget.send_signal(widget.Inputs.data, data, 0)
    widget.controls.select_rows.toggle()  # Raises AttributeError
    ```
3. Alternatively, attempt to toggle the "Show Variable Labels" option:
    ```python
    widget.controls.show_attribute_labels.toggle()  # Raises AttributeError
    ```

**Expected Behavior**
Toggling these options should update the widget's settings without any errors, allowing users to select whole rows or show/hide variable labels as intended.

**Actual Behavior**
An `AttributeError` is raised with the message:
```
AttributeError: 'list' object has no attribute 'values'
```
This prevents the widget from updating the selection or variable labels properly.

[/ISSUE]
{
    "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_show_attribute_labels": "PASSED",
    "TestOWDataTable.test_show_distributions": "PASSED",
    "TestOWDataTable.test_sorting": "PASSED",
    "TestOWDataTable.test_summary": "PASSED",
    "TestOWDataTable.test_unconditional_commit_on_new_signal": "PASSED",
    "TestOWDataTable.test_whole_rows": "PASSED"
}
diff --git a/Orange/widgets/data/owtable.py b/Orange/widgets/data/owtable.py
index f8fa6b302..87fc04ba5 100644
--- a/Orange/widgets/data/owtable.py
+++ b/Orange/widgets/data/owtable.py
@@ -593,7 +593,7 @@ class OWDataTable(OWWidget):
 
     def _on_show_variable_labels_changed(self):
         """The variable labels (var.attribues) visibility was changed."""
-        for slot in self._inputs.values():
+        for slot in self._inputs:
             self._update_variable_labels(slot.view)
 
     def _on_distribution_color_changed(self):
@@ -619,7 +619,7 @@ class OWDataTable(OWWidget):
             tab.reset()
 
     def _on_select_rows_changed(self):
-        for slot in self._inputs.values():
+        for slot in self._inputs:
             selection_model = slot.view.selectionModel()
             selection_model.setSelectBlocks(not self.select_rows)
             if self.select_rows:

{"Orange/widgets/data/owtable.py": "import sys\nimport threading\nimport itertools\nimport concurrent.futures\n\nfrom collections import namedtuple\nfrom typing import List, Optional\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\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.itemdelegates import TableDataDelegate\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, MultiInput, 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 TableBarItemDelegate(gui.TableBarItem, TableDataDelegate):\n    pass\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    class Inputs:\n        data = MultiInput(\"Data\", Table, auto_summary=False, filter_none=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    buttons_area_orientation = Qt.Vertical\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        self._inputs: List[TableSlot] = []\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\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        gui.button(self.buttonsArea, self, \"Restore Original Order\",\n                   callback=self.restore_order,\n                   tooltip=\"Show rows in the original order\",\n                   autoDefault=False,\n                   attribute=Qt.WA_LayoutUsesWidgetRect)\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    def _create_table_view(self):\n        view = DataTableView()\n        view.setSortingEnabled(True)\n        view.setItemDelegate(TableDataDelegate(view))\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        header.sortIndicatorChanged.connect(sort_reset)\n        return view\n\n    @Inputs.data\n    def set_dataset(self, index: int, data: Table):\n        \"\"\"Set the input dataset.\"\"\"\n        datasetname = getattr(data, \"name\", \"Data\")\n        slot = self._inputs[index]\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        view.dataset = data\n        slot = TableSlot(index, data, table_summary(data), view)\n        view.input_slot = slot\n        self._inputs[index] = slot\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.insert\n    def insert_dataset(self, index: int, data: Table):\n        datasetname = getattr(data, \"name\", \"Data\")\n        view = self._create_table_view()\n        slot = TableSlot(None, data, table_summary(data), view)\n        view.dataset = data\n        view.input_slot = slot\n        self._inputs.insert(index, slot)\n        self.tabs.insertTab(index, view, datasetname)\n        self._setup_table_view(view, data)\n        self.tabs.setCurrentWidget(view)\n\n    @Inputs.data.remove\n    def remove_dataset(self, index):\n        slot = self._inputs.pop(index)\n        view = slot.view\n        self.tabs.removeTab(self.tabs.indexOf(view))\n        view.setModel(None)\n        view.hide()\n        view.deleteLater()\n\n        current = self.tabs.currentWidget()\n        if current is not None:\n            self._set_input_summary(current.input_slot)\n\n    def handleNewSignals(self):\n        super().handleNewSignals()\n        self.tabs.tabBar().setVisible(self.tabs.count() > 1)\n        data: Optional[Table] = None\n        current = self.tabs.currentWidget()\n        slot = None\n        if current is not None:\n            data = current.dataset\n            slot = current.input_slot\n\n        if slot and isinstance(slot.summary.len, concurrent.futures.Future):\n            def update(_):\n                QMetaObject.invokeMethod(\n                    self, \"_update_info\", Qt.QueuedConnection)\n            slot.summary.len.add_done_callback(update)\n        self._set_input_summary(slot)\n\n        if data is not None 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        datamodel = RichTableModel(data)\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                TableBarItemDelegate(\n                    view, color=self.dist_color, color_schema=color_schema)\n            )\n        else:\n            view.setItemDelegate(TableDataDelegate(view))\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)\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 _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.variables):\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 = TableBarItemDelegate(widget, color=self.dist_color,\n                                                color_schema=color_schema)\n            else:\n                delegate = TableDataDelegate(widget)\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.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.variables) + 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.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        insert_dataset=[\n            (0, Table(\"iris\")),\n            (1, Table(\"brown-selected\")),\n            (2, Table(\"housing\"))\n        ])\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:** OWTable Widget: AttributeError When Toggling Row Selection or Variable Labels

**Description**
When using the OWTable widget, attempting to toggle the "Select Whole Rows" or "Show Variable Labels" options results in an `AttributeError`. This error occurs because the widget incorrectly tries to call the `.values()` method on a list object.

**Steps to Reproduce**
1. Initialize the OWTable widget and send data to it.
2. Attempt to toggle the "Select Whole Rows" option:
    ```python
    widget = OWDataTable()
    widget.send_signal(widget.Inputs.data, data, 0)
    widget.controls.select_rows.toggle()  # Raises AttributeError
    ```
3. Alternatively, attempt to toggle the "Show Variable Labels" option:
    ```python
    widget.controls.show_attribute_labels.toggle()  # Raises AttributeError
    ```

**Expected Behavior**
Toggling these options should update the widget's settings without any errors, allowing users to select whole rows or show/hide variable labels as intended.

**Actual Behavior**
An `AttributeError` is raised with the message:
```
AttributeError: 'list' object has no attribute 'values'
```
This prevents the widget from updating the selection or variable labels properly.

[/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 namedtuple
from typing import List, Optional

from math import isnan

import numpy
from scipy.sparse import issparse

from AnyQt.QtWidgets import (
    QTableView, QHeaderView, QAbstractButton, QApplication, QStyleOptionHeader,
    QStyle, QStylePainter
)
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.itemdelegates import TableDataDelegate
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, MultiInput, 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 TableBarItemDelegate(gui.TableBarItem, TableDataDelegate):
    pass


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

    class Inputs:
        data = MultiInput("Data", Table, auto_summary=False, filter_none=True)

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

    buttons_area_orientation = Qt.Vertical

    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)

    settings_version = 2

    def __init__(self):
        super().__init__()
        self._inputs: List[TableSlot] = []
        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)

        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)

        gui.button(self.buttonsArea, self, "Restore Original Order",
                   callback=self.restore_order,
                   tooltip="Show rows in the original order",
                   autoDefault=False,
                   attribute=Qt.WA_LayoutUsesWidgetRect)
        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)

    def _create_table_view(self):
        view = DataTableView()
        view.setSortingEnabled(True)
        view.setItemDelegate(TableDataDelegate(view))

        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)
        return view

    @Inputs.data
    def set_dataset(self, index: int, data: Table):
        """Set the input dataset."""
        datasetname = getattr(data, "name", "Data")
        slot = self._inputs[index]
        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)
        view.dataset = data
        slot = TableSlot(index, data, table_summary(data), view)
        view.input_slot = slot
        self._inputs[index] = slot
        self._setup_table_view(view, data)
        self.tabs.setCurrentWidget(view)

    @Inputs.data.insert
    def insert_dataset(self, index: int, data: Table):
        datasetname = getattr(data, "name", "Data")
        view = self._create_table_view()
        slot = TableSlot(None, data, table_summary(data), view)
        view.dataset = data
        view.input_slot = slot
        self._inputs.insert(index, slot)
        self.tabs.insertTab(index, view, datasetname)
        self._setup_table_view(view, data)
        self.tabs.setCurrentWidget(view)

    @Inputs.data.remove
    def remove_dataset(self, index):
        slot = self._inputs.pop(index)
        view = slot.view
        self.tabs.removeTab(self.tabs.indexOf(view))
        view.setModel(None)
        view.hide()
        view.deleteLater()

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

    def handleNewSignals(self):
        super().handleNewSignals()
        self.tabs.tabBar().setVisible(self.tabs.count() > 1)
        data: Optional[Table] = None
        current = self.tabs.currentWidget()
        slot = None
        if current is not None:
            data = current.dataset
            slot = current.input_slot

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

        if data is not None 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)
        """
        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(
                TableBarItemDelegate(
                    view, color=self.dist_color, color_schema=color_schema)
            )
        else:
            view.setItemDelegate(TableDataDelegate(view))

        # 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)
                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 _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.variables):
            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 = TableBarItemDelegate(widget, color=self.dist_color,
                                                color_schema=color_schema)
            else:
                delegate = TableDataDelegate(widget)
            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.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.variables) + 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)

            # Send all data by default
            if not rowsel:
                selected_data = table
            else:
                selected_data = table.from_table(domain, table, rowsel)

        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(
        insert_dataset=[
            (0, Table("iris")),
            (1, Table("brown-selected")),
            (2, Table("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