{
    "file_diffs": [
        {
            "old_file_content": "from numbers import Number, Integral\nfrom math import isnan, isinf\n\nimport operator\nfrom collections import namedtuple, defaultdict\nfrom collections.abc import Sequence\nfrom contextlib import contextmanager\nfrom functools import reduce, partial, wraps\nfrom itertools import chain\nfrom warnings import warn\nfrom xml.sax.saxutils import escape\n\nfrom AnyQt.QtCore import (\n    Qt, QObject, QAbstractListModel, QModelIndex,\n    QItemSelectionModel, QItemSelection)\nfrom AnyQt.QtCore import pyqtSignal as Signal\nfrom AnyQt.QtGui import QColor, QBrush\nfrom AnyQt.QtWidgets import (\n    QWidget, QBoxLayout, QToolButton, QAbstractButton, QAction\n)\n\nimport numpy\n\nfrom orangewidget.utils.itemmodels import (\n    PyListModel, AbstractSortTableModel as _AbstractSortTableModel\n)\n\nfrom Orange.widgets.utils.colorpalettes import ContinuousPalettes, ContinuousPalette\nfrom Orange.data import Value, Variable, Storage, DiscreteVariable, ContinuousVariable\nfrom Orange.data.domain import filter_visible\nfrom Orange.widgets import gui\nfrom Orange.widgets.utils import datacaching\nfrom Orange.statistics import basic_stats\nfrom Orange.util import deprecated\n\n__all__ = [\n    \"PyListModel\", \"VariableListModel\", \"PyListModelTooltip\", \"DomainModel\",\n    \"AbstractSortTableModel\", \"PyTableModel\", \"TableModel\",\n    \"ModelActionsWidget\", \"ListSingleSelectionModel\"\n]\n\n@contextmanager\ndef signal_blocking(obj):\n    blocked = obj.signalsBlocked()\n    obj.blockSignals(True)\n    try:\n        yield\n    finally:\n        obj.blockSignals(blocked)\n\n\ndef _as_contiguous_range(the_slice, length):\n    start, stop, step = the_slice.indices(length)\n    if step == -1:\n        # Equivalent range with positive step\n        start, stop, step = stop + 1, start + 1, 1\n    elif not (step == 1 or step is None):\n        raise IndexError(\"Non-contiguous range.\")\n    return start, stop, step\n\n\nclass AbstractSortTableModel(_AbstractSortTableModel):\n    # these were defined on TableModel below. When the AbstractSortTableModel\n    # was extracted and made a base of TableModel these deprecations were\n    # misplaced, they belong in TableModel.\n    @deprecated('Orange.widgets.utils.itemmodels.AbstractSortTableModel.mapFromSourceRows')\n    def mapFromTableRows(self, rows):\n        return self.mapFromSourceRows(rows)\n\n    @deprecated('Orange.widgets.utils.itemmodels.AbstractSortTableModel.mapToSourceRows')\n    def mapToTableRows(self, rows):\n        return self.mapToSourceRows(rows)\n\n\nclass PyTableModel(AbstractSortTableModel):\n    \"\"\" A model for displaying python tables (sequences of sequences) in\n    QTableView objects.\n\n    Parameters\n    ----------\n    sequence : list\n        The initial list to wrap.\n    parent : QObject\n        Parent QObject.\n    editable: bool or sequence\n        If True, all items are flagged editable. If sequence, the True-ish\n        fields mark their respective columns editable.\n\n    Notes\n    -----\n    The model rounds numbers to human readable precision, e.g.:\n    1.23e-04, 1.234, 1234.5, 12345, 1.234e06.\n\n    To set additional item roles, use setData().\n    \"\"\"\n\n    @staticmethod\n    def _RoleData():\n        return defaultdict(lambda: defaultdict(dict))\n\n    # All methods are either necessary overrides of super methods, or\n    # methods likened to the Python list's. Hence, docstrings aren't.\n    # pylint: disable=missing-docstring\n    def __init__(self, sequence=None, parent=None, editable=False):\n        super().__init__(parent)\n        self._rows = self._cols = 0\n        self._headers = {}\n        self._editable = editable\n        self._table = None\n        self._roleData = {}\n        if sequence is None:\n            sequence = []\n        self.wrap(sequence)\n\n    def rowCount(self, parent=QModelIndex()):\n        return 0 if parent.isValid() else self._rows\n\n    def columnCount(self, parent=QModelIndex()):\n        return 0 if parent.isValid() else self._cols\n\n    def flags(self, index):\n        flags = super().flags(index)\n        if not self._editable or not index.isValid():\n            return flags\n        if isinstance(self._editable, Sequence):\n            return flags | Qt.ItemIsEditable if self._editable[index.column()] else flags\n        return flags | Qt.ItemIsEditable\n\n    def setData(self, index, value, role):\n        row = self.mapFromSourceRows(index.row())\n        if role == Qt.EditRole:\n            self[row][index.column()] = value\n            self.dataChanged.emit(index, index)\n        else:\n            self._roleData[row][index.column()][role] = value\n        return True\n\n    def data(self, index, role=Qt.DisplayRole):\n        if not index.isValid():\n            return\n\n        row, column = self.mapToSourceRows(index.row()), index.column()\n\n        role_value = self._roleData.get(row, {}).get(column, {}).get(role)\n        if role_value is not None:\n            return role_value\n\n        try:\n            value = self[row][column]\n        except IndexError:\n            return\n        if role == Qt.EditRole:\n            return value\n        if role == Qt.DecorationRole and isinstance(value, Variable):\n            return gui.attributeIconDict[value]\n        if role == Qt.DisplayRole:\n            if (isinstance(value, Number) and\n                    not (isnan(value) or isinf(value) or isinstance(value, Integral))):\n                absval = abs(value)\n                strlen = len(str(int(absval)))\n                value = '{:.{}{}}'.format(value,\n                                          2 if absval < .001 else\n                                          3 if strlen < 2 else\n                                          1 if strlen < 5 else\n                                          0 if strlen < 6 else\n                                          3,\n                                          'f' if (absval == 0 or\n                                                  absval >= .001 and\n                                                  strlen < 6)\n                                          else 'e')\n            return str(value)\n        if role == Qt.TextAlignmentRole and isinstance(value, Number):\n            return Qt.AlignRight | Qt.AlignVCenter\n        if role == Qt.ToolTipRole:\n            return str(value)\n\n    def sortColumnData(self, column):\n        return [row[column] for row in self._table]\n\n    def setHorizontalHeaderLabels(self, labels):\n        \"\"\"\n        Parameters\n        ----------\n        labels : list of str or list of Variable\n        \"\"\"\n        self._headers[Qt.Horizontal] = tuple(labels)\n\n    def setVerticalHeaderLabels(self, labels):\n        \"\"\"\n        Parameters\n        ----------\n        labels : list of str or list of Variable\n        \"\"\"\n        self._headers[Qt.Vertical] = tuple(labels)\n\n    def headerData(self, section, orientation, role=Qt.DisplayRole):\n        headers = self._headers.get(orientation)\n\n        if headers and section < len(headers):\n            section = self.mapToSourceRows(section) if orientation == Qt.Vertical else section\n            value = headers[section]\n\n            if role == Qt.ToolTipRole:\n                role = Qt.DisplayRole\n\n            if role == Qt.DisplayRole:\n                return value.name if isinstance(value, Variable) else value\n\n            if role == Qt.DecorationRole:\n                if isinstance(value, Variable):\n                    return gui.attributeIconDict[value]\n\n        # Use QAbstractItemModel default for non-existent header/sections\n        return super().headerData(section, orientation, role)\n\n    def removeRows(self, row, count, parent=QModelIndex()):\n        if not parent.isValid():\n            del self[row:row + count]\n            for rowidx in range(row, row + count):\n                self._roleData.pop(rowidx, None)\n            self._rows = self._table_dim()[0]\n            return True\n        return False\n\n    def removeColumns(self, column, count, parent=QModelIndex()):\n        self.beginRemoveColumns(parent, column, column + count - 1)\n        for row in self._table:\n            del row[column:column + count]\n        for cols in self._roleData.values():\n            for col in range(column, column + count):\n                cols.pop(col, None)\n        del self._headers.get(Qt.Horizontal, [])[column:column + count]\n        self._cols = self._table_dim()[1]\n        self.endRemoveColumns()\n        return True\n\n    def _table_dim(self):\n        return len(self._table), max(map(len, self), default=0)\n\n    def insertRows(self, row, count, parent=QModelIndex()):\n        self.beginInsertRows(parent, row, row + count - 1)\n        self._table[row:row] = [[''] * self.columnCount() for _ in range(count)]\n        self._rows = self._table_dim()[0]\n        self.endInsertRows()\n        return True\n\n    def insertColumns(self, column, count, parent=QModelIndex()):\n        self.beginInsertColumns(parent, column, column + count - 1)\n        for row in self._table:\n            row[column:column] = [''] * count\n        self._cols = self._table_dim()[1]\n        self.endInsertColumns()\n        return True\n\n    def __len__(self):\n        return len(self._table)\n\n    def __bool__(self):\n        return len(self) != 0\n\n    def __iter__(self):\n        return iter(self._table)\n\n    def __getitem__(self, item):\n        return self._table[item]\n\n    def __delitem__(self, i):\n        if isinstance(i, slice):\n            start, stop, _ = _as_contiguous_range(i, len(self))\n            stop -= 1\n        else:\n            start = stop = i = i if i >= 0 else len(self) + i\n        if stop < start:\n            return\n        self._check_sort_order()\n        self.beginRemoveRows(QModelIndex(), start, stop)\n        del self._table[i]\n        rows = self._table_dim()[0]\n        self._rows = rows\n        self.endRemoveRows()\n        self._update_column_count()\n\n    def __setitem__(self, i, value):\n        self._check_sort_order()\n        if isinstance(i, slice):\n            start, stop, _ = _as_contiguous_range(i, len(self))\n            self.removeRows(start, stop - start)\n            if len(value) == 0:\n                return\n            self.beginInsertRows(QModelIndex(), start, start + len(value) - 1)\n            self._table[start:start] = value\n            self._rows = self._table_dim()[0]\n            self.endInsertRows()\n            self._update_column_count()\n        else:\n            self._table[i] = value\n            self.dataChanged.emit(self.index(i, 0),\n                                  self.index(i, self.columnCount() - 1))\n\n    def _update_column_count(self):\n        cols_before = self._cols\n        cols_after = self._table_dim()[1]\n        if cols_before < cols_after:\n            self.beginInsertColumns(QModelIndex(), cols_before, cols_after - 1)\n            self._cols = cols_after\n            self.endInsertColumns()\n        elif cols_before > cols_after:\n            self.beginRemoveColumns(QModelIndex(), cols_after, cols_before - 1)\n            self._cols = cols_after\n            self.endRemoveColumns()\n\n    def _check_sort_order(self):\n        if self.mapToSourceRows(Ellipsis) is not Ellipsis:\n            warn(\"Can't modify PyTableModel when it's sorted\",\n                 RuntimeWarning, stacklevel=3)\n            raise RuntimeError(\"Can't modify PyTableModel when it's sorted\")\n\n    def wrap(self, table):\n        self.beginResetModel()\n        self._table = table\n        self._roleData = self._RoleData()\n        self._rows, self._cols = self._table_dim()\n        self.resetSorting()\n        self.endResetModel()\n\n    def tolist(self):\n        return self._table\n\n    def clear(self):\n        self.beginResetModel()\n        self._table.clear()\n        self.resetSorting()\n        self._roleData.clear()\n        self._rows, self._cols = self._table_dim()\n        self.endResetModel()\n\n    def append(self, row):\n        self.extend([row])\n\n    def _insertColumns(self, rows):\n        n_max = max(map(len, rows))\n        if self.columnCount() < n_max:\n            self.insertColumns(self.columnCount(), n_max - self.columnCount())\n\n    def extend(self, rows):\n        i, rows = len(self), list(rows)\n        self.insertRows(i, len(rows))\n        self._insertColumns(rows)\n        self[i:] = rows\n\n    def insert(self, i, row):\n        self.insertRows(i, 1)\n        self._insertColumns((row,))\n        self[i] = row\n\n    def remove(self, val):\n        del self[self._table.index(val)]\n\n\nclass PyListModelTooltip(PyListModel):\n    def __init__(self, iterable=None, tooltips=(), **kwargs):\n        super().__init__(iterable, **kwargs)\n        if not isinstance(tooltips, Sequence):\n            # may be a generator; if not, fail\n            tooltips = list(tooltips)\n        self.tooltips = tooltips\n\n    def data(self, index, role=Qt.DisplayRole):\n        if role == Qt.ToolTipRole:\n            if index.row() >= len(self.tooltips):\n                return None\n            return self.tooltips[index.row()]\n        else:\n            return super().data(index, role)\n\n\nclass VariableListModel(PyListModel):\n    MIME_TYPE = \"application/x-Orange-VariableList\"\n\n    def __init__(self, *args, placeholder=None, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.placeholder = placeholder\n\n    def data(self, index, role=Qt.DisplayRole):\n        if self._is_index_valid(index):\n            var = self[index.row()]\n            if var is None and role == Qt.DisplayRole:\n                return self.placeholder or \"None\"\n            if not isinstance(var, Variable):\n                return super().data(index, role)\n            elif role == Qt.DisplayRole:\n                return var.name\n            elif role == Qt.DecorationRole:\n                return gui.attributeIconDict[var]\n            elif role == Qt.ToolTipRole:\n                return self.variable_tooltip(var)\n            elif role == gui.TableVariable:\n                return var\n            else:\n                return PyListModel.data(self, index, role)\n\n    def variable_tooltip(self, var):\n        if var.is_discrete:\n            return self.discrete_variable_tooltip(var)\n        elif var.is_time:\n            return self.time_variable_toltip(var)\n        elif var.is_continuous:\n            return self.continuous_variable_toltip(var)\n        elif var.is_string:\n            return self.string_variable_tooltip(var)\n\n    def variable_labels_tooltip(self, var):\n        text = \"\"\n        if var.attributes:\n            items = [(safe_text(key), safe_text(value))\n                     for key, value in var.attributes.items()]\n            labels = list(map(\"%s = %s\".__mod__, items))\n            text += \"<br/>Variable Labels:<br/>\"\n            text += \"<br/>\".join(labels)\n        return text\n\n    def discrete_variable_tooltip(self, var):\n        text = \"<b>%s</b><br/>Categorical with %i values: \" %\\\n               (safe_text(var.name), len(var.values))\n        text += \", \".join(\"%r\" % safe_text(v) for v in var.values)\n        text += self.variable_labels_tooltip(var)\n        return text\n\n    def time_variable_toltip(self, var):\n        text = \"<b>%s</b><br/>Time\" % safe_text(var.name)\n        text += self.variable_labels_tooltip(var)\n        return text\n\n    def continuous_variable_toltip(self, var):\n        text = \"<b>%s</b><br/>Numeric\" % safe_text(var.name)\n        text += self.variable_labels_tooltip(var)\n        return text\n\n    def string_variable_tooltip(self, var):\n        text = \"<b>%s</b><br/>Text\" % safe_text(var.name)\n        text += self.variable_labels_tooltip(var)\n        return text\n\n\nclass DomainModel(VariableListModel):\n    ATTRIBUTES, CLASSES, METAS = 1, 2, 4\n    MIXED = ATTRIBUTES | CLASSES | METAS\n    SEPARATED = (CLASSES, PyListModel.Separator,\n                 METAS, PyListModel.Separator,\n                 ATTRIBUTES)\n    PRIMITIVE = (DiscreteVariable, ContinuousVariable)\n\n    def __init__(self, order=SEPARATED, separators=True, placeholder=None,\n                 valid_types=None, alphabetical=False, skip_hidden_vars=True, **kwargs):\n        \"\"\"\n\n        Parameters\n        ----------\n        order: tuple or int\n            Order of attributes, metas, classes, separators and other options\n        separators: bool\n            If False, remove separators from `order`.\n        placeholder: str\n            The text that is shown when no variable is selected\n        valid_types: tuple\n            (Sub)types of `Variable` that are included in the model\n        alphabetical: bool\n            If true, variables are sorted alphabetically.\n        skip_hidden_vars: bool\n            If true, variables marked as \"hidden\" are skipped.\n        \"\"\"\n        super().__init__(placeholder=placeholder, **kwargs)\n        if isinstance(order, int):\n            order = (order,)\n        if placeholder is not None and None not in order:\n            # Add None for the placeholder if it's not already there\n            # Include separator if the current order uses them\n            order = (None,) + \\\n                    (self.Separator, ) * (self.Separator in order) + \\\n                    order\n        if not separators:\n            order = [e for e in order if e is not self.Separator]\n        self.order = order\n        self.valid_types = valid_types\n        self.alphabetical = alphabetical\n        self.skip_hidden_vars = skip_hidden_vars\n        self._within_set_domain = False\n        self.set_domain(None)\n\n    def set_domain(self, domain):\n        self.beginResetModel()\n        content = []\n        # The logic related to separators is a bit complicated: it ensures that\n        # even when a section is empty we don't have two separators in a row\n        # or a separator at the end\n        add_separator = False\n        for section in self.order:\n            if section is self.Separator:\n                add_separator = True\n                continue\n            if isinstance(section, int):\n                if domain is None:\n                    continue\n                to_add = list(chain(\n                    *(vars for i, vars in enumerate(\n                        (domain.attributes, domain.class_vars, domain.metas))\n                      if (1 << i) & section)))\n                if self.skip_hidden_vars:\n                    to_add = list(filter_visible(to_add))\n                if self.valid_types is not None:\n                    to_add = [var for var in to_add\n                              if isinstance(var, self.valid_types)]\n                if self.alphabetical:\n                    to_add = sorted(to_add, key=lambda x: x.name)\n            elif isinstance(section, list):\n                to_add = section\n            else:\n                to_add = [section]\n            if to_add:\n                if add_separator and content:\n                    content.append(self.Separator)\n                    add_separator = False\n                content += to_add\n        try:\n            self._within_set_domain = True\n            self[:] = content\n        finally:\n            self._within_set_domain = False\n        self.endResetModel()\n\n    def prevent_modification(method):  # pylint: disable=no-self-argument\n        @wraps(method)\n        # pylint: disable=protected-access\n        def e(self, *args, **kwargs):\n            if self._within_set_domain:\n                method(self, *args, **kwargs)\n            else:\n                raise TypeError(\n                    \"{} can be modified only by calling 'set_domain'\".\n                    format(type(self).__name__))\n        return e\n\n    @prevent_modification\n    def extend(self, iterable):\n        return super().extend(iterable)\n\n    @prevent_modification\n    def append(self, item):\n        return super().append(item)\n\n    @prevent_modification\n    def insert(self, i, val):\n        return super().insert(i, val)\n\n    @prevent_modification\n    def remove(self, val):\n        return super().remove(val)\n\n    @prevent_modification\n    def pop(self, i):\n        return super().pop(i)\n\n    @prevent_modification\n    def clear(self):\n        return super().clear()\n\n    @prevent_modification\n    def __delitem__(self, s):\n        return super().__delitem__(s)\n\n    @prevent_modification\n    def __setitem__(self, s, value):\n        return super().__setitem__(s, value)\n\n    @prevent_modification\n    def reverse(self):\n        return super().reverse()\n\n    @prevent_modification\n    def sort(self, *args, **kwargs):\n        return super().sort(*args, **kwargs)\n\n    def setData(self, index, value, role=Qt.EditRole):\n        # reimplemented\n        if role == Qt.EditRole:\n            return False\n        else:\n            return super().setData(index, value, role)\n\n    def setItemData(self, index, data):\n        # reimplemented\n        if Qt.EditRole in data:\n            return False\n        else:\n            return super().setItemData(index, data)\n\n    def insertRows(self, row, count, parent=QModelIndex()):\n        # reimplemented\n        return False\n\n    def removeRows(self, row, count, parent=QModelIndex()):\n        # reimplemented\n        return False\n\n_html_replace = [(\"<\", \"&lt;\"), (\">\", \"&gt;\")]\n\n\ndef safe_text(text):\n    for old, new in _html_replace:\n        text = str(text).replace(old, new)\n    return text\n\n\nclass ContinuousPalettesModel(QAbstractListModel):\n    \"\"\"\n    Model for combo boxes\n    \"\"\"\n    KeyRole = Qt.UserRole + 1\n    def __init__(self, parent=None, categories=None, icon_width=64):\n        super().__init__(parent)\n        self.icon_width = icon_width\n\n        palettes = list(ContinuousPalettes.values())\n        if categories is None:\n            # Use dict, not set, to keep order of categories\n            categories = dict.fromkeys(palette.category for palette in palettes)\n\n        self.items = []\n        for category in categories:\n            self.items.append(category)\n            self.items += [palette for palette in palettes\n                           if palette.category == category]\n        if len(categories) == 1:\n            del self.items[0]\n\n    def rowCount(self, parent):\n        return 0 if parent.isValid() else len(self.items)\n\n    @staticmethod\n    def columnCount(parent):\n        return 0 if parent.isValid() else 1\n\n    def data(self, index, role):\n        item = self.items[index.row()]\n        if isinstance(item, str):\n            if role in [Qt.EditRole, Qt.DisplayRole]:\n                return item\n        else:\n            if role in [Qt.EditRole, Qt.DisplayRole]:\n                return item.friendly_name\n            if role == Qt.DecorationRole:\n                return item.color_strip(self.icon_width, 16)\n            if role == Qt.UserRole:\n                return item\n            if role == self.KeyRole:\n                return item.name\n        return None\n\n    def flags(self, index):\n        item = self.items[index.row()]\n        if isinstance(item, ContinuousPalette):\n            return Qt.ItemIsEnabled | Qt.ItemIsSelectable\n        else:\n            return Qt.NoItemFlags\n\n    def indexOf(self, x):\n        if isinstance(x, str):\n            for i, item in enumerate(self.items):\n                if not isinstance(item, str) \\\n                        and x in (item.name, item.friendly_name):\n                    return i\n        elif isinstance(x, ContinuousPalette):\n            return self.items.index(x)\n        return None\n\n\nclass ListSingleSelectionModel(QItemSelectionModel):\n    \"\"\" Item selection model for list item models with single selection.\n\n    Defines signal:\n        - selectedIndexChanged(QModelIndex)\n\n    \"\"\"\n    selectedIndexChanged = Signal(QModelIndex)\n\n    def __init__(self, model, parent=None):\n        QItemSelectionModel.__init__(self, model, parent)\n        self.selectionChanged.connect(self.onSelectionChanged)\n\n    def onSelectionChanged(self, new, _):\n        index = list(new.indexes())\n        if index:\n            index = index.pop()\n        else:\n            index = QModelIndex()\n\n        self.selectedIndexChanged.emit(index)\n\n    def selectedRow(self):\n        \"\"\" Return QModelIndex of the selected row or invalid if no selection.\n        \"\"\"\n        rows = self.selectedRows()\n        if rows:\n            return rows[0]\n        else:\n            return QModelIndex()\n\n    def select(self, index, flags=QItemSelectionModel.ClearAndSelect):\n        if isinstance(index, int):\n            index = self.model().index(index)\n        return QItemSelectionModel.select(self, index, flags)\n\n\ndef select_row(view, row):\n    \"\"\"\n    Select a `row` in an item view.\n    \"\"\"\n    selmodel = view.selectionModel()\n    selmodel.select(view.model().index(row, 0),\n                    QItemSelectionModel.ClearAndSelect |\n                    QItemSelectionModel.Rows)\n\n\ndef select_rows(view, row_indices, command=QItemSelectionModel.ClearAndSelect):\n    \"\"\"\n    Select several rows in view.\n\n    :param QAbstractItemView view:\n    :param row_indices: Integer indices of rows to select.\n    :param command: QItemSelectionModel.SelectionFlags\n    \"\"\"\n    selmodel = view.selectionModel()\n    model = view.model()\n    selection = QItemSelection()\n    for row in row_indices:\n        index = model.index(row, 0)\n        selection.select(index, index)\n    selmodel.select(selection, command | QItemSelectionModel.Rows)\n\n\nclass ModelActionsWidget(QWidget):\n    def __init__(self, actions=None, parent=None,\n                 direction=QBoxLayout.LeftToRight):\n        QWidget.__init__(self, parent)\n        self.actions = []\n        self.buttons = []\n        layout = QBoxLayout(direction)\n        layout.setContentsMargins(0, 0, 0, 0)\n        self.setContentsMargins(0, 0, 0, 0)\n        self.setLayout(layout)\n        if actions is not None:\n            for action in actions:\n                self.addAction(action)\n        self.setLayout(layout)\n\n    def actionButton(self, action):\n        if isinstance(action, QAction):\n            button = QToolButton(self)\n            button.setDefaultAction(action)\n            return button\n        elif isinstance(action, QAbstractButton):\n            return action\n\n    def insertAction(self, ind, action, *args):\n        button = self.actionButton(action)\n        self.layout().insertWidget(ind, button, *args)\n        self.buttons.insert(ind, button)\n        self.actions.insert(ind, action)\n        return button\n\n    def addAction(self, action, *args):\n        return self.insertAction(-1, action, *args)\n\n\nclass TableModel(AbstractSortTableModel):\n    \"\"\"\n    An adapter for using Orange.data.Table within Qt's Item View Framework.\n\n    :param Orange.data.Table sourcedata: Source data table.\n    :param QObject parent:\n    \"\"\"\n    #: Orange.data.Value for the index.\n    ValueRole = gui.TableValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Value of the row's class.\n    ClassValueRole = gui.TableClassValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Variable of the column.\n    VariableRole = gui.TableVariable  # next(gui.OrangeUserRole)\n    #: Basic statistics of the column\n    VariableStatsRole = next(gui.OrangeUserRole)\n    #: The column's role (position) in the domain.\n    #: One of Attribute, ClassVar or Meta\n    DomainRole = next(gui.OrangeUserRole)\n\n    #: Column domain roles\n    ClassVar, Meta, Attribute = range(3)\n\n    #: Default background color for domain roles\n    ColorForRole = {\n        ClassVar: QColor(160, 160, 160),\n        Meta: QColor(220, 220, 200),\n        Attribute: None,\n    }\n\n    #: Standard column descriptor\n    Column = namedtuple(\n        \"Column\", [\"var\", \"role\", \"background\", \"format\"])\n    #: Basket column descriptor (i.e. sparse X/Y/metas/ compressed into\n    #: a single column).\n    Basket = namedtuple(\n        \"Basket\", [\"vars\", \"role\", \"background\", \"density\", \"format\"])\n\n    # The class uses the same names (X_density etc) as Table\n    # pylint: disable=invalid-name\n    def __init__(self, sourcedata, parent=None):\n        super().__init__(parent)\n        self.source = sourcedata\n        self.domain = domain = sourcedata.domain\n\n        self.X_density = sourcedata.X_density()\n        self.Y_density = sourcedata.Y_density()\n        self.M_density = sourcedata.metas_density()\n\n        brush_for_role = {\n            role: QBrush(c) if c is not None else None\n            for role, c in self.ColorForRole.items()\n        }\n\n        def format_sparse(vars, row):\n            row = row.tocsr()\n            return \", \".join(\"{}={}\".format(vars[i].name, vars[i].str_val(v))\n                             for i, v in zip(row.indices, row.data))\n\n        def format_sparse_bool(vars, row):\n            row = row.tocsr()\n            return \", \".join(vars[i].name for i in row.indices)\n\n        def format_dense(var, val):\n            return var.str_val(val)\n\n        def make_basket_formatter(vars, density):\n            formatter = (format_sparse if density == Storage.SPARSE\n                         else format_sparse_bool)\n            return partial(formatter, vars)\n\n        def make_basket(vars, density, role):\n            return TableModel.Basket(\n                vars, TableModel.Attribute, brush_for_role[role], density,\n                make_basket_formatter(vars, density)\n            )\n\n        def make_column(var, role):\n            return TableModel.Column(\n                var, role, brush_for_role[role],\n                partial(format_dense, var)\n            )\n\n        columns = []\n\n        if self.Y_density != Storage.DENSE and domain.class_vars:\n            coldesc = make_basket(domain.class_vars, self.Y_density,\n                                  TableModel.ClassVar)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.ClassVar)\n                        for var in domain.class_vars]\n\n        if self.M_density != Storage.DENSE and domain.metas:\n            coldesc = make_basket(domain.metas, self.M_density,\n                                  TableModel.Meta)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Meta)\n                        for var in domain.metas]\n\n        if self.X_density != Storage.DENSE and domain.attributes:\n            coldesc = make_basket(domain.attributes, self.X_density,\n                                  TableModel.Attribute)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Attribute)\n                        for var in domain.attributes]\n\n        #: list of all domain variables (class_vars + metas + attrs)\n        self.vars = domain.class_vars + domain.metas + domain.attributes\n        self.columns = columns\n\n        #: A list of all unique attribute labels (in all variables)\n        self._labels = sorted(\n            reduce(operator.ior,\n                   [set(var.attributes) for var in self.vars],\n                   set()))\n\n        # column basic statistics (VariableStatsRole), computed when\n        # first needed.\n        self.__stats = None\n        self.__rowCount = sourcedata.approx_len()\n        self.__columnCount = len(self.columns)\n\n        if self.__rowCount > (2 ** 31 - 1):\n            raise ValueError(\"len(sourcedata) > 2 ** 31 - 1\")\n\n    def _get_source_item(self, row, coldesc):\n        if isinstance(coldesc, self.Basket):\n            # `self.source[row:row + 1]` returns Table\n            # `self.source[row]` returns RowInstance\n            if coldesc.role is self.ClassVar:\n                return self.source[row:row + 1].Y\n            if coldesc.role is self.Meta:\n                return self.source[row:row + 1].metas\n            if coldesc.role is self.Attribute:\n                return self.source[row:row + 1].X\n        return self.source[row, coldesc.var]\n\n    def sortColumnData(self, column):\n        return self._columnSortKeyData(column, TableModel.ValueRole)\n\n    @deprecated('Orange.widgets.utils.itemmodels.TableModel.sortColumnData')\n    def columnSortKeyData(self, column, role):\n        return self._columnSortKeyData(column, role)\n\n    def _columnSortKeyData(self, column, role):\n        \"\"\"\n        Return a sequence of source table objects which can be used as\n        `keys` for sorting.\n\n        :param int column: Sort column.\n        :param Qt.ItemRole role: Sort item role.\n\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Column) \\\n                and role == TableModel.ValueRole:\n            return self.source.get_column(coldesc.var)\n        else:\n            return numpy.asarray([self.index(i, column).data(role)\n                                  for i in range(self.rowCount())])\n\n    def data(self, index, role,\n             # For optimizing out LOAD_GLOBAL byte code instructions in\n             # the item role tests.\n             _str=str,\n             _Qt_DisplayRole=Qt.DisplayRole,\n             _Qt_EditRole=Qt.EditRole,\n             _Qt_BackgroundRole=Qt.BackgroundRole,\n             _Qt_ForegroundRole=Qt.ForegroundRole,\n             _ValueRole=ValueRole,\n             _ClassValueRole=ClassValueRole,\n             _VariableRole=VariableRole,\n             _DomainRole=DomainRole,\n             _VariableStatsRole=VariableStatsRole,\n             # Some cached local precomputed values.\n             # All of the above roles we respond to\n             _recognizedRoles=frozenset([Qt.DisplayRole,\n                                         Qt.EditRole,\n                                         Qt.BackgroundRole,\n                                         Qt.ForegroundRole,\n                                         ValueRole,\n                                         ClassValueRole,\n                                         VariableRole,\n                                         DomainRole,\n                                         VariableStatsRole])):\n        \"\"\"\n        Reimplemented from `QAbstractItemModel.data`\n        \"\"\"\n        if role not in _recognizedRoles:\n            return None\n\n        row = index.row()\n        if not 0 <= row <= self.__rowCount:\n            return None\n\n        row = self.mapToSourceRows(row)\n        col = 0 if role is _ClassValueRole else index.column()\n\n        try:\n            coldesc = self.columns[col]\n            instance = self._get_source_item(row, coldesc)\n        except IndexError:\n            self.layoutAboutToBeChanged.emit()\n            self.beginRemoveRows(self.parent(), row, max(self.rowCount(), row))\n            self.__rowCount = min(row, self.__rowCount)\n            self.endRemoveRows()\n            self.layoutChanged.emit()\n            return None\n\n        if role == _Qt_DisplayRole:\n            return coldesc.format(instance)\n        elif role in (_Qt_EditRole, _ValueRole) and isinstance(coldesc, TableModel.Column):\n            return Value(coldesc.var, instance)\n        elif role == _Qt_BackgroundRole:\n            return coldesc.background\n        elif role == _Qt_ForegroundRole:\n            # The background is light-ish, force dark text color\n            return coldesc.background and QColor(0, 0, 0, 200)\n        elif role == _ClassValueRole \\\n                and isinstance(coldesc, TableModel.Column) \\\n                and len(self.domain.class_vars) == 1:\n            return Value(coldesc.var, instance)\n        elif role == _VariableRole and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == _DomainRole:\n            return coldesc.role\n        elif role == _VariableStatsRole:\n            return self._stats_for_column(col)\n        else:\n            return None\n\n    def setData(self, index, value, role):\n        row = self.mapFromSourceRows(index.row())\n        if role == Qt.EditRole:\n            try:\n                self.source[row, index.column()] = value\n            except (TypeError, IndexError):\n                return False\n            else:\n                self.dataChanged.emit(index, index)\n                return True\n        else:\n            return False\n\n    def parent(self, index=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.parent`.\"\"\"\n        return QModelIndex()\n\n    def rowCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.rowCount`.\"\"\"\n        return 0 if parent.isValid() else self.__rowCount\n\n    def columnCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.columnCount`.\"\"\"\n        return 0 if parent.isValid() else self.__columnCount\n\n    def headerData(self, section, orientation, role):\n        \"\"\"Reimplemented from `QAbstractTableModel.headerData`.\"\"\"\n        if orientation == Qt.Vertical:\n            if role == Qt.DisplayRole:\n                return int(self.mapToSourceRows(section) + 1)\n            return None\n\n        coldesc = self.columns[section]\n        if role == Qt.DisplayRole:\n            if isinstance(coldesc, TableModel.Basket):\n                return \"{...}\"\n            else:\n                return coldesc.var.name\n        elif role == Qt.ToolTipRole:\n            return self._tooltip(coldesc)\n        elif role == TableModel.VariableRole \\\n                and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == TableModel.VariableStatsRole:\n            return self._stats_for_column(section)\n        elif role == TableModel.DomainRole:\n            return coldesc.role\n        else:\n            return None\n\n    def _tooltip(self, coldesc):\n        \"\"\"\n        Return an header tool tip text for an `column` descriptor.\n        \"\"\"\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        labels = self._labels\n        variable = coldesc.var\n        pairs = [(escape(key), escape(str(variable.attributes[key])))\n                 for key in labels if key in variable.attributes]\n        tip = \"<b>%s</b>\" % escape(variable.name)\n        tip = \"<br/>\".join([tip] + [\"%s = %s\" % pair for pair in pairs])\n        return tip\n\n    def _stats_for_column(self, column):\n        \"\"\"\n        Return BasicStats for `column` index.\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        if self.__stats is None:\n            self.__stats = datacaching.getCached(\n                self.source, basic_stats.DomainBasicStats,\n                (self.source, True)\n            )\n\n        return self.__stats[coldesc.var]\n",
            "new_file_content": "from numbers import Number, Integral\nfrom math import isnan, isinf\n\nimport operator\nfrom collections import namedtuple, defaultdict\nfrom collections.abc import Sequence\nfrom contextlib import contextmanager\nfrom functools import reduce, partial, wraps\nfrom itertools import chain\nfrom warnings import warn\nfrom xml.sax.saxutils import escape\n\nfrom AnyQt.QtCore import (\n    Qt, QObject, QAbstractListModel, QModelIndex,\n    QItemSelectionModel, QItemSelection)\nfrom AnyQt.QtCore import pyqtSignal as Signal\nfrom AnyQt.QtGui import QColor, QBrush\nfrom AnyQt.QtWidgets import (\n    QWidget, QBoxLayout, QToolButton, QAbstractButton, QAction\n)\n\nimport numpy\n\nfrom orangewidget.utils.itemmodels import (\n    PyListModel, AbstractSortTableModel as _AbstractSortTableModel\n)\n\nfrom Orange.widgets.utils.colorpalettes import ContinuousPalettes, ContinuousPalette\nfrom Orange.data import Value, Variable, Storage, DiscreteVariable, ContinuousVariable\nfrom Orange.data.domain import filter_visible\nfrom Orange.widgets import gui\nfrom Orange.widgets.utils import datacaching\nfrom Orange.statistics import basic_stats\nfrom Orange.util import deprecated\n\n__all__ = [\n    \"PyListModel\", \"VariableListModel\", \"PyListModelTooltip\", \"DomainModel\",\n    \"AbstractSortTableModel\", \"PyTableModel\", \"TableModel\",\n    \"ModelActionsWidget\", \"ListSingleSelectionModel\"\n]\n\n@contextmanager\ndef signal_blocking(obj):\n    blocked = obj.signalsBlocked()\n    obj.blockSignals(True)\n    try:\n        yield\n    finally:\n        obj.blockSignals(blocked)\n\n\ndef _as_contiguous_range(the_slice, length):\n    start, stop, step = the_slice.indices(length)\n    if step == -1:\n        # Equivalent range with positive step\n        start, stop, step = stop + 1, start + 1, 1\n    elif not (step == 1 or step is None):\n        raise IndexError(\"Non-contiguous range.\")\n    return start, stop, step\n\n\nclass AbstractSortTableModel(_AbstractSortTableModel):\n    # these were defined on TableModel below. When the AbstractSortTableModel\n    # was extracted and made a base of TableModel these deprecations were\n    # misplaced, they belong in TableModel.\n    @deprecated('Orange.widgets.utils.itemmodels.AbstractSortTableModel.mapFromSourceRows')\n    def mapFromTableRows(self, rows):\n        return self.mapFromSourceRows(rows)\n\n    @deprecated('Orange.widgets.utils.itemmodels.AbstractSortTableModel.mapToSourceRows')\n    def mapToTableRows(self, rows):\n        return self.mapToSourceRows(rows)\n\n\nclass PyTableModel(AbstractSortTableModel):\n    \"\"\" A model for displaying python tables (sequences of sequences) in\n    QTableView objects.\n\n    Parameters\n    ----------\n    sequence : list\n        The initial list to wrap.\n    parent : QObject\n        Parent QObject.\n    editable: bool or sequence\n        If True, all items are flagged editable. If sequence, the True-ish\n        fields mark their respective columns editable.\n\n    Notes\n    -----\n    The model rounds numbers to human readable precision, e.g.:\n    1.23e-04, 1.234, 1234.5, 12345, 1.234e06.\n\n    To set additional item roles, use setData().\n    \"\"\"\n\n    @staticmethod\n    def _RoleData():\n        return defaultdict(lambda: defaultdict(dict))\n\n    # All methods are either necessary overrides of super methods, or\n    # methods likened to the Python list's. Hence, docstrings aren't.\n    # pylint: disable=missing-docstring\n    def __init__(self, sequence=None, parent=None, editable=False):\n        super().__init__(parent)\n        self._rows = self._cols = 0\n        self._headers = {}\n        self._editable = editable\n        self._table = None\n        self._roleData = {}\n        if sequence is None:\n            sequence = []\n        self.wrap(sequence)\n\n    def rowCount(self, parent=QModelIndex()):\n        return 0 if parent.isValid() else self._rows\n\n    def columnCount(self, parent=QModelIndex()):\n        return 0 if parent.isValid() else self._cols\n\n    def flags(self, index):\n        flags = super().flags(index)\n        if not self._editable or not index.isValid():\n            return flags\n        if isinstance(self._editable, Sequence):\n            return flags | Qt.ItemIsEditable if self._editable[index.column()] else flags\n        return flags | Qt.ItemIsEditable\n\n    def setData(self, index, value, role):\n        row = self.mapFromSourceRows(index.row())\n        if role == Qt.EditRole:\n            self[row][index.column()] = value\n            self.dataChanged.emit(index, index)\n        else:\n            self._roleData[row][index.column()][role] = value\n        return True\n\n    def data(self, index, role=Qt.DisplayRole):\n        if not index.isValid():\n            return\n\n        row, column = self.mapToSourceRows(index.row()), index.column()\n\n        role_value = self._roleData.get(row, {}).get(column, {}).get(role)\n        if role_value is not None:\n            return role_value\n\n        try:\n            value = self[row][column]\n        except IndexError:\n            return\n        if role == Qt.EditRole:\n            return value\n        if role == Qt.DecorationRole and isinstance(value, Variable):\n            return gui.attributeIconDict[value]\n        if role == Qt.DisplayRole:\n            if (isinstance(value, Number) and\n                    not (isnan(value) or isinf(value) or isinstance(value, Integral))):\n                absval = abs(value)\n                strlen = len(str(int(absval)))\n                value = '{:.{}{}}'.format(value,\n                                          2 if absval < .001 else\n                                          3 if strlen < 2 else\n                                          1 if strlen < 5 else\n                                          0 if strlen < 6 else\n                                          3,\n                                          'f' if (absval == 0 or\n                                                  absval >= .001 and\n                                                  strlen < 6)\n                                          else 'e')\n            return str(value)\n        if role == Qt.TextAlignmentRole and isinstance(value, Number):\n            return Qt.AlignRight | Qt.AlignVCenter\n        if role == Qt.ToolTipRole:\n            return str(value)\n\n    def sortColumnData(self, column):\n        return [row[column] for row in self._table]\n\n    def setHorizontalHeaderLabels(self, labels):\n        \"\"\"\n        Parameters\n        ----------\n        labels : list of str or list of Variable\n        \"\"\"\n        self._headers[Qt.Horizontal] = tuple(labels)\n\n    def setVerticalHeaderLabels(self, labels):\n        \"\"\"\n        Parameters\n        ----------\n        labels : list of str or list of Variable\n        \"\"\"\n        self._headers[Qt.Vertical] = tuple(labels)\n\n    def headerData(self, section, orientation, role=Qt.DisplayRole):\n        headers = self._headers.get(orientation)\n\n        if headers and section < len(headers):\n            section = self.mapToSourceRows(section) if orientation == Qt.Vertical else section\n            value = headers[section]\n\n            if role == Qt.ToolTipRole:\n                role = Qt.DisplayRole\n\n            if role == Qt.DisplayRole:\n                return value.name if isinstance(value, Variable) else value\n\n            if role == Qt.DecorationRole:\n                if isinstance(value, Variable):\n                    return gui.attributeIconDict[value]\n\n        # Use QAbstractItemModel default for non-existent header/sections\n        return super().headerData(section, orientation, role)\n\n    def removeRows(self, row, count, parent=QModelIndex()):\n        if not parent.isValid():\n            del self[row:row + count]\n            for rowidx in range(row, row + count):\n                self._roleData.pop(rowidx, None)\n            self._rows = self._table_dim()[0]\n            return True\n        return False\n\n    def removeColumns(self, column, count, parent=QModelIndex()):\n        self.beginRemoveColumns(parent, column, column + count - 1)\n        for row in self._table:\n            del row[column:column + count]\n        for cols in self._roleData.values():\n            for col in range(column, column + count):\n                cols.pop(col, None)\n        del self._headers.get(Qt.Horizontal, [])[column:column + count]\n        self._cols = self._table_dim()[1]\n        self.endRemoveColumns()\n        return True\n\n    def _table_dim(self):\n        return len(self._table), max(map(len, self), default=0)\n\n    def insertRows(self, row, count, parent=QModelIndex()):\n        self.beginInsertRows(parent, row, row + count - 1)\n        self._table[row:row] = [[''] * self.columnCount() for _ in range(count)]\n        self._rows = self._table_dim()[0]\n        self.endInsertRows()\n        return True\n\n    def insertColumns(self, column, count, parent=QModelIndex()):\n        self.beginInsertColumns(parent, column, column + count - 1)\n        for row in self._table:\n            row[column:column] = [''] * count\n        self._cols = self._table_dim()[1]\n        self.endInsertColumns()\n        return True\n\n    def __len__(self):\n        return len(self._table)\n\n    def __bool__(self):\n        return len(self) != 0\n\n    def __iter__(self):\n        return iter(self._table)\n\n    def __getitem__(self, item):\n        return self._table[item]\n\n    def __delitem__(self, i):\n        if isinstance(i, slice):\n            start, stop, _ = _as_contiguous_range(i, len(self))\n            stop -= 1\n        else:\n            start = stop = i = i if i >= 0 else len(self) + i\n        if stop < start:\n            return\n        self._check_sort_order()\n        self.beginRemoveRows(QModelIndex(), start, stop)\n        del self._table[i]\n        rows = self._table_dim()[0]\n        self._rows = rows\n        self.endRemoveRows()\n        self._update_column_count()\n\n    def __setitem__(self, i, value):\n        self._check_sort_order()\n        if isinstance(i, slice):\n            start, stop, _ = _as_contiguous_range(i, len(self))\n            self.removeRows(start, stop - start)\n            if len(value) == 0:\n                return\n            self.beginInsertRows(QModelIndex(), start, start + len(value) - 1)\n            self._table[start:start] = value\n            self._rows = self._table_dim()[0]\n            self.endInsertRows()\n            self._update_column_count()\n        else:\n            self._table[i] = value\n            self.dataChanged.emit(self.index(i, 0),\n                                  self.index(i, self.columnCount() - 1))\n\n    def _update_column_count(self):\n        cols_before = self._cols\n        cols_after = self._table_dim()[1]\n        if cols_before < cols_after:\n            self.beginInsertColumns(QModelIndex(), cols_before, cols_after - 1)\n            self._cols = cols_after\n            self.endInsertColumns()\n        elif cols_before > cols_after:\n            self.beginRemoveColumns(QModelIndex(), cols_after, cols_before - 1)\n            self._cols = cols_after\n            self.endRemoveColumns()\n\n    def _check_sort_order(self):\n        if self.mapToSourceRows(Ellipsis) is not Ellipsis:\n            warn(\"Can't modify PyTableModel when it's sorted\",\n                 RuntimeWarning, stacklevel=3)\n            raise RuntimeError(\"Can't modify PyTableModel when it's sorted\")\n\n    def wrap(self, table):\n        self.beginResetModel()\n        self._table = table\n        self._roleData = self._RoleData()\n        self._rows, self._cols = self._table_dim()\n        self.resetSorting()\n        self.endResetModel()\n\n    def tolist(self):\n        return self._table\n\n    def clear(self):\n        self.beginResetModel()\n        self._table.clear()\n        self.resetSorting()\n        self._roleData.clear()\n        self._rows, self._cols = self._table_dim()\n        self.endResetModel()\n\n    def append(self, row):\n        self.extend([row])\n\n    def _insertColumns(self, rows):\n        n_max = max(map(len, rows))\n        if self.columnCount() < n_max:\n            self.insertColumns(self.columnCount(), n_max - self.columnCount())\n\n    def extend(self, rows):\n        i, rows = len(self), list(rows)\n        self.insertRows(i, len(rows))\n        self._insertColumns(rows)\n        self[i:] = rows\n\n    def insert(self, i, row):\n        self.insertRows(i, 1)\n        self._insertColumns((row,))\n        self[i] = row\n\n    def remove(self, val):\n        del self[self._table.index(val)]\n\n\nclass PyListModelTooltip(PyListModel):\n    def __init__(self, iterable=None, tooltips=(), **kwargs):\n        super().__init__(iterable, **kwargs)\n        if not isinstance(tooltips, Sequence):\n            # may be a generator; if not, fail\n            tooltips = list(tooltips)\n        self.tooltips = tooltips\n\n    def data(self, index, role=Qt.DisplayRole):\n        if role == Qt.ToolTipRole:\n            if index.row() >= len(self.tooltips):\n                return None\n            return self.tooltips[index.row()]\n        else:\n            return super().data(index, role)\n\n\nclass VariableListModel(PyListModel):\n    MIME_TYPE = \"application/x-Orange-VariableList\"\n\n    def __init__(self, *args, placeholder=None, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.placeholder = placeholder\n\n    def data(self, index, role=Qt.DisplayRole):\n        if self._is_index_valid(index):\n            var = self[index.row()]\n            if var is None and role == Qt.DisplayRole:\n                return self.placeholder or \"None\"\n            if not isinstance(var, Variable):\n                return super().data(index, role)\n            elif role == Qt.DisplayRole:\n                return var.name\n            elif role == Qt.DecorationRole:\n                return gui.attributeIconDict[var]\n            elif role == Qt.ToolTipRole:\n                return self.variable_tooltip(var)\n            elif role == gui.TableVariable:\n                return var\n            else:\n                return PyListModel.data(self, index, role)\n\n    def variable_tooltip(self, var):\n        if var.is_discrete:\n            return self.discrete_variable_tooltip(var)\n        elif var.is_time:\n            return self.time_variable_toltip(var)\n        elif var.is_continuous:\n            return self.continuous_variable_toltip(var)\n        elif var.is_string:\n            return self.string_variable_tooltip(var)\n\n    def variable_labels_tooltip(self, var):\n        text = \"\"\n        if var.attributes:\n            items = [(safe_text(key), safe_text(value))\n                     for key, value in var.attributes.items()]\n            labels = list(map(\"%s = %s\".__mod__, items))\n            text += \"<br/>Variable Labels:<br/>\"\n            text += \"<br/>\".join(labels)\n        return text\n\n    def discrete_variable_tooltip(self, var):\n        text = \"<b>%s</b><br/>Categorical with %i values: \" %\\\n               (safe_text(var.name), len(var.values))\n        text += \", \".join(\"%r\" % safe_text(v) for v in var.values)\n        text += self.variable_labels_tooltip(var)\n        return text\n\n    def time_variable_toltip(self, var):\n        text = \"<b>%s</b><br/>Time\" % safe_text(var.name)\n        text += self.variable_labels_tooltip(var)\n        return text\n\n    def continuous_variable_toltip(self, var):\n        text = \"<b>%s</b><br/>Numeric\" % safe_text(var.name)\n        text += self.variable_labels_tooltip(var)\n        return text\n\n    def string_variable_tooltip(self, var):\n        text = \"<b>%s</b><br/>Text\" % safe_text(var.name)\n        text += self.variable_labels_tooltip(var)\n        return text\n\n\nclass DomainModel(VariableListModel):\n    ATTRIBUTES, CLASSES, METAS = 1, 2, 4\n    MIXED = ATTRIBUTES | CLASSES | METAS\n    SEPARATED = (CLASSES, PyListModel.Separator,\n                 METAS, PyListModel.Separator,\n                 ATTRIBUTES)\n    PRIMITIVE = (DiscreteVariable, ContinuousVariable)\n\n    def __init__(self, order=SEPARATED, separators=True, placeholder=None,\n                 valid_types=None, alphabetical=False, skip_hidden_vars=True, **kwargs):\n        \"\"\"\n\n        Parameters\n        ----------\n        order: tuple or int\n            Order of attributes, metas, classes, separators and other options\n        separators: bool\n            If False, remove separators from `order`.\n        placeholder: str\n            The text that is shown when no variable is selected\n        valid_types: tuple\n            (Sub)types of `Variable` that are included in the model\n        alphabetical: bool\n            If true, variables are sorted alphabetically.\n        skip_hidden_vars: bool\n            If true, variables marked as \"hidden\" are skipped.\n        \"\"\"\n        super().__init__(placeholder=placeholder, **kwargs)\n        if isinstance(order, int):\n            order = (order,)\n        if placeholder is not None and None not in order:\n            # Add None for the placeholder if it's not already there\n            # Include separator if the current order uses them\n            order = (None,) + \\\n                    (self.Separator, ) * (self.Separator in order) + \\\n                    order\n        if not separators:\n            order = [e for e in order if e is not self.Separator]\n        self.order = order\n        self.valid_types = valid_types\n        self.alphabetical = alphabetical\n        self.skip_hidden_vars = skip_hidden_vars\n        self._within_set_domain = False\n        self.set_domain(None)\n\n    def set_domain(self, domain):\n        self.beginResetModel()\n        content = []\n        # The logic related to separators is a bit complicated: it ensures that\n        # even when a section is empty we don't have two separators in a row\n        # or a separator at the end\n        add_separator = False\n        for section in self.order:\n            if section is self.Separator:\n                add_separator = True\n                continue\n            if isinstance(section, int):\n                if domain is None:\n                    continue\n                to_add = list(chain(\n                    *(vars for i, vars in enumerate(\n                        (domain.attributes, domain.class_vars, domain.metas))\n                      if (1 << i) & section)))\n                if self.skip_hidden_vars:\n                    to_add = list(filter_visible(to_add))\n                if self.valid_types is not None:\n                    to_add = [var for var in to_add\n                              if isinstance(var, self.valid_types)]\n                if self.alphabetical:\n                    to_add = sorted(to_add, key=lambda x: x.name)\n            elif isinstance(section, list):\n                to_add = section\n            else:\n                to_add = [section]\n            if to_add:\n                if add_separator and content:\n                    content.append(self.Separator)\n                    add_separator = False\n                content += to_add\n        try:\n            self._within_set_domain = True\n            self[:] = content\n        finally:\n            self._within_set_domain = False\n        self.endResetModel()\n\n    def prevent_modification(method):  # pylint: disable=no-self-argument\n        @wraps(method)\n        # pylint: disable=protected-access\n        def e(self, *args, **kwargs):\n            if self._within_set_domain:\n                method(self, *args, **kwargs)\n            else:\n                raise TypeError(\n                    \"{} can be modified only by calling 'set_domain'\".\n                    format(type(self).__name__))\n        return e\n\n    @prevent_modification\n    def extend(self, iterable):\n        return super().extend(iterable)\n\n    @prevent_modification\n    def append(self, item):\n        return super().append(item)\n\n    @prevent_modification\n    def insert(self, i, val):\n        return super().insert(i, val)\n\n    @prevent_modification\n    def remove(self, val):\n        return super().remove(val)\n\n    @prevent_modification\n    def pop(self, i):\n        return super().pop(i)\n\n    @prevent_modification\n    def clear(self):\n        return super().clear()\n\n    @prevent_modification\n    def __delitem__(self, s):\n        return super().__delitem__(s)\n\n    @prevent_modification\n    def __setitem__(self, s, value):\n        return super().__setitem__(s, value)\n\n    @prevent_modification\n    def reverse(self):\n        return super().reverse()\n\n    @prevent_modification\n    def sort(self, *args, **kwargs):\n        return super().sort(*args, **kwargs)\n\n    def setData(self, index, value, role=Qt.EditRole):\n        # reimplemented\n        if role == Qt.EditRole:\n            return False\n        else:\n            return super().setData(index, value, role)\n\n    def setItemData(self, index, data):\n        # reimplemented\n        if Qt.EditRole in data:\n            return False\n        else:\n            return super().setItemData(index, data)\n\n    def insertRows(self, row, count, parent=QModelIndex()):\n        # reimplemented\n        return False\n\n    def removeRows(self, row, count, parent=QModelIndex()):\n        # reimplemented\n        return False\n\n_html_replace = [(\"<\", \"&lt;\"), (\">\", \"&gt;\")]\n\n\ndef safe_text(text):\n    for old, new in _html_replace:\n        text = str(text).replace(old, new)\n    return text\n\n\nclass ContinuousPalettesModel(QAbstractListModel):\n    \"\"\"\n    Model for combo boxes\n    \"\"\"\n    KeyRole = Qt.UserRole + 1\n    def __init__(self, parent=None, categories=None, icon_width=64):\n        super().__init__(parent)\n        self.icon_width = icon_width\n\n        palettes = list(ContinuousPalettes.values())\n        if categories is None:\n            # Use dict, not set, to keep order of categories\n            categories = dict.fromkeys(palette.category for palette in palettes)\n\n        self.items = []\n        for category in categories:\n            self.items.append(category)\n            self.items += [palette for palette in palettes\n                           if palette.category == category]\n        if len(categories) == 1:\n            del self.items[0]\n\n    def rowCount(self, parent):\n        return 0 if parent.isValid() else len(self.items)\n\n    @staticmethod\n    def columnCount(parent):\n        return 0 if parent.isValid() else 1\n\n    def data(self, index, role):\n        item = self.items[index.row()]\n        if isinstance(item, str):\n            if role in [Qt.EditRole, Qt.DisplayRole]:\n                return item\n        else:\n            if role in [Qt.EditRole, Qt.DisplayRole]:\n                return item.friendly_name\n            if role == Qt.DecorationRole:\n                return item.color_strip(self.icon_width, 16)\n            if role == Qt.UserRole:\n                return item\n            if role == self.KeyRole:\n                return item.name\n        return None\n\n    def flags(self, index):\n        item = self.items[index.row()]\n        if isinstance(item, ContinuousPalette):\n            return Qt.ItemIsEnabled | Qt.ItemIsSelectable\n        else:\n            return Qt.NoItemFlags\n\n    def indexOf(self, x):\n        if isinstance(x, str):\n            for i, item in enumerate(self.items):\n                if not isinstance(item, str) \\\n                        and x in (item.name, item.friendly_name):\n                    return i\n        elif isinstance(x, ContinuousPalette):\n            return self.items.index(x)\n        return None\n\n\nclass ListSingleSelectionModel(QItemSelectionModel):\n    \"\"\" Item selection model for list item models with single selection.\n\n    Defines signal:\n        - selectedIndexChanged(QModelIndex)\n\n    \"\"\"\n    selectedIndexChanged = Signal(QModelIndex)\n\n    def __init__(self, model, parent=None):\n        QItemSelectionModel.__init__(self, model, parent)\n        self.selectionChanged.connect(self.onSelectionChanged)\n\n    def onSelectionChanged(self, new, _):\n        index = list(new.indexes())\n        if index:\n            index = index.pop()\n        else:\n            index = QModelIndex()\n\n        self.selectedIndexChanged.emit(index)\n\n    def selectedRow(self):\n        \"\"\" Return QModelIndex of the selected row or invalid if no selection.\n        \"\"\"\n        rows = self.selectedRows()\n        if rows:\n            return rows[0]\n        else:\n            return QModelIndex()\n\n    def select(self, index, flags=QItemSelectionModel.ClearAndSelect):\n        if isinstance(index, int):\n            index = self.model().index(index)\n        return QItemSelectionModel.select(self, index, flags)\n\n\ndef select_row(view, row):\n    \"\"\"\n    Select a `row` in an item view.\n    \"\"\"\n    selmodel = view.selectionModel()\n    selmodel.select(view.model().index(row, 0),\n                    QItemSelectionModel.ClearAndSelect |\n                    QItemSelectionModel.Rows)\n\n\ndef select_rows(view, row_indices, command=QItemSelectionModel.ClearAndSelect):\n    \"\"\"\n    Select several rows in view.\n\n    :param QAbstractItemView view:\n    :param row_indices: Integer indices of rows to select.\n    :param command: QItemSelectionModel.SelectionFlags\n    \"\"\"\n    selmodel = view.selectionModel()\n    model = view.model()\n    selection = QItemSelection()\n    for row in row_indices:\n        index = model.index(row, 0)\n        selection.select(index, index)\n    selmodel.select(selection, command | QItemSelectionModel.Rows)\n\n\nclass ModelActionsWidget(QWidget):\n    def __init__(self, actions=None, parent=None,\n                 direction=QBoxLayout.LeftToRight):\n        QWidget.__init__(self, parent)\n        self.actions = []\n        self.buttons = []\n        layout = QBoxLayout(direction)\n        layout.setContentsMargins(0, 0, 0, 0)\n        self.setContentsMargins(0, 0, 0, 0)\n        self.setLayout(layout)\n        if actions is not None:\n            for action in actions:\n                self.addAction(action)\n        self.setLayout(layout)\n\n    def actionButton(self, action):\n        if isinstance(action, QAction):\n            button = QToolButton(self)\n            button.setDefaultAction(action)\n            return button\n        elif isinstance(action, QAbstractButton):\n            return action\n\n    def insertAction(self, ind, action, *args):\n        button = self.actionButton(action)\n        self.layout().insertWidget(ind, button, *args)\n        self.buttons.insert(ind, button)\n        self.actions.insert(ind, action)\n        return button\n\n    def addAction(self, action, *args):\n        return self.insertAction(-1, action, *args)\n\n\nclass TableModel(AbstractSortTableModel):\n    \"\"\"\n    An adapter for using Orange.data.Table within Qt's Item View Framework.\n\n    :param Orange.data.Table sourcedata: Source data table.\n    :param QObject parent:\n    \"\"\"\n    #: Orange.data.Value for the index.\n    ValueRole = gui.TableValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Value of the row's class.\n    ClassValueRole = gui.TableClassValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Variable of the column.\n    VariableRole = gui.TableVariable  # next(gui.OrangeUserRole)\n    #: Basic statistics of the column\n    VariableStatsRole = next(gui.OrangeUserRole)\n    #: The column's role (position) in the domain.\n    #: One of Attribute, ClassVar or Meta\n    DomainRole = next(gui.OrangeUserRole)\n\n    #: Column domain roles\n    ClassVar, Meta, Attribute = range(3)\n\n    #: Default background color for domain roles\n    ColorForRole = {\n        ClassVar: QColor(160, 160, 160),\n        Meta: QColor(220, 220, 200),\n        Attribute: None,\n    }\n\n    #: Standard column descriptor\n    Column = namedtuple(\n        \"Column\", [\"var\", \"role\", \"background\", \"format\"])\n    #: Basket column descriptor (i.e. sparse X/Y/metas/ compressed into\n    #: a single column).\n    Basket = namedtuple(\n        \"Basket\", [\"vars\", \"role\", \"background\", \"density\", \"format\"])\n\n    # The class uses the same names (X_density etc) as Table\n    # pylint: disable=invalid-name\n    def __init__(self, sourcedata, parent=None):\n        super().__init__(parent)\n        self.source = sourcedata\n        self.domain = domain = sourcedata.domain\n\n        self.X_density = sourcedata.X_density()\n        self.Y_density = sourcedata.Y_density()\n        self.M_density = sourcedata.metas_density()\n\n        brush_for_role = {\n            role: QBrush(c) if c is not None else None\n            for role, c in self.ColorForRole.items()\n        }\n\n        def format_sparse(vars, row):\n            row = row.tocsr()\n            return \", \".join(\"{}={}\".format(vars[i].name, vars[i].str_val(v))\n                             for i, v in zip(row.indices, row.data))\n\n        def format_sparse_bool(vars, row):\n            row = row.tocsr()\n            return \", \".join(vars[i].name for i in row.indices)\n\n        def format_dense(var, val):\n            return var.str_val(val)\n\n        def make_basket_formatter(vars, density):\n            formatter = (format_sparse if density == Storage.SPARSE\n                         else format_sparse_bool)\n            return partial(formatter, vars)\n\n        def make_basket(vars, density, role):\n            return TableModel.Basket(\n                vars, role, brush_for_role[role], density,\n                make_basket_formatter(vars, density)\n            )\n\n        def make_column(var, role):\n            return TableModel.Column(\n                var, role, brush_for_role[role],\n                partial(format_dense, var)\n            )\n\n        columns = []\n\n        if self.Y_density != Storage.DENSE and domain.class_vars:\n            coldesc = make_basket(domain.class_vars, self.Y_density,\n                                  TableModel.ClassVar)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.ClassVar)\n                        for var in domain.class_vars]\n\n        if self.M_density != Storage.DENSE and domain.metas:\n            coldesc = make_basket(domain.metas, self.M_density,\n                                  TableModel.Meta)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Meta)\n                        for var in domain.metas]\n\n        if self.X_density != Storage.DENSE and domain.attributes:\n            coldesc = make_basket(domain.attributes, self.X_density,\n                                  TableModel.Attribute)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Attribute)\n                        for var in domain.attributes]\n\n        #: list of all domain variables (class_vars + metas + attrs)\n        self.vars = domain.class_vars + domain.metas + domain.attributes\n        self.columns = columns\n\n        #: A list of all unique attribute labels (in all variables)\n        self._labels = sorted(\n            reduce(operator.ior,\n                   [set(var.attributes) for var in self.vars],\n                   set()))\n\n        # column basic statistics (VariableStatsRole), computed when\n        # first needed.\n        self.__stats = None\n        self.__rowCount = sourcedata.approx_len()\n        self.__columnCount = len(self.columns)\n\n        if self.__rowCount > (2 ** 31 - 1):\n            raise ValueError(\"len(sourcedata) > 2 ** 31 - 1\")\n\n    def _get_source_item(self, row, coldesc):\n        if isinstance(coldesc, self.Basket):\n            # `self.source[row:row + 1]` returns Table\n            # `self.source[row]` returns RowInstance\n            # We only worry about X and metas, as Y cannot be sparse\n            if coldesc.role is self.Meta:\n                return self.source[row:row + 1].metas\n            if coldesc.role is self.Attribute:\n                return self.source[row:row + 1].X\n        return self.source[row, coldesc.var]\n\n    def sortColumnData(self, column):\n        return self._columnSortKeyData(column, TableModel.ValueRole)\n\n    @deprecated('Orange.widgets.utils.itemmodels.TableModel.sortColumnData')\n    def columnSortKeyData(self, column, role):\n        return self._columnSortKeyData(column, role)\n\n    def _columnSortKeyData(self, column, role):\n        \"\"\"\n        Return a sequence of source table objects which can be used as\n        `keys` for sorting.\n\n        :param int column: Sort column.\n        :param Qt.ItemRole role: Sort item role.\n\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Column) \\\n                and role == TableModel.ValueRole:\n            return self.source.get_column(coldesc.var)\n        else:\n            return numpy.asarray([self.index(i, column).data(role)\n                                  for i in range(self.rowCount())])\n\n    def data(self, index, role,\n             # For optimizing out LOAD_GLOBAL byte code instructions in\n             # the item role tests.\n             _str=str,\n             _Qt_DisplayRole=Qt.DisplayRole,\n             _Qt_EditRole=Qt.EditRole,\n             _Qt_BackgroundRole=Qt.BackgroundRole,\n             _Qt_ForegroundRole=Qt.ForegroundRole,\n             _ValueRole=ValueRole,\n             _ClassValueRole=ClassValueRole,\n             _VariableRole=VariableRole,\n             _DomainRole=DomainRole,\n             _VariableStatsRole=VariableStatsRole,\n             # Some cached local precomputed values.\n             # All of the above roles we respond to\n             _recognizedRoles=frozenset([Qt.DisplayRole,\n                                         Qt.EditRole,\n                                         Qt.BackgroundRole,\n                                         Qt.ForegroundRole,\n                                         ValueRole,\n                                         ClassValueRole,\n                                         VariableRole,\n                                         DomainRole,\n                                         VariableStatsRole])):\n        \"\"\"\n        Reimplemented from `QAbstractItemModel.data`\n        \"\"\"\n        if role not in _recognizedRoles:\n            return None\n\n        row = index.row()\n        if not 0 <= row <= self.__rowCount:\n            return None\n\n        row = self.mapToSourceRows(row)\n        col = 0 if role is _ClassValueRole else index.column()\n\n        try:\n            coldesc = self.columns[col]\n            instance = self._get_source_item(row, coldesc)\n        except IndexError:\n            self.layoutAboutToBeChanged.emit()\n            self.beginRemoveRows(self.parent(), row, max(self.rowCount(), row))\n            self.__rowCount = min(row, self.__rowCount)\n            self.endRemoveRows()\n            self.layoutChanged.emit()\n            return None\n\n        if role == _Qt_DisplayRole:\n            return coldesc.format(instance)\n        elif role in (_Qt_EditRole, _ValueRole) and isinstance(coldesc, TableModel.Column):\n            return Value(coldesc.var, instance)\n        elif role == _Qt_BackgroundRole:\n            return coldesc.background\n        elif role == _Qt_ForegroundRole:\n            # The background is light-ish, force dark text color\n            return coldesc.background and QColor(0, 0, 0, 200)\n        elif role == _ClassValueRole \\\n                and isinstance(coldesc, TableModel.Column) \\\n                and len(self.domain.class_vars) == 1:\n            return Value(coldesc.var, instance)\n        elif role == _VariableRole and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == _DomainRole:\n            return coldesc.role\n        elif role == _VariableStatsRole:\n            return self._stats_for_column(col)\n        else:\n            return None\n\n    def setData(self, index, value, role):\n        row = self.mapFromSourceRows(index.row())\n        if role == Qt.EditRole:\n            try:\n                self.source[row, index.column()] = value\n            except (TypeError, IndexError):\n                return False\n            else:\n                self.dataChanged.emit(index, index)\n                return True\n        else:\n            return False\n\n    def parent(self, index=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.parent`.\"\"\"\n        return QModelIndex()\n\n    def rowCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.rowCount`.\"\"\"\n        return 0 if parent.isValid() else self.__rowCount\n\n    def columnCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.columnCount`.\"\"\"\n        return 0 if parent.isValid() else self.__columnCount\n\n    def headerData(self, section, orientation, role):\n        \"\"\"Reimplemented from `QAbstractTableModel.headerData`.\"\"\"\n        if orientation == Qt.Vertical:\n            if role == Qt.DisplayRole:\n                return int(self.mapToSourceRows(section) + 1)\n            return None\n\n        coldesc = self.columns[section]\n        if role == Qt.DisplayRole:\n            if isinstance(coldesc, TableModel.Basket):\n                return \"{...}\"\n            else:\n                return coldesc.var.name\n        elif role == Qt.ToolTipRole:\n            return self._tooltip(coldesc)\n        elif role == TableModel.VariableRole \\\n                and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == TableModel.VariableStatsRole:\n            return self._stats_for_column(section)\n        elif role == TableModel.DomainRole:\n            return coldesc.role\n        else:\n            return None\n\n    def _tooltip(self, coldesc):\n        \"\"\"\n        Return an header tool tip text for an `column` descriptor.\n        \"\"\"\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        labels = self._labels\n        variable = coldesc.var\n        pairs = [(escape(key), escape(str(variable.attributes[key])))\n                 for key in labels if key in variable.attributes]\n        tip = \"<b>%s</b>\" % escape(variable.name)\n        tip = \"<br/>\".join([tip] + [\"%s = %s\" % pair for pair in pairs])\n        return tip\n\n    def _stats_for_column(self, column):\n        \"\"\"\n        Return BasicStats for `column` index.\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        if self.__stats is None:\n            self.__stats = datacaching.getCached(\n                self.source, basic_stats.DomainBasicStats,\n                (self.source, True)\n            )\n\n        return self.__stats[coldesc.var]\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/utils/itemmodels.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "b2f165b91",
                "new_commit_hash": "a749b7115",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/utils/itemmodels.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/utils/itemmodels.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 844,
                            "length": 7
                        },
                        "new_range": {
                            "start": 844,
                            "length": 7
                        },
                        "section": "class TableModel(AbstractSortTableModel):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        def make_basket(vars, density, role):",
                                "type": "context"
                            },
                            {
                                "content": "            return TableModel.Basket(",
                                "type": "context"
                            },
                            {
                                "content": "                vars, TableModel.Attribute, brush_for_role[role], density,",
                                "type": "deleted"
                            },
                            {
                                "content": "                vars, role, brush_for_role[role], density,",
                                "type": "added"
                            },
                            {
                                "content": "                make_basket_formatter(vars, density)",
                                "type": "context"
                            },
                            {
                                "content": "            )",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/utils/itemmodels.py",
                            "type": "method",
                            "name": "TableModel.__init__",
                            "content": "class TableModel(AbstractSortTableModel):\n    \"\"\"\n    An adapter for using Orange.data.Table within Qt's Item View Framework.\n\n    :param Orange.data.Table sourcedata: Source data table.\n    :param QObject parent:\n    \"\"\"\n    #: Orange.data.Value for the index.\n    ValueRole = gui.TableValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Value of the row's class.\n    ClassValueRole = gui.TableClassValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Variable of the column.\n    VariableRole = gui.TableVariable  # next(gui.OrangeUserRole)\n    #: Basic statistics of the column\n    VariableStatsRole = next(gui.OrangeUserRole)\n    #: The column's role (position) in the domain.\n    #: One of Attribute, ClassVar or Meta\n    DomainRole = next(gui.OrangeUserRole)\n\n    #: Column domain roles\n    ClassVar, Meta, Attribute = range(3)\n\n    #: Default background color for domain roles\n    ColorForRole = {\n        ClassVar: QColor(160, 160, 160),\n        Meta: QColor(220, 220, 200),\n        Attribute: None,\n    }\n\n    #: Standard column descriptor\n    Column = namedtuple(\n        \"Column\", [\"var\", \"role\", \"background\", \"format\"])\n    #: Basket column descriptor (i.e. sparse X/Y/metas/ compressed into\n    #: a single column).\n    Basket = namedtuple(\n        \"Basket\", [\"vars\", \"role\", \"background\", \"density\", \"format\"])\n\n    # The class uses the same names (X_density etc) as Table\n    # pylint: disable=invalid-name\n    def __init__(self, sourcedata, parent=None):\n        super().__init__(parent)\n        self.source = sourcedata\n        self.domain = domain = sourcedata.domain\n\n        self.X_density = sourcedata.X_density()\n        self.Y_density = sourcedata.Y_density()\n        self.M_density = sourcedata.metas_density()\n\n        brush_for_role = {\n            role: QBrush(c) if c is not None else None\n            for role, c in self.ColorForRole.items()\n        }\n\n        def format_sparse(vars, row):\n            row = row.tocsr()\n            return \", \".join(\"{}={}\".format(vars[i].name, vars[i].str_val(v))\n                             for i, v in zip(row.indices, row.data))\n\n        def format_sparse_bool(vars, row):\n            row = row.tocsr()\n            return \", \".join(vars[i].name for i in row.indices)\n\n        def format_dense(var, val):\n            return var.str_val(val)\n\n        def make_basket_formatter(vars, density):\n            formatter = (format_sparse if density == Storage.SPARSE\n                         else format_sparse_bool)\n            return partial(formatter, vars)\n\n        def make_basket(vars, density, role):\n            return TableModel.Basket(\n                vars, TableModel.Attribute, brush_for_role[role], density,\n                make_basket_formatter(vars, density)\n            )\n\n        def make_column(var, role):\n            return TableModel.Column(\n                var, role, brush_for_role[role],\n                partial(format_dense, var)\n            )\n\n        columns = []\n\n        if self.Y_density != Storage.DENSE and domain.class_vars:\n            coldesc = make_basket(domain.class_vars, self.Y_density,\n                                  TableModel.ClassVar)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.ClassVar)\n                        for var in domain.class_vars]\n\n        if self.M_density != Storage.DENSE and domain.metas:\n            coldesc = make_basket(domain.metas, self.M_density,\n                                  TableModel.Meta)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Meta)\n                        for var in domain.metas]\n\n        if self.X_density != Storage.DENSE and domain.attributes:\n            coldesc = make_basket(domain.attributes, self.X_density,\n                                  TableModel.Attribute)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Attribute)\n                        for var in domain.attributes]\n\n        #: list of all domain variables (class_vars + metas + attrs)\n        self.vars = domain.class_vars + domain.metas + domain.attributes\n        self.columns = columns\n\n        #: A list of all unique attribute labels (in all variables)\n        self._labels = sorted(\n            reduce(operator.ior,\n                   [set(var.attributes) for var in self.vars],\n                   set()))\n\n        # column basic statistics (VariableStatsRole), computed when\n        # first needed.\n        self.__stats = None\n        self.__rowCount = sourcedata.approx_len()\n        self.__columnCount = len(self.columns)\n\n        if self.__rowCount > (2 ** 31 - 1):\n            raise ValueError(\"len(sourcedata) > 2 ** 31 - 1\")\n\n    def _get_source_item(self, row, coldesc):\n        if isinstance(coldesc, self.Basket):\n            # `self.source[row:row + 1]` returns Table\n            # `self.source[row]` returns RowInstance\n            if coldesc.role is self.ClassVar:\n                return self.source[row:row + 1].Y\n            if coldesc.role is self.Meta:\n                return self.source[row:row + 1].metas\n            if coldesc.role is self.Attribute:\n                return self.source[row:row + 1].X\n        return self.source[row, coldesc.var]\n\n    def sortColumnData(self, column):\n        return self._columnSortKeyData(column, TableModel.ValueRole)\n\n    @deprecated('Orange.widgets.utils.itemmodels.TableModel.sortColumnData')\n    def columnSortKeyData(self, column, role):\n        return self._columnSortKeyData(column, role)\n\n    def _columnSortKeyData(self, column, role):\n        \"\"\"\n        Return a sequence of source table objects which can be used as\n        `keys` for sorting.\n\n        :param int column: Sort column.\n        :param Qt.ItemRole role: Sort item role.\n\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Column) \\\n                and role == TableModel.ValueRole:\n            return self.source.get_column(coldesc.var)\n        else:\n            return numpy.asarray([self.index(i, column).data(role)\n                                  for i in range(self.rowCount())])\n\n    def data(self, index, role,\n             # For optimizing out LOAD_GLOBAL byte code instructions in\n             # the item role tests.\n             _str=str,\n             _Qt_DisplayRole=Qt.DisplayRole,\n             _Qt_EditRole=Qt.EditRole,\n             _Qt_BackgroundRole=Qt.BackgroundRole,\n             _Qt_ForegroundRole=Qt.ForegroundRole,\n             _ValueRole=ValueRole,\n             _ClassValueRole=ClassValueRole,\n             _VariableRole=VariableRole,\n             _DomainRole=DomainRole,\n             _VariableStatsRole=VariableStatsRole,\n             # Some cached local precomputed values.\n             # All of the above roles we respond to\n             _recognizedRoles=frozenset([Qt.DisplayRole,\n                                         Qt.EditRole,\n                                         Qt.BackgroundRole,\n                                         Qt.ForegroundRole,\n                                         ValueRole,\n                                         ClassValueRole,\n                                         VariableRole,\n                                         DomainRole,\n                                         VariableStatsRole])):\n        \"\"\"\n        Reimplemented from `QAbstractItemModel.data`\n        \"\"\"\n        if role not in _recognizedRoles:\n            return None\n\n        row = index.row()\n        if not 0 <= row <= self.__rowCount:\n            return None\n\n        row = self.mapToSourceRows(row)\n        col = 0 if role is _ClassValueRole else index.column()\n\n        try:\n            coldesc = self.columns[col]\n            instance = self._get_source_item(row, coldesc)\n        except IndexError:\n            self.layoutAboutToBeChanged.emit()\n            self.beginRemoveRows(self.parent(), row, max(self.rowCount(), row))\n            self.__rowCount = min(row, self.__rowCount)\n            self.endRemoveRows()\n            self.layoutChanged.emit()\n            return None\n\n        if role == _Qt_DisplayRole:\n            return coldesc.format(instance)\n        elif role in (_Qt_EditRole, _ValueRole) and isinstance(coldesc, TableModel.Column):\n            return Value(coldesc.var, instance)\n        elif role == _Qt_BackgroundRole:\n            return coldesc.background\n        elif role == _Qt_ForegroundRole:\n            # The background is light-ish, force dark text color\n            return coldesc.background and QColor(0, 0, 0, 200)\n        elif role == _ClassValueRole \\\n                and isinstance(coldesc, TableModel.Column) \\\n                and len(self.domain.class_vars) == 1:\n            return Value(coldesc.var, instance)\n        elif role == _VariableRole and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == _DomainRole:\n            return coldesc.role\n        elif role == _VariableStatsRole:\n            return self._stats_for_column(col)\n        else:\n            return None\n\n    def setData(self, index, value, role):\n        row = self.mapFromSourceRows(index.row())\n        if role == Qt.EditRole:\n            try:\n                self.source[row, index.column()] = value\n            except (TypeError, IndexError):\n                return False\n            else:\n                self.dataChanged.emit(index, index)\n                return True\n        else:\n            return False\n\n    def parent(self, index=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.parent`.\"\"\"\n        return QModelIndex()\n\n    def rowCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.rowCount`.\"\"\"\n        return 0 if parent.isValid() else self.__rowCount\n\n    def columnCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.columnCount`.\"\"\"\n        return 0 if parent.isValid() else self.__columnCount\n\n    def headerData(self, section, orientation, role):\n        \"\"\"Reimplemented from `QAbstractTableModel.headerData`.\"\"\"\n        if orientation == Qt.Vertical:\n            if role == Qt.DisplayRole:\n                return int(self.mapToSourceRows(section) + 1)\n            return None\n\n        coldesc = self.columns[section]\n        if role == Qt.DisplayRole:\n            if isinstance(coldesc, TableModel.Basket):\n                return \"{...}\"\n            else:\n                return coldesc.var.name\n        elif role == Qt.ToolTipRole:\n            return self._tooltip(coldesc)\n        elif role == TableModel.VariableRole \\\n                and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == TableModel.VariableStatsRole:\n            return self._stats_for_column(section)\n        elif role == TableModel.DomainRole:\n            return coldesc.role\n        else:\n            return None\n\n    def _tooltip(self, coldesc):\n        \"\"\"\n        Return an header tool tip text for an `column` descriptor.\n        \"\"\"\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        labels = self._labels\n        variable = coldesc.var\n        pairs = [(escape(key), escape(str(variable.attributes[key])))\n                 for key in labels if key in variable.attributes]\n        tip = \"<b>%s</b>\" % escape(variable.name)\n        tip = \"<br/>\".join([tip] + [\"%s = %s\" % pair for pair in pairs])\n        return tip\n\n    def _stats_for_column(self, column):\n        \"\"\"\n        Return BasicStats for `column` index.\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        if self.__stats is None:\n            self.__stats = datacaching.getCached(\n                self.source, basic_stats.DomainBasicStats,\n                (self.source, True)\n            )\n\n        return self.__stats[coldesc.var]",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 814,
                            "end_lineno": 900,
                            "parent": {
                                "file_name": "Orange/widgets/utils/itemmodels.py",
                                "type": "class",
                                "name": "TableModel",
                                "content": "class TableModel(AbstractSortTableModel):\n    \"\"\"\n    An adapter for using Orange.data.Table within Qt's Item View Framework.\n\n    :param Orange.data.Table sourcedata: Source data table.\n    :param QObject parent:\n    \"\"\"\n    #: Orange.data.Value for the index.\n    ValueRole = gui.TableValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Value of the row's class.\n    ClassValueRole = gui.TableClassValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Variable of the column.\n    VariableRole = gui.TableVariable  # next(gui.OrangeUserRole)\n    #: Basic statistics of the column\n    VariableStatsRole = next(gui.OrangeUserRole)\n    #: The column's role (position) in the domain.\n    #: One of Attribute, ClassVar or Meta\n    DomainRole = next(gui.OrangeUserRole)\n\n    #: Column domain roles\n    ClassVar, Meta, Attribute = range(3)\n\n    #: Default background color for domain roles\n    ColorForRole = {\n        ClassVar: QColor(160, 160, 160),\n        Meta: QColor(220, 220, 200),\n        Attribute: None,\n    }\n\n    #: Standard column descriptor\n    Column = namedtuple(\n        \"Column\", [\"var\", \"role\", \"background\", \"format\"])\n    #: Basket column descriptor (i.e. sparse X/Y/metas/ compressed into\n    #: a single column).\n    Basket = namedtuple(\n        \"Basket\", [\"vars\", \"role\", \"background\", \"density\", \"format\"])\n\n    # The class uses the same names (X_density etc) as Table\n    # pylint: disable=invalid-name\n    def __init__(self, sourcedata, parent=None):\n        super().__init__(parent)\n        self.source = sourcedata\n        self.domain = domain = sourcedata.domain\n\n        self.X_density = sourcedata.X_density()\n        self.Y_density = sourcedata.Y_density()\n        self.M_density = sourcedata.metas_density()\n\n        brush_for_role = {\n            role: QBrush(c) if c is not None else None\n            for role, c in self.ColorForRole.items()\n        }\n\n        def format_sparse(vars, row):\n            row = row.tocsr()\n            return \", \".join(\"{}={}\".format(vars[i].name, vars[i].str_val(v))\n                             for i, v in zip(row.indices, row.data))\n\n        def format_sparse_bool(vars, row):\n            row = row.tocsr()\n            return \", \".join(vars[i].name for i in row.indices)\n\n        def format_dense(var, val):\n            return var.str_val(val)\n\n        def make_basket_formatter(vars, density):\n            formatter = (format_sparse if density == Storage.SPARSE\n                         else format_sparse_bool)\n            return partial(formatter, vars)\n\n        def make_basket(vars, density, role):\n            return TableModel.Basket(\n                vars, TableModel.Attribute, brush_for_role[role], density,\n                make_basket_formatter(vars, density)\n            )\n\n        def make_column(var, role):\n            return TableModel.Column(\n                var, role, brush_for_role[role],\n                partial(format_dense, var)\n            )\n\n        columns = []\n\n        if self.Y_density != Storage.DENSE and domain.class_vars:\n            coldesc = make_basket(domain.class_vars, self.Y_density,\n                                  TableModel.ClassVar)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.ClassVar)\n                        for var in domain.class_vars]\n\n        if self.M_density != Storage.DENSE and domain.metas:\n            coldesc = make_basket(domain.metas, self.M_density,\n                                  TableModel.Meta)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Meta)\n                        for var in domain.metas]\n\n        if self.X_density != Storage.DENSE and domain.attributes:\n            coldesc = make_basket(domain.attributes, self.X_density,\n                                  TableModel.Attribute)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Attribute)\n                        for var in domain.attributes]\n\n        #: list of all domain variables (class_vars + metas + attrs)\n        self.vars = domain.class_vars + domain.metas + domain.attributes\n        self.columns = columns\n\n        #: A list of all unique attribute labels (in all variables)\n        self._labels = sorted(\n            reduce(operator.ior,\n                   [set(var.attributes) for var in self.vars],\n                   set()))\n\n        # column basic statistics (VariableStatsRole), computed when\n        # first needed.\n        self.__stats = None\n        self.__rowCount = sourcedata.approx_len()\n        self.__columnCount = len(self.columns)\n\n        if self.__rowCount > (2 ** 31 - 1):\n            raise ValueError(\"len(sourcedata) > 2 ** 31 - 1\")\n\n    def _get_source_item(self, row, coldesc):\n        if isinstance(coldesc, self.Basket):\n            # `self.source[row:row + 1]` returns Table\n            # `self.source[row]` returns RowInstance\n            if coldesc.role is self.ClassVar:\n                return self.source[row:row + 1].Y\n            if coldesc.role is self.Meta:\n                return self.source[row:row + 1].metas\n            if coldesc.role is self.Attribute:\n                return self.source[row:row + 1].X\n        return self.source[row, coldesc.var]\n\n    def sortColumnData(self, column):\n        return self._columnSortKeyData(column, TableModel.ValueRole)\n\n    @deprecated('Orange.widgets.utils.itemmodels.TableModel.sortColumnData')\n    def columnSortKeyData(self, column, role):\n        return self._columnSortKeyData(column, role)\n\n    def _columnSortKeyData(self, column, role):\n        \"\"\"\n        Return a sequence of source table objects which can be used as\n        `keys` for sorting.\n\n        :param int column: Sort column.\n        :param Qt.ItemRole role: Sort item role.\n\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Column) \\\n                and role == TableModel.ValueRole:\n            return self.source.get_column(coldesc.var)\n        else:\n            return numpy.asarray([self.index(i, column).data(role)\n                                  for i in range(self.rowCount())])\n\n    def data(self, index, role,\n             # For optimizing out LOAD_GLOBAL byte code instructions in\n             # the item role tests.\n             _str=str,\n             _Qt_DisplayRole=Qt.DisplayRole,\n             _Qt_EditRole=Qt.EditRole,\n             _Qt_BackgroundRole=Qt.BackgroundRole,\n             _Qt_ForegroundRole=Qt.ForegroundRole,\n             _ValueRole=ValueRole,\n             _ClassValueRole=ClassValueRole,\n             _VariableRole=VariableRole,\n             _DomainRole=DomainRole,\n             _VariableStatsRole=VariableStatsRole,\n             # Some cached local precomputed values.\n             # All of the above roles we respond to\n             _recognizedRoles=frozenset([Qt.DisplayRole,\n                                         Qt.EditRole,\n                                         Qt.BackgroundRole,\n                                         Qt.ForegroundRole,\n                                         ValueRole,\n                                         ClassValueRole,\n                                         VariableRole,\n                                         DomainRole,\n                                         VariableStatsRole])):\n        \"\"\"\n        Reimplemented from `QAbstractItemModel.data`\n        \"\"\"\n        if role not in _recognizedRoles:\n            return None\n\n        row = index.row()\n        if not 0 <= row <= self.__rowCount:\n            return None\n\n        row = self.mapToSourceRows(row)\n        col = 0 if role is _ClassValueRole else index.column()\n\n        try:\n            coldesc = self.columns[col]\n            instance = self._get_source_item(row, coldesc)\n        except IndexError:\n            self.layoutAboutToBeChanged.emit()\n            self.beginRemoveRows(self.parent(), row, max(self.rowCount(), row))\n            self.__rowCount = min(row, self.__rowCount)\n            self.endRemoveRows()\n            self.layoutChanged.emit()\n            return None\n\n        if role == _Qt_DisplayRole:\n            return coldesc.format(instance)\n        elif role in (_Qt_EditRole, _ValueRole) and isinstance(coldesc, TableModel.Column):\n            return Value(coldesc.var, instance)\n        elif role == _Qt_BackgroundRole:\n            return coldesc.background\n        elif role == _Qt_ForegroundRole:\n            # The background is light-ish, force dark text color\n            return coldesc.background and QColor(0, 0, 0, 200)\n        elif role == _ClassValueRole \\\n                and isinstance(coldesc, TableModel.Column) \\\n                and len(self.domain.class_vars) == 1:\n            return Value(coldesc.var, instance)\n        elif role == _VariableRole and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == _DomainRole:\n            return coldesc.role\n        elif role == _VariableStatsRole:\n            return self._stats_for_column(col)\n        else:\n            return None\n\n    def setData(self, index, value, role):\n        row = self.mapFromSourceRows(index.row())\n        if role == Qt.EditRole:\n            try:\n                self.source[row, index.column()] = value\n            except (TypeError, IndexError):\n                return False\n            else:\n                self.dataChanged.emit(index, index)\n                return True\n        else:\n            return False\n\n    def parent(self, index=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.parent`.\"\"\"\n        return QModelIndex()\n\n    def rowCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.rowCount`.\"\"\"\n        return 0 if parent.isValid() else self.__rowCount\n\n    def columnCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.columnCount`.\"\"\"\n        return 0 if parent.isValid() else self.__columnCount\n\n    def headerData(self, section, orientation, role):\n        \"\"\"Reimplemented from `QAbstractTableModel.headerData`.\"\"\"\n        if orientation == Qt.Vertical:\n            if role == Qt.DisplayRole:\n                return int(self.mapToSourceRows(section) + 1)\n            return None\n\n        coldesc = self.columns[section]\n        if role == Qt.DisplayRole:\n            if isinstance(coldesc, TableModel.Basket):\n                return \"{...}\"\n            else:\n                return coldesc.var.name\n        elif role == Qt.ToolTipRole:\n            return self._tooltip(coldesc)\n        elif role == TableModel.VariableRole \\\n                and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == TableModel.VariableStatsRole:\n            return self._stats_for_column(section)\n        elif role == TableModel.DomainRole:\n            return coldesc.role\n        else:\n            return None\n\n    def _tooltip(self, coldesc):\n        \"\"\"\n        Return an header tool tip text for an `column` descriptor.\n        \"\"\"\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        labels = self._labels\n        variable = coldesc.var\n        pairs = [(escape(key), escape(str(variable.attributes[key])))\n                 for key in labels if key in variable.attributes]\n        tip = \"<b>%s</b>\" % escape(variable.name)\n        tip = \"<br/>\".join([tip] + [\"%s = %s\" % pair for pair in pairs])\n        return tip\n\n    def _stats_for_column(self, column):\n        \"\"\"\n        Return BasicStats for `column` index.\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        if self.__stats is None:\n            self.__stats = datacaching.getCached(\n                self.source, basic_stats.DomainBasicStats,\n                (self.source, True)\n            )\n\n        return self.__stats[coldesc.var]",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 775,
                                "end_lineno": 1087,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/utils/itemmodels.py",
                            "type": "class",
                            "name": "TableModel",
                            "content": "class TableModel(AbstractSortTableModel):\n    \"\"\"\n    An adapter for using Orange.data.Table within Qt's Item View Framework.\n\n    :param Orange.data.Table sourcedata: Source data table.\n    :param QObject parent:\n    \"\"\"\n    #: Orange.data.Value for the index.\n    ValueRole = gui.TableValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Value of the row's class.\n    ClassValueRole = gui.TableClassValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Variable of the column.\n    VariableRole = gui.TableVariable  # next(gui.OrangeUserRole)\n    #: Basic statistics of the column\n    VariableStatsRole = next(gui.OrangeUserRole)\n    #: The column's role (position) in the domain.\n    #: One of Attribute, ClassVar or Meta\n    DomainRole = next(gui.OrangeUserRole)\n\n    #: Column domain roles\n    ClassVar, Meta, Attribute = range(3)\n\n    #: Default background color for domain roles\n    ColorForRole = {\n        ClassVar: QColor(160, 160, 160),\n        Meta: QColor(220, 220, 200),\n        Attribute: None,\n    }\n\n    #: Standard column descriptor\n    Column = namedtuple(\n        \"Column\", [\"var\", \"role\", \"background\", \"format\"])\n    #: Basket column descriptor (i.e. sparse X/Y/metas/ compressed into\n    #: a single column).\n    Basket = namedtuple(\n        \"Basket\", [\"vars\", \"role\", \"background\", \"density\", \"format\"])\n\n    # The class uses the same names (X_density etc) as Table\n    # pylint: disable=invalid-name\n    def __init__(self, sourcedata, parent=None):\n        super().__init__(parent)\n        self.source = sourcedata\n        self.domain = domain = sourcedata.domain\n\n        self.X_density = sourcedata.X_density()\n        self.Y_density = sourcedata.Y_density()\n        self.M_density = sourcedata.metas_density()\n\n        brush_for_role = {\n            role: QBrush(c) if c is not None else None\n            for role, c in self.ColorForRole.items()\n        }\n\n        def format_sparse(vars, row):\n            row = row.tocsr()\n            return \", \".join(\"{}={}\".format(vars[i].name, vars[i].str_val(v))\n                             for i, v in zip(row.indices, row.data))\n\n        def format_sparse_bool(vars, row):\n            row = row.tocsr()\n            return \", \".join(vars[i].name for i in row.indices)\n\n        def format_dense(var, val):\n            return var.str_val(val)\n\n        def make_basket_formatter(vars, density):\n            formatter = (format_sparse if density == Storage.SPARSE\n                         else format_sparse_bool)\n            return partial(formatter, vars)\n\n        def make_basket(vars, density, role):\n            return TableModel.Basket(\n                vars, TableModel.Attribute, brush_for_role[role], density,\n                make_basket_formatter(vars, density)\n            )\n\n        def make_column(var, role):\n            return TableModel.Column(\n                var, role, brush_for_role[role],\n                partial(format_dense, var)\n            )\n\n        columns = []\n\n        if self.Y_density != Storage.DENSE and domain.class_vars:\n            coldesc = make_basket(domain.class_vars, self.Y_density,\n                                  TableModel.ClassVar)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.ClassVar)\n                        for var in domain.class_vars]\n\n        if self.M_density != Storage.DENSE and domain.metas:\n            coldesc = make_basket(domain.metas, self.M_density,\n                                  TableModel.Meta)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Meta)\n                        for var in domain.metas]\n\n        if self.X_density != Storage.DENSE and domain.attributes:\n            coldesc = make_basket(domain.attributes, self.X_density,\n                                  TableModel.Attribute)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Attribute)\n                        for var in domain.attributes]\n\n        #: list of all domain variables (class_vars + metas + attrs)\n        self.vars = domain.class_vars + domain.metas + domain.attributes\n        self.columns = columns\n\n        #: A list of all unique attribute labels (in all variables)\n        self._labels = sorted(\n            reduce(operator.ior,\n                   [set(var.attributes) for var in self.vars],\n                   set()))\n\n        # column basic statistics (VariableStatsRole), computed when\n        # first needed.\n        self.__stats = None\n        self.__rowCount = sourcedata.approx_len()\n        self.__columnCount = len(self.columns)\n\n        if self.__rowCount > (2 ** 31 - 1):\n            raise ValueError(\"len(sourcedata) > 2 ** 31 - 1\")\n\n    def _get_source_item(self, row, coldesc):\n        if isinstance(coldesc, self.Basket):\n            # `self.source[row:row + 1]` returns Table\n            # `self.source[row]` returns RowInstance\n            if coldesc.role is self.ClassVar:\n                return self.source[row:row + 1].Y\n            if coldesc.role is self.Meta:\n                return self.source[row:row + 1].metas\n            if coldesc.role is self.Attribute:\n                return self.source[row:row + 1].X\n        return self.source[row, coldesc.var]\n\n    def sortColumnData(self, column):\n        return self._columnSortKeyData(column, TableModel.ValueRole)\n\n    @deprecated('Orange.widgets.utils.itemmodels.TableModel.sortColumnData')\n    def columnSortKeyData(self, column, role):\n        return self._columnSortKeyData(column, role)\n\n    def _columnSortKeyData(self, column, role):\n        \"\"\"\n        Return a sequence of source table objects which can be used as\n        `keys` for sorting.\n\n        :param int column: Sort column.\n        :param Qt.ItemRole role: Sort item role.\n\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Column) \\\n                and role == TableModel.ValueRole:\n            return self.source.get_column(coldesc.var)\n        else:\n            return numpy.asarray([self.index(i, column).data(role)\n                                  for i in range(self.rowCount())])\n\n    def data(self, index, role,\n             # For optimizing out LOAD_GLOBAL byte code instructions in\n             # the item role tests.\n             _str=str,\n             _Qt_DisplayRole=Qt.DisplayRole,\n             _Qt_EditRole=Qt.EditRole,\n             _Qt_BackgroundRole=Qt.BackgroundRole,\n             _Qt_ForegroundRole=Qt.ForegroundRole,\n             _ValueRole=ValueRole,\n             _ClassValueRole=ClassValueRole,\n             _VariableRole=VariableRole,\n             _DomainRole=DomainRole,\n             _VariableStatsRole=VariableStatsRole,\n             # Some cached local precomputed values.\n             # All of the above roles we respond to\n             _recognizedRoles=frozenset([Qt.DisplayRole,\n                                         Qt.EditRole,\n                                         Qt.BackgroundRole,\n                                         Qt.ForegroundRole,\n                                         ValueRole,\n                                         ClassValueRole,\n                                         VariableRole,\n                                         DomainRole,\n                                         VariableStatsRole])):\n        \"\"\"\n        Reimplemented from `QAbstractItemModel.data`\n        \"\"\"\n        if role not in _recognizedRoles:\n            return None\n\n        row = index.row()\n        if not 0 <= row <= self.__rowCount:\n            return None\n\n        row = self.mapToSourceRows(row)\n        col = 0 if role is _ClassValueRole else index.column()\n\n        try:\n            coldesc = self.columns[col]\n            instance = self._get_source_item(row, coldesc)\n        except IndexError:\n            self.layoutAboutToBeChanged.emit()\n            self.beginRemoveRows(self.parent(), row, max(self.rowCount(), row))\n            self.__rowCount = min(row, self.__rowCount)\n            self.endRemoveRows()\n            self.layoutChanged.emit()\n            return None\n\n        if role == _Qt_DisplayRole:\n            return coldesc.format(instance)\n        elif role in (_Qt_EditRole, _ValueRole) and isinstance(coldesc, TableModel.Column):\n            return Value(coldesc.var, instance)\n        elif role == _Qt_BackgroundRole:\n            return coldesc.background\n        elif role == _Qt_ForegroundRole:\n            # The background is light-ish, force dark text color\n            return coldesc.background and QColor(0, 0, 0, 200)\n        elif role == _ClassValueRole \\\n                and isinstance(coldesc, TableModel.Column) \\\n                and len(self.domain.class_vars) == 1:\n            return Value(coldesc.var, instance)\n        elif role == _VariableRole and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == _DomainRole:\n            return coldesc.role\n        elif role == _VariableStatsRole:\n            return self._stats_for_column(col)\n        else:\n            return None\n\n    def setData(self, index, value, role):\n        row = self.mapFromSourceRows(index.row())\n        if role == Qt.EditRole:\n            try:\n                self.source[row, index.column()] = value\n            except (TypeError, IndexError):\n                return False\n            else:\n                self.dataChanged.emit(index, index)\n                return True\n        else:\n            return False\n\n    def parent(self, index=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.parent`.\"\"\"\n        return QModelIndex()\n\n    def rowCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.rowCount`.\"\"\"\n        return 0 if parent.isValid() else self.__rowCount\n\n    def columnCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.columnCount`.\"\"\"\n        return 0 if parent.isValid() else self.__columnCount\n\n    def headerData(self, section, orientation, role):\n        \"\"\"Reimplemented from `QAbstractTableModel.headerData`.\"\"\"\n        if orientation == Qt.Vertical:\n            if role == Qt.DisplayRole:\n                return int(self.mapToSourceRows(section) + 1)\n            return None\n\n        coldesc = self.columns[section]\n        if role == Qt.DisplayRole:\n            if isinstance(coldesc, TableModel.Basket):\n                return \"{...}\"\n            else:\n                return coldesc.var.name\n        elif role == Qt.ToolTipRole:\n            return self._tooltip(coldesc)\n        elif role == TableModel.VariableRole \\\n                and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == TableModel.VariableStatsRole:\n            return self._stats_for_column(section)\n        elif role == TableModel.DomainRole:\n            return coldesc.role\n        else:\n            return None\n\n    def _tooltip(self, coldesc):\n        \"\"\"\n        Return an header tool tip text for an `column` descriptor.\n        \"\"\"\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        labels = self._labels\n        variable = coldesc.var\n        pairs = [(escape(key), escape(str(variable.attributes[key])))\n                 for key in labels if key in variable.attributes]\n        tip = \"<b>%s</b>\" % escape(variable.name)\n        tip = \"<br/>\".join([tip] + [\"%s = %s\" % pair for pair in pairs])\n        return tip\n\n    def _stats_for_column(self, column):\n        \"\"\"\n        Return BasicStats for `column` index.\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        if self.__stats is None:\n            self.__stats = datacaching.getCached(\n                self.source, basic_stats.DomainBasicStats,\n                (self.source, True)\n            )\n\n        return self.__stats[coldesc.var]",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 775,
                            "end_lineno": 1087,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 903,
                            "length": 8
                        },
                        "new_range": {
                            "start": 903,
                            "length": 7
                        },
                        "section": "class TableModel(AbstractSortTableModel):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        if isinstance(coldesc, self.Basket):",
                                "type": "context"
                            },
                            {
                                "content": "            # `self.source[row:row + 1]` returns Table",
                                "type": "context"
                            },
                            {
                                "content": "            # `self.source[row]` returns RowInstance",
                                "type": "context"
                            },
                            {
                                "content": "            if coldesc.role is self.ClassVar:",
                                "type": "deleted"
                            },
                            {
                                "content": "                return self.source[row:row + 1].Y",
                                "type": "deleted"
                            },
                            {
                                "content": "            # We only worry about X and metas, as Y cannot be sparse",
                                "type": "added"
                            },
                            {
                                "content": "            if coldesc.role is self.Meta:",
                                "type": "context"
                            },
                            {
                                "content": "                return self.source[row:row + 1].metas",
                                "type": "context"
                            },
                            {
                                "content": "            if coldesc.role is self.Attribute:",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/utils/itemmodels.py",
                            "type": "class",
                            "name": "TableModel",
                            "content": "class TableModel(AbstractSortTableModel):\n    \"\"\"\n    An adapter for using Orange.data.Table within Qt's Item View Framework.\n\n    :param Orange.data.Table sourcedata: Source data table.\n    :param QObject parent:\n    \"\"\"\n    #: Orange.data.Value for the index.\n    ValueRole = gui.TableValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Value of the row's class.\n    ClassValueRole = gui.TableClassValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Variable of the column.\n    VariableRole = gui.TableVariable  # next(gui.OrangeUserRole)\n    #: Basic statistics of the column\n    VariableStatsRole = next(gui.OrangeUserRole)\n    #: The column's role (position) in the domain.\n    #: One of Attribute, ClassVar or Meta\n    DomainRole = next(gui.OrangeUserRole)\n\n    #: Column domain roles\n    ClassVar, Meta, Attribute = range(3)\n\n    #: Default background color for domain roles\n    ColorForRole = {\n        ClassVar: QColor(160, 160, 160),\n        Meta: QColor(220, 220, 200),\n        Attribute: None,\n    }\n\n    #: Standard column descriptor\n    Column = namedtuple(\n        \"Column\", [\"var\", \"role\", \"background\", \"format\"])\n    #: Basket column descriptor (i.e. sparse X/Y/metas/ compressed into\n    #: a single column).\n    Basket = namedtuple(\n        \"Basket\", [\"vars\", \"role\", \"background\", \"density\", \"format\"])\n\n    # The class uses the same names (X_density etc) as Table\n    # pylint: disable=invalid-name\n    def __init__(self, sourcedata, parent=None):\n        super().__init__(parent)\n        self.source = sourcedata\n        self.domain = domain = sourcedata.domain\n\n        self.X_density = sourcedata.X_density()\n        self.Y_density = sourcedata.Y_density()\n        self.M_density = sourcedata.metas_density()\n\n        brush_for_role = {\n            role: QBrush(c) if c is not None else None\n            for role, c in self.ColorForRole.items()\n        }\n\n        def format_sparse(vars, row):\n            row = row.tocsr()\n            return \", \".join(\"{}={}\".format(vars[i].name, vars[i].str_val(v))\n                             for i, v in zip(row.indices, row.data))\n\n        def format_sparse_bool(vars, row):\n            row = row.tocsr()\n            return \", \".join(vars[i].name for i in row.indices)\n\n        def format_dense(var, val):\n            return var.str_val(val)\n\n        def make_basket_formatter(vars, density):\n            formatter = (format_sparse if density == Storage.SPARSE\n                         else format_sparse_bool)\n            return partial(formatter, vars)\n\n        def make_basket(vars, density, role):\n            return TableModel.Basket(\n                vars, TableModel.Attribute, brush_for_role[role], density,\n                make_basket_formatter(vars, density)\n            )\n\n        def make_column(var, role):\n            return TableModel.Column(\n                var, role, brush_for_role[role],\n                partial(format_dense, var)\n            )\n\n        columns = []\n\n        if self.Y_density != Storage.DENSE and domain.class_vars:\n            coldesc = make_basket(domain.class_vars, self.Y_density,\n                                  TableModel.ClassVar)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.ClassVar)\n                        for var in domain.class_vars]\n\n        if self.M_density != Storage.DENSE and domain.metas:\n            coldesc = make_basket(domain.metas, self.M_density,\n                                  TableModel.Meta)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Meta)\n                        for var in domain.metas]\n\n        if self.X_density != Storage.DENSE and domain.attributes:\n            coldesc = make_basket(domain.attributes, self.X_density,\n                                  TableModel.Attribute)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Attribute)\n                        for var in domain.attributes]\n\n        #: list of all domain variables (class_vars + metas + attrs)\n        self.vars = domain.class_vars + domain.metas + domain.attributes\n        self.columns = columns\n\n        #: A list of all unique attribute labels (in all variables)\n        self._labels = sorted(\n            reduce(operator.ior,\n                   [set(var.attributes) for var in self.vars],\n                   set()))\n\n        # column basic statistics (VariableStatsRole), computed when\n        # first needed.\n        self.__stats = None\n        self.__rowCount = sourcedata.approx_len()\n        self.__columnCount = len(self.columns)\n\n        if self.__rowCount > (2 ** 31 - 1):\n            raise ValueError(\"len(sourcedata) > 2 ** 31 - 1\")\n\n    def _get_source_item(self, row, coldesc):\n        if isinstance(coldesc, self.Basket):\n            # `self.source[row:row + 1]` returns Table\n            # `self.source[row]` returns RowInstance\n            if coldesc.role is self.ClassVar:\n                return self.source[row:row + 1].Y\n            if coldesc.role is self.Meta:\n                return self.source[row:row + 1].metas\n            if coldesc.role is self.Attribute:\n                return self.source[row:row + 1].X\n        return self.source[row, coldesc.var]\n\n    def sortColumnData(self, column):\n        return self._columnSortKeyData(column, TableModel.ValueRole)\n\n    @deprecated('Orange.widgets.utils.itemmodels.TableModel.sortColumnData')\n    def columnSortKeyData(self, column, role):\n        return self._columnSortKeyData(column, role)\n\n    def _columnSortKeyData(self, column, role):\n        \"\"\"\n        Return a sequence of source table objects which can be used as\n        `keys` for sorting.\n\n        :param int column: Sort column.\n        :param Qt.ItemRole role: Sort item role.\n\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Column) \\\n                and role == TableModel.ValueRole:\n            return self.source.get_column(coldesc.var)\n        else:\n            return numpy.asarray([self.index(i, column).data(role)\n                                  for i in range(self.rowCount())])\n\n    def data(self, index, role,\n             # For optimizing out LOAD_GLOBAL byte code instructions in\n             # the item role tests.\n             _str=str,\n             _Qt_DisplayRole=Qt.DisplayRole,\n             _Qt_EditRole=Qt.EditRole,\n             _Qt_BackgroundRole=Qt.BackgroundRole,\n             _Qt_ForegroundRole=Qt.ForegroundRole,\n             _ValueRole=ValueRole,\n             _ClassValueRole=ClassValueRole,\n             _VariableRole=VariableRole,\n             _DomainRole=DomainRole,\n             _VariableStatsRole=VariableStatsRole,\n             # Some cached local precomputed values.\n             # All of the above roles we respond to\n             _recognizedRoles=frozenset([Qt.DisplayRole,\n                                         Qt.EditRole,\n                                         Qt.BackgroundRole,\n                                         Qt.ForegroundRole,\n                                         ValueRole,\n                                         ClassValueRole,\n                                         VariableRole,\n                                         DomainRole,\n                                         VariableStatsRole])):\n        \"\"\"\n        Reimplemented from `QAbstractItemModel.data`\n        \"\"\"\n        if role not in _recognizedRoles:\n            return None\n\n        row = index.row()\n        if not 0 <= row <= self.__rowCount:\n            return None\n\n        row = self.mapToSourceRows(row)\n        col = 0 if role is _ClassValueRole else index.column()\n\n        try:\n            coldesc = self.columns[col]\n            instance = self._get_source_item(row, coldesc)\n        except IndexError:\n            self.layoutAboutToBeChanged.emit()\n            self.beginRemoveRows(self.parent(), row, max(self.rowCount(), row))\n            self.__rowCount = min(row, self.__rowCount)\n            self.endRemoveRows()\n            self.layoutChanged.emit()\n            return None\n\n        if role == _Qt_DisplayRole:\n            return coldesc.format(instance)\n        elif role in (_Qt_EditRole, _ValueRole) and isinstance(coldesc, TableModel.Column):\n            return Value(coldesc.var, instance)\n        elif role == _Qt_BackgroundRole:\n            return coldesc.background\n        elif role == _Qt_ForegroundRole:\n            # The background is light-ish, force dark text color\n            return coldesc.background and QColor(0, 0, 0, 200)\n        elif role == _ClassValueRole \\\n                and isinstance(coldesc, TableModel.Column) \\\n                and len(self.domain.class_vars) == 1:\n            return Value(coldesc.var, instance)\n        elif role == _VariableRole and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == _DomainRole:\n            return coldesc.role\n        elif role == _VariableStatsRole:\n            return self._stats_for_column(col)\n        else:\n            return None\n\n    def setData(self, index, value, role):\n        row = self.mapFromSourceRows(index.row())\n        if role == Qt.EditRole:\n            try:\n                self.source[row, index.column()] = value\n            except (TypeError, IndexError):\n                return False\n            else:\n                self.dataChanged.emit(index, index)\n                return True\n        else:\n            return False\n\n    def parent(self, index=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.parent`.\"\"\"\n        return QModelIndex()\n\n    def rowCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.rowCount`.\"\"\"\n        return 0 if parent.isValid() else self.__rowCount\n\n    def columnCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.columnCount`.\"\"\"\n        return 0 if parent.isValid() else self.__columnCount\n\n    def headerData(self, section, orientation, role):\n        \"\"\"Reimplemented from `QAbstractTableModel.headerData`.\"\"\"\n        if orientation == Qt.Vertical:\n            if role == Qt.DisplayRole:\n                return int(self.mapToSourceRows(section) + 1)\n            return None\n\n        coldesc = self.columns[section]\n        if role == Qt.DisplayRole:\n            if isinstance(coldesc, TableModel.Basket):\n                return \"{...}\"\n            else:\n                return coldesc.var.name\n        elif role == Qt.ToolTipRole:\n            return self._tooltip(coldesc)\n        elif role == TableModel.VariableRole \\\n                and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == TableModel.VariableStatsRole:\n            return self._stats_for_column(section)\n        elif role == TableModel.DomainRole:\n            return coldesc.role\n        else:\n            return None\n\n    def _tooltip(self, coldesc):\n        \"\"\"\n        Return an header tool tip text for an `column` descriptor.\n        \"\"\"\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        labels = self._labels\n        variable = coldesc.var\n        pairs = [(escape(key), escape(str(variable.attributes[key])))\n                 for key in labels if key in variable.attributes]\n        tip = \"<b>%s</b>\" % escape(variable.name)\n        tip = \"<br/>\".join([tip] + [\"%s = %s\" % pair for pair in pairs])\n        return tip\n\n    def _stats_for_column(self, column):\n        \"\"\"\n        Return BasicStats for `column` index.\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        if self.__stats is None:\n            self.__stats = datacaching.getCached(\n                self.source, basic_stats.DomainBasicStats,\n                (self.source, True)\n            )\n\n        return self.__stats[coldesc.var]",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 775,
                            "end_lineno": 1087,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/widgets/utils/itemmodels.py",
                            "type": "method",
                            "name": "TableModel._get_source_item",
                            "content": "class TableModel(AbstractSortTableModel):\n    \"\"\"\n    An adapter for using Orange.data.Table within Qt's Item View Framework.\n\n    :param Orange.data.Table sourcedata: Source data table.\n    :param QObject parent:\n    \"\"\"\n    #: Orange.data.Value for the index.\n    ValueRole = gui.TableValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Value of the row's class.\n    ClassValueRole = gui.TableClassValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Variable of the column.\n    VariableRole = gui.TableVariable  # next(gui.OrangeUserRole)\n    #: Basic statistics of the column\n    VariableStatsRole = next(gui.OrangeUserRole)\n    #: The column's role (position) in the domain.\n    #: One of Attribute, ClassVar or Meta\n    DomainRole = next(gui.OrangeUserRole)\n\n    #: Column domain roles\n    ClassVar, Meta, Attribute = range(3)\n\n    #: Default background color for domain roles\n    ColorForRole = {\n        ClassVar: QColor(160, 160, 160),\n        Meta: QColor(220, 220, 200),\n        Attribute: None,\n    }\n\n    #: Standard column descriptor\n    Column = namedtuple(\n        \"Column\", [\"var\", \"role\", \"background\", \"format\"])\n    #: Basket column descriptor (i.e. sparse X/Y/metas/ compressed into\n    #: a single column).\n    Basket = namedtuple(\n        \"Basket\", [\"vars\", \"role\", \"background\", \"density\", \"format\"])\n\n    # The class uses the same names (X_density etc) as Table\n    # pylint: disable=invalid-name\n    def __init__(self, sourcedata, parent=None):\n        super().__init__(parent)\n        self.source = sourcedata\n        self.domain = domain = sourcedata.domain\n\n        self.X_density = sourcedata.X_density()\n        self.Y_density = sourcedata.Y_density()\n        self.M_density = sourcedata.metas_density()\n\n        brush_for_role = {\n            role: QBrush(c) if c is not None else None\n            for role, c in self.ColorForRole.items()\n        }\n\n        def format_sparse(vars, row):\n            row = row.tocsr()\n            return \", \".join(\"{}={}\".format(vars[i].name, vars[i].str_val(v))\n                             for i, v in zip(row.indices, row.data))\n\n        def format_sparse_bool(vars, row):\n            row = row.tocsr()\n            return \", \".join(vars[i].name for i in row.indices)\n\n        def format_dense(var, val):\n            return var.str_val(val)\n\n        def make_basket_formatter(vars, density):\n            formatter = (format_sparse if density == Storage.SPARSE\n                         else format_sparse_bool)\n            return partial(formatter, vars)\n\n        def make_basket(vars, density, role):\n            return TableModel.Basket(\n                vars, TableModel.Attribute, brush_for_role[role], density,\n                make_basket_formatter(vars, density)\n            )\n\n        def make_column(var, role):\n            return TableModel.Column(\n                var, role, brush_for_role[role],\n                partial(format_dense, var)\n            )\n\n        columns = []\n\n        if self.Y_density != Storage.DENSE and domain.class_vars:\n            coldesc = make_basket(domain.class_vars, self.Y_density,\n                                  TableModel.ClassVar)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.ClassVar)\n                        for var in domain.class_vars]\n\n        if self.M_density != Storage.DENSE and domain.metas:\n            coldesc = make_basket(domain.metas, self.M_density,\n                                  TableModel.Meta)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Meta)\n                        for var in domain.metas]\n\n        if self.X_density != Storage.DENSE and domain.attributes:\n            coldesc = make_basket(domain.attributes, self.X_density,\n                                  TableModel.Attribute)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Attribute)\n                        for var in domain.attributes]\n\n        #: list of all domain variables (class_vars + metas + attrs)\n        self.vars = domain.class_vars + domain.metas + domain.attributes\n        self.columns = columns\n\n        #: A list of all unique attribute labels (in all variables)\n        self._labels = sorted(\n            reduce(operator.ior,\n                   [set(var.attributes) for var in self.vars],\n                   set()))\n\n        # column basic statistics (VariableStatsRole), computed when\n        # first needed.\n        self.__stats = None\n        self.__rowCount = sourcedata.approx_len()\n        self.__columnCount = len(self.columns)\n\n        if self.__rowCount > (2 ** 31 - 1):\n            raise ValueError(\"len(sourcedata) > 2 ** 31 - 1\")\n\n    def _get_source_item(self, row, coldesc):\n        if isinstance(coldesc, self.Basket):\n            # `self.source[row:row + 1]` returns Table\n            # `self.source[row]` returns RowInstance\n            if coldesc.role is self.ClassVar:\n                return self.source[row:row + 1].Y\n            if coldesc.role is self.Meta:\n                return self.source[row:row + 1].metas\n            if coldesc.role is self.Attribute:\n                return self.source[row:row + 1].X\n        return self.source[row, coldesc.var]\n\n    def sortColumnData(self, column):\n        return self._columnSortKeyData(column, TableModel.ValueRole)\n\n    @deprecated('Orange.widgets.utils.itemmodels.TableModel.sortColumnData')\n    def columnSortKeyData(self, column, role):\n        return self._columnSortKeyData(column, role)\n\n    def _columnSortKeyData(self, column, role):\n        \"\"\"\n        Return a sequence of source table objects which can be used as\n        `keys` for sorting.\n\n        :param int column: Sort column.\n        :param Qt.ItemRole role: Sort item role.\n\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Column) \\\n                and role == TableModel.ValueRole:\n            return self.source.get_column(coldesc.var)\n        else:\n            return numpy.asarray([self.index(i, column).data(role)\n                                  for i in range(self.rowCount())])\n\n    def data(self, index, role,\n             # For optimizing out LOAD_GLOBAL byte code instructions in\n             # the item role tests.\n             _str=str,\n             _Qt_DisplayRole=Qt.DisplayRole,\n             _Qt_EditRole=Qt.EditRole,\n             _Qt_BackgroundRole=Qt.BackgroundRole,\n             _Qt_ForegroundRole=Qt.ForegroundRole,\n             _ValueRole=ValueRole,\n             _ClassValueRole=ClassValueRole,\n             _VariableRole=VariableRole,\n             _DomainRole=DomainRole,\n             _VariableStatsRole=VariableStatsRole,\n             # Some cached local precomputed values.\n             # All of the above roles we respond to\n             _recognizedRoles=frozenset([Qt.DisplayRole,\n                                         Qt.EditRole,\n                                         Qt.BackgroundRole,\n                                         Qt.ForegroundRole,\n                                         ValueRole,\n                                         ClassValueRole,\n                                         VariableRole,\n                                         DomainRole,\n                                         VariableStatsRole])):\n        \"\"\"\n        Reimplemented from `QAbstractItemModel.data`\n        \"\"\"\n        if role not in _recognizedRoles:\n            return None\n\n        row = index.row()\n        if not 0 <= row <= self.__rowCount:\n            return None\n\n        row = self.mapToSourceRows(row)\n        col = 0 if role is _ClassValueRole else index.column()\n\n        try:\n            coldesc = self.columns[col]\n            instance = self._get_source_item(row, coldesc)\n        except IndexError:\n            self.layoutAboutToBeChanged.emit()\n            self.beginRemoveRows(self.parent(), row, max(self.rowCount(), row))\n            self.__rowCount = min(row, self.__rowCount)\n            self.endRemoveRows()\n            self.layoutChanged.emit()\n            return None\n\n        if role == _Qt_DisplayRole:\n            return coldesc.format(instance)\n        elif role in (_Qt_EditRole, _ValueRole) and isinstance(coldesc, TableModel.Column):\n            return Value(coldesc.var, instance)\n        elif role == _Qt_BackgroundRole:\n            return coldesc.background\n        elif role == _Qt_ForegroundRole:\n            # The background is light-ish, force dark text color\n            return coldesc.background and QColor(0, 0, 0, 200)\n        elif role == _ClassValueRole \\\n                and isinstance(coldesc, TableModel.Column) \\\n                and len(self.domain.class_vars) == 1:\n            return Value(coldesc.var, instance)\n        elif role == _VariableRole and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == _DomainRole:\n            return coldesc.role\n        elif role == _VariableStatsRole:\n            return self._stats_for_column(col)\n        else:\n            return None\n\n    def setData(self, index, value, role):\n        row = self.mapFromSourceRows(index.row())\n        if role == Qt.EditRole:\n            try:\n                self.source[row, index.column()] = value\n            except (TypeError, IndexError):\n                return False\n            else:\n                self.dataChanged.emit(index, index)\n                return True\n        else:\n            return False\n\n    def parent(self, index=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.parent`.\"\"\"\n        return QModelIndex()\n\n    def rowCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.rowCount`.\"\"\"\n        return 0 if parent.isValid() else self.__rowCount\n\n    def columnCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.columnCount`.\"\"\"\n        return 0 if parent.isValid() else self.__columnCount\n\n    def headerData(self, section, orientation, role):\n        \"\"\"Reimplemented from `QAbstractTableModel.headerData`.\"\"\"\n        if orientation == Qt.Vertical:\n            if role == Qt.DisplayRole:\n                return int(self.mapToSourceRows(section) + 1)\n            return None\n\n        coldesc = self.columns[section]\n        if role == Qt.DisplayRole:\n            if isinstance(coldesc, TableModel.Basket):\n                return \"{...}\"\n            else:\n                return coldesc.var.name\n        elif role == Qt.ToolTipRole:\n            return self._tooltip(coldesc)\n        elif role == TableModel.VariableRole \\\n                and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == TableModel.VariableStatsRole:\n            return self._stats_for_column(section)\n        elif role == TableModel.DomainRole:\n            return coldesc.role\n        else:\n            return None\n\n    def _tooltip(self, coldesc):\n        \"\"\"\n        Return an header tool tip text for an `column` descriptor.\n        \"\"\"\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        labels = self._labels\n        variable = coldesc.var\n        pairs = [(escape(key), escape(str(variable.attributes[key])))\n                 for key in labels if key in variable.attributes]\n        tip = \"<b>%s</b>\" % escape(variable.name)\n        tip = \"<br/>\".join([tip] + [\"%s = %s\" % pair for pair in pairs])\n        return tip\n\n    def _stats_for_column(self, column):\n        \"\"\"\n        Return BasicStats for `column` index.\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        if self.__stats is None:\n            self.__stats = datacaching.getCached(\n                self.source, basic_stats.DomainBasicStats,\n                (self.source, True)\n            )\n\n        return self.__stats[coldesc.var]",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 902,
                            "end_lineno": 912,
                            "parent": {
                                "file_name": "Orange/widgets/utils/itemmodels.py",
                                "type": "class",
                                "name": "TableModel",
                                "content": "class TableModel(AbstractSortTableModel):\n    \"\"\"\n    An adapter for using Orange.data.Table within Qt's Item View Framework.\n\n    :param Orange.data.Table sourcedata: Source data table.\n    :param QObject parent:\n    \"\"\"\n    #: Orange.data.Value for the index.\n    ValueRole = gui.TableValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Value of the row's class.\n    ClassValueRole = gui.TableClassValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Variable of the column.\n    VariableRole = gui.TableVariable  # next(gui.OrangeUserRole)\n    #: Basic statistics of the column\n    VariableStatsRole = next(gui.OrangeUserRole)\n    #: The column's role (position) in the domain.\n    #: One of Attribute, ClassVar or Meta\n    DomainRole = next(gui.OrangeUserRole)\n\n    #: Column domain roles\n    ClassVar, Meta, Attribute = range(3)\n\n    #: Default background color for domain roles\n    ColorForRole = {\n        ClassVar: QColor(160, 160, 160),\n        Meta: QColor(220, 220, 200),\n        Attribute: None,\n    }\n\n    #: Standard column descriptor\n    Column = namedtuple(\n        \"Column\", [\"var\", \"role\", \"background\", \"format\"])\n    #: Basket column descriptor (i.e. sparse X/Y/metas/ compressed into\n    #: a single column).\n    Basket = namedtuple(\n        \"Basket\", [\"vars\", \"role\", \"background\", \"density\", \"format\"])\n\n    # The class uses the same names (X_density etc) as Table\n    # pylint: disable=invalid-name\n    def __init__(self, sourcedata, parent=None):\n        super().__init__(parent)\n        self.source = sourcedata\n        self.domain = domain = sourcedata.domain\n\n        self.X_density = sourcedata.X_density()\n        self.Y_density = sourcedata.Y_density()\n        self.M_density = sourcedata.metas_density()\n\n        brush_for_role = {\n            role: QBrush(c) if c is not None else None\n            for role, c in self.ColorForRole.items()\n        }\n\n        def format_sparse(vars, row):\n            row = row.tocsr()\n            return \", \".join(\"{}={}\".format(vars[i].name, vars[i].str_val(v))\n                             for i, v in zip(row.indices, row.data))\n\n        def format_sparse_bool(vars, row):\n            row = row.tocsr()\n            return \", \".join(vars[i].name for i in row.indices)\n\n        def format_dense(var, val):\n            return var.str_val(val)\n\n        def make_basket_formatter(vars, density):\n            formatter = (format_sparse if density == Storage.SPARSE\n                         else format_sparse_bool)\n            return partial(formatter, vars)\n\n        def make_basket(vars, density, role):\n            return TableModel.Basket(\n                vars, TableModel.Attribute, brush_for_role[role], density,\n                make_basket_formatter(vars, density)\n            )\n\n        def make_column(var, role):\n            return TableModel.Column(\n                var, role, brush_for_role[role],\n                partial(format_dense, var)\n            )\n\n        columns = []\n\n        if self.Y_density != Storage.DENSE and domain.class_vars:\n            coldesc = make_basket(domain.class_vars, self.Y_density,\n                                  TableModel.ClassVar)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.ClassVar)\n                        for var in domain.class_vars]\n\n        if self.M_density != Storage.DENSE and domain.metas:\n            coldesc = make_basket(domain.metas, self.M_density,\n                                  TableModel.Meta)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Meta)\n                        for var in domain.metas]\n\n        if self.X_density != Storage.DENSE and domain.attributes:\n            coldesc = make_basket(domain.attributes, self.X_density,\n                                  TableModel.Attribute)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Attribute)\n                        for var in domain.attributes]\n\n        #: list of all domain variables (class_vars + metas + attrs)\n        self.vars = domain.class_vars + domain.metas + domain.attributes\n        self.columns = columns\n\n        #: A list of all unique attribute labels (in all variables)\n        self._labels = sorted(\n            reduce(operator.ior,\n                   [set(var.attributes) for var in self.vars],\n                   set()))\n\n        # column basic statistics (VariableStatsRole), computed when\n        # first needed.\n        self.__stats = None\n        self.__rowCount = sourcedata.approx_len()\n        self.__columnCount = len(self.columns)\n\n        if self.__rowCount > (2 ** 31 - 1):\n            raise ValueError(\"len(sourcedata) > 2 ** 31 - 1\")\n\n    def _get_source_item(self, row, coldesc):\n        if isinstance(coldesc, self.Basket):\n            # `self.source[row:row + 1]` returns Table\n            # `self.source[row]` returns RowInstance\n            if coldesc.role is self.ClassVar:\n                return self.source[row:row + 1].Y\n            if coldesc.role is self.Meta:\n                return self.source[row:row + 1].metas\n            if coldesc.role is self.Attribute:\n                return self.source[row:row + 1].X\n        return self.source[row, coldesc.var]\n\n    def sortColumnData(self, column):\n        return self._columnSortKeyData(column, TableModel.ValueRole)\n\n    @deprecated('Orange.widgets.utils.itemmodels.TableModel.sortColumnData')\n    def columnSortKeyData(self, column, role):\n        return self._columnSortKeyData(column, role)\n\n    def _columnSortKeyData(self, column, role):\n        \"\"\"\n        Return a sequence of source table objects which can be used as\n        `keys` for sorting.\n\n        :param int column: Sort column.\n        :param Qt.ItemRole role: Sort item role.\n\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Column) \\\n                and role == TableModel.ValueRole:\n            return self.source.get_column(coldesc.var)\n        else:\n            return numpy.asarray([self.index(i, column).data(role)\n                                  for i in range(self.rowCount())])\n\n    def data(self, index, role,\n             # For optimizing out LOAD_GLOBAL byte code instructions in\n             # the item role tests.\n             _str=str,\n             _Qt_DisplayRole=Qt.DisplayRole,\n             _Qt_EditRole=Qt.EditRole,\n             _Qt_BackgroundRole=Qt.BackgroundRole,\n             _Qt_ForegroundRole=Qt.ForegroundRole,\n             _ValueRole=ValueRole,\n             _ClassValueRole=ClassValueRole,\n             _VariableRole=VariableRole,\n             _DomainRole=DomainRole,\n             _VariableStatsRole=VariableStatsRole,\n             # Some cached local precomputed values.\n             # All of the above roles we respond to\n             _recognizedRoles=frozenset([Qt.DisplayRole,\n                                         Qt.EditRole,\n                                         Qt.BackgroundRole,\n                                         Qt.ForegroundRole,\n                                         ValueRole,\n                                         ClassValueRole,\n                                         VariableRole,\n                                         DomainRole,\n                                         VariableStatsRole])):\n        \"\"\"\n        Reimplemented from `QAbstractItemModel.data`\n        \"\"\"\n        if role not in _recognizedRoles:\n            return None\n\n        row = index.row()\n        if not 0 <= row <= self.__rowCount:\n            return None\n\n        row = self.mapToSourceRows(row)\n        col = 0 if role is _ClassValueRole else index.column()\n\n        try:\n            coldesc = self.columns[col]\n            instance = self._get_source_item(row, coldesc)\n        except IndexError:\n            self.layoutAboutToBeChanged.emit()\n            self.beginRemoveRows(self.parent(), row, max(self.rowCount(), row))\n            self.__rowCount = min(row, self.__rowCount)\n            self.endRemoveRows()\n            self.layoutChanged.emit()\n            return None\n\n        if role == _Qt_DisplayRole:\n            return coldesc.format(instance)\n        elif role in (_Qt_EditRole, _ValueRole) and isinstance(coldesc, TableModel.Column):\n            return Value(coldesc.var, instance)\n        elif role == _Qt_BackgroundRole:\n            return coldesc.background\n        elif role == _Qt_ForegroundRole:\n            # The background is light-ish, force dark text color\n            return coldesc.background and QColor(0, 0, 0, 200)\n        elif role == _ClassValueRole \\\n                and isinstance(coldesc, TableModel.Column) \\\n                and len(self.domain.class_vars) == 1:\n            return Value(coldesc.var, instance)\n        elif role == _VariableRole and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == _DomainRole:\n            return coldesc.role\n        elif role == _VariableStatsRole:\n            return self._stats_for_column(col)\n        else:\n            return None\n\n    def setData(self, index, value, role):\n        row = self.mapFromSourceRows(index.row())\n        if role == Qt.EditRole:\n            try:\n                self.source[row, index.column()] = value\n            except (TypeError, IndexError):\n                return False\n            else:\n                self.dataChanged.emit(index, index)\n                return True\n        else:\n            return False\n\n    def parent(self, index=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.parent`.\"\"\"\n        return QModelIndex()\n\n    def rowCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.rowCount`.\"\"\"\n        return 0 if parent.isValid() else self.__rowCount\n\n    def columnCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.columnCount`.\"\"\"\n        return 0 if parent.isValid() else self.__columnCount\n\n    def headerData(self, section, orientation, role):\n        \"\"\"Reimplemented from `QAbstractTableModel.headerData`.\"\"\"\n        if orientation == Qt.Vertical:\n            if role == Qt.DisplayRole:\n                return int(self.mapToSourceRows(section) + 1)\n            return None\n\n        coldesc = self.columns[section]\n        if role == Qt.DisplayRole:\n            if isinstance(coldesc, TableModel.Basket):\n                return \"{...}\"\n            else:\n                return coldesc.var.name\n        elif role == Qt.ToolTipRole:\n            return self._tooltip(coldesc)\n        elif role == TableModel.VariableRole \\\n                and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == TableModel.VariableStatsRole:\n            return self._stats_for_column(section)\n        elif role == TableModel.DomainRole:\n            return coldesc.role\n        else:\n            return None\n\n    def _tooltip(self, coldesc):\n        \"\"\"\n        Return an header tool tip text for an `column` descriptor.\n        \"\"\"\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        labels = self._labels\n        variable = coldesc.var\n        pairs = [(escape(key), escape(str(variable.attributes[key])))\n                 for key in labels if key in variable.attributes]\n        tip = \"<b>%s</b>\" % escape(variable.name)\n        tip = \"<br/>\".join([tip] + [\"%s = %s\" % pair for pair in pairs])\n        return tip\n\n    def _stats_for_column(self, column):\n        \"\"\"\n        Return BasicStats for `column` index.\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        if self.__stats is None:\n            self.__stats = datacaching.getCached(\n                self.source, basic_stats.DomainBasicStats,\n                (self.source, True)\n            )\n\n        return self.__stats[coldesc.var]",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 775,
                                "end_lineno": 1087,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\nimport unittest\nfrom unittest.mock import patch\n\nfrom AnyQt.QtCore import Qt, QModelIndex\nfrom AnyQt.QtTest import QSignalSpy\nfrom AnyQt.QtGui import QBrush, QColor\n\nfrom orangewidget.tests.base import GuiTest\n\nfrom Orange.data import \\\n    Domain, Table, Value, \\\n    ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable\nfrom Orange.statistics.basic_stats import BasicStats\nfrom Orange.widgets.utils import colorpalettes\nfrom Orange.widgets.utils.itemmodels import \\\n    PyTableModel, PyListModel, PyListModelTooltip,\\\n    VariableListModel, DomainModel, ContinuousPalettesModel, \\\n    TableModel, _as_contiguous_range\nfrom Orange.widgets.gui import TableVariable\nfrom Orange.tests import test_filename\nfrom Orange.tests.sql.base import DataBaseTest as dbt\nfrom Orange.data.sql.table import SqlTable\n\n\nclass TestUtils(unittest.TestCase):\n    def test_as_contiguous_range(self):\n        self.assertEqual(_as_contiguous_range(slice(1, 8), 20), (1, 8, 1))\n        self.assertEqual(_as_contiguous_range(slice(1, 8), 6), (1, 6, 1))\n        self.assertEqual(_as_contiguous_range(slice(8, 1, -1), 6), (2, 6, 1))\n        self.assertEqual(_as_contiguous_range(slice(8), 6), (0, 6, 1))\n        self.assertEqual(_as_contiguous_range(slice(8, None, -1), 6), (0, 6, 1))\n        self.assertEqual(_as_contiguous_range(slice(7, None, -1), 9), (0, 8, 1))\n        self.assertEqual(_as_contiguous_range(slice(None, None, -1), 9),\n                         (0, 9, 1))\n\n\nclass TestPyTableModel(unittest.TestCase):\n    def setUp(self):\n        self.model = PyTableModel([[1, 4],\n                                   [2, 3]])\n\n    def test_init(self):\n        self.model = PyTableModel()\n        self.assertEqual(self.model.rowCount(), 0)\n\n    def test_init_wrap_empty(self):\n        # pylint: disable=protected-access\n        t = []\n        model = PyTableModel(t)\n        self.assertIs(model._table, t)\n        t.append([1, 2, 3])\n        self.assertEqual(list(model), [[1, 2, 3]])\n\n    def test_rowCount(self):\n        self.assertEqual(self.model.rowCount(), 2)\n        self.assertEqual(len(self.model), 2)\n\n    def test_columnCount(self):\n        self.assertEqual(self.model.columnCount(), 2)\n\n    def test_data(self):\n        mi = self.model.index(0, 0)\n        self.assertEqual(self.model.data(mi), '1')\n        self.assertEqual(self.model.data(mi, Qt.EditRole), 1)\n\n    def test_editable(self):\n        editable_model = PyTableModel([[0]], editable=True)\n        self.assertFalse(bool(self.model.flags(self.model.index(0, 0)) & Qt.ItemIsEditable))\n        self.assertTrue(bool(editable_model.flags(editable_model.index(0, 0)) & Qt.ItemIsEditable))\n\n    def test_sort(self):\n        self.model.sort(1)\n        self.assertEqual(self.model.index(0, 0).data(Qt.EditRole), 2)\n\n    def test_setHeaderLabels(self):\n        self.model.setHorizontalHeaderLabels(['Col 1', 'Col 2'])\n        self.assertEqual(self.model.headerData(1, Qt.Horizontal), 'Col 2')\n        self.assertEqual(self.model.headerData(1, Qt.Vertical), 2)\n\n    def test_removeRows(self):\n        self.model.removeRows(0, 1)\n        self.assertEqual(len(self.model), 1)\n        self.assertEqual(self.model[0][1], 3)\n\n    def test_removeColumns(self):\n        self.model.removeColumns(0, 1)\n        self.assertEqual(self.model.columnCount(), 1)\n        self.assertEqual(self.model[1][0], 3)\n\n    def test_insertRows(self):\n        self.model.insertRows(0, 1)\n        self.assertEqual(self.model[1][0], 1)\n\n    def test_insertColumns(self):\n        self.model.insertColumns(0, 1)\n        self.assertEqual(self.model[0], ['', 1, 4])\n\n    def test_wrap(self):\n        self.model.wrap([[0]])\n        self.assertEqual(self.model.rowCount(), 1)\n        self.assertEqual(self.model.columnCount(), 1)\n\n    def test_clear(self):\n        self.model.clear()\n        self.assertEqual(self.model.rowCount(), 0)\n\n    def test_append(self):\n        self.model.append([5, 6])\n        self.assertEqual(self.model[2][1], 6)\n        self.assertEqual(self.model.rowCount(), 3)\n\n    def test_extend(self):\n        self.model.extend([[5, 6]])\n        self.assertEqual(self.model[2][1], 6)\n        self.assertEqual(self.model.rowCount(), 3)\n\n    def test_insert(self):\n        self.model.insert(0, [5, 6])\n        self.assertEqual(self.model[0][1], 6)\n        self.assertEqual(self.model.rowCount(), 3)\n\n    def test_remove(self):\n        self.model.remove([2, 3])\n        self.assertEqual(self.model.rowCount(), 1)\n\n    def test_other_roles(self):\n        self.model.append([2, 3])\n        self.model.setData(self.model.index(2, 0),\n                           Qt.AlignCenter,\n                           Qt.TextAlignmentRole)\n        del self.model[1]\n        self.assertTrue(Qt.AlignCenter &\n                        self.model.data(self.model.index(1, 0),\n                                        Qt.TextAlignmentRole))\n\n    def test_set_iten_slice(self):\n        self.model[:1] = [[10, 11], [12, 13], [14, 15]]\n        self.assertEqual(list(self.model), [[10, 11], [12, 13], [14, 15], [2, 3]])\n\n        self.model[1:3] = []\n        self.assertEqual(list(self.model), [[10, 11], [2, 3]])\n\n        self.model[:] = [[20, 21]]\n        self.assertEqual(list(self.model), [[20, 21]])\n\n        self.model[1:] = [[10, 11], [2, 3]]\n        self.assertEqual(list(self.model), [[20, 21], [10, 11], [2, 3]])\n\n    def test_emits_column_changes_on_row_insert(self):\n        inserted = []\n        removed = []\n        model = PyTableModel()\n        model.columnsInserted.connect(inserted.append)\n        model.columnsRemoved.connect(removed.append)\n        inserted = QSignalSpy(model.columnsInserted)\n        removed = QSignalSpy(model.columnsRemoved)\n        model.append([2])\n        self.assertEqual(list(inserted)[-1][1:], [0, 0])\n        model.append([2, 3])\n        self.assertEqual(list(inserted)[-1][1:], [1, 1])\n        del model[:]\n        self.assertEqual(list(removed)[-1][1:], [0, 1])\n        model.extend([[0, 1], [0, 2]])\n        self.assertEqual(list(inserted)[-1][1:], [0, 1])\n        model.clear()\n        self.assertEqual(list(removed)[-1][1:], [0, 1])\n        model[:] = [[1], [2]]\n        self.assertEqual(list(inserted)[-1][1:], [0, 0])\n\n\nclass TestVariableListModel(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.disc = DiscreteVariable(\"gender\", values=(\"M\", \"F\"))\n        cls.cont = ContinuousVariable(\"age\")\n        cls.string = StringVariable(\"name\")\n        cls.time = TimeVariable(\"birth\")\n        cls.model = VariableListModel([\n            cls.cont, None, \"Foo\", cls.disc, cls.string, cls.time])\n\n    def test_placeholder(self):\n        model = self.model\n        self.assertEqual(model.data(model.index(1)), \"None\")\n        model.placeholder = \"Bar\"\n        self.assertEqual(model.data(model.index(1)), \"Bar\")\n        model.placeholder = \"None\"\n\n    def test_displayrole(self):\n        data, index = self.model.data, self.model.index\n        self.assertEqual(data(index(0)), \"age\")\n        self.assertEqual(data(index(1)), \"None\")\n        self.assertEqual(data(index(2)), \"Foo\")\n        self.assertEqual(data(index(3)), \"gender\")\n        self.assertEqual(data(index(4)), \"name\")\n        self.assertEqual(data(index(5)), \"birth\")\n\n    def test_tooltip(self):\n        def get_tooltip(i):\n            return self.model.data(self.model.index(i), Qt.ToolTipRole)\n\n        text = get_tooltip(0)\n        self.assertIn(\"age\", text)\n        self.assertIn(\"Numeric\", text)\n\n        self.assertIsNone(get_tooltip(1))\n        self.assertIsNone(get_tooltip(2))\n\n        text = get_tooltip(3)\n        self.assertIn(\"gender\", text)\n        self.assertIn(\"M\", text)\n        self.assertIn(\"F\", text)\n        self.assertIn(\"2\", text)\n        self.assertIn(\"Categorical\", text)\n\n        text = get_tooltip(4)\n        self.assertIn(\"name\", text)\n        self.assertIn(\"Text\", text)\n\n        text = get_tooltip(5)\n        self.assertIn(\"birth\", text)\n        self.assertIn(\"Time\", text)\n\n        self.cont.attributes = {\"foo\": \"bar\"}\n        text = get_tooltip(0)\n        self.assertIn(\"foo\", text)\n        self.assertIn(\"bar\", text)\n\n    def test_table_variable(self):\n        self.assertEqual(\n            [self.model.data(self.model.index(i), TableVariable)\n             for i in range(self.model.rowCount())],\n            [self.cont, None, None, self.disc, self.string, self.time])\n\n    def test_other_roles(self):\n        with patch.object(PyListModel, \"data\") as data:\n            index = self.model.index(0)\n            _ = self.model.data(index, Qt.BackgroundRole)\n            self.assertEqual(data.call_args[0][1:], (index, Qt.BackgroundRole))\n\n    def test_invalid_index(self):\n        self.assertIsNone(self.model.data(self.model.index(0).parent()))\n\n\nclass TestDomainModel(unittest.TestCase):\n    def test_init_with_single_section(self):\n        model = DomainModel(order=DomainModel.CLASSES)\n        self.assertEqual(model.order, (DomainModel.CLASSES, ))\n\n    def test_separators(self):\n        attrs = [ContinuousVariable(n) for n in \"abg\"]\n        classes = [ContinuousVariable(n) for n in \"deh\"]\n        metas = [ContinuousVariable(n) for n in \"ijf\"]\n\n        model = DomainModel()\n        sep = [model.Separator]\n        model.set_domain(Domain(attrs, classes, metas))\n        self.assertEqual(list(model), classes + sep + metas + sep + attrs)\n\n        model = DomainModel()\n        model.set_domain(Domain(attrs, [], metas))\n        self.assertEqual(list(model), metas + sep + attrs)\n\n        model = DomainModel()\n        model.set_domain(Domain([], [], metas))\n        self.assertEqual(list(model), metas)\n\n        model = DomainModel(placeholder=\"foo\")\n        model.set_domain(Domain([], [], metas))\n        self.assertEqual(list(model), [None] + sep + metas)\n\n        model = DomainModel(placeholder=\"foo\")\n        model.set_domain(Domain(attrs, [], metas))\n        self.assertEqual(list(model), [None] + sep + metas + sep + attrs)\n\n    def test_placeholder_placement(self):\n        model = DomainModel(placeholder=\"foo\")\n        sep = model.Separator\n        self.assertEqual(model.order, (None, sep) + model.SEPARATED)\n\n        model = DomainModel(order=(\"bar\", ), placeholder=\"foo\")\n        self.assertEqual(model.order, (None, \"bar\"))\n\n        model = DomainModel(order=(\"bar\", None, \"baz\"), placeholder=\"foo\")\n        self.assertEqual(model.order, (\"bar\", None, \"baz\"))\n\n        model = DomainModel(order=(\"bar\", sep, \"baz\"),\n                            placeholder=\"foo\")\n        self.assertEqual(model.order, (None, sep, \"bar\", sep, \"baz\"))\n\n    def test_subparts(self):\n        attrs = [ContinuousVariable(n) for n in \"abg\"]\n        classes = [ContinuousVariable(n) for n in \"deh\"]\n        metas = [ContinuousVariable(n) for n in \"ijf\"]\n\n        m = DomainModel\n        sep = m.Separator\n        model = DomainModel(\n            order=(m.ATTRIBUTES | m.METAS, sep, m.CLASSES))\n        model.set_domain(Domain(attrs, classes, metas))\n        self.assertEqual(list(model), attrs + metas + [sep] + classes)\n\n        m = DomainModel\n        sep = m.Separator\n        model = DomainModel(\n            order=(m.ATTRIBUTES | m.METAS, sep, m.CLASSES),\n            alphabetical=True)\n        model.set_domain(Domain(attrs, classes, metas))\n        self.assertEqual(list(model),\n                         sorted(attrs + metas, key=lambda x: x.name) +\n                         [sep] +\n                         sorted(classes, key=lambda x: x.name))\n\n    def test_filtering(self):\n        cont = [ContinuousVariable(n) for n in \"abc\"]\n        disc = [DiscreteVariable(n) for n in \"def\"]\n        attrs = cont + disc\n\n        model = DomainModel(valid_types=(ContinuousVariable, ))\n        model.set_domain(Domain(attrs))\n        self.assertEqual(list(model), cont)\n\n        model = DomainModel(valid_types=(DiscreteVariable, ))\n        model.set_domain(Domain(attrs))\n        self.assertEqual(list(model), disc)\n\n        disc[0].attributes[\"hidden\"] = True\n        model.set_domain(Domain(attrs))\n        self.assertEqual(list(model), disc[1:])\n\n        model = DomainModel(valid_types=(DiscreteVariable, ),\n                            skip_hidden_vars=False)\n        model.set_domain(Domain(attrs))\n        self.assertEqual(list(model), disc)\n\n    def test_no_separators(self):\n        \"\"\"\n        GH-2697\n        \"\"\"\n        attrs = [ContinuousVariable(n) for n in \"abg\"]\n        classes = [ContinuousVariable(n) for n in \"deh\"]\n        metas = [ContinuousVariable(n) for n in \"ijf\"]\n\n        model = DomainModel(order=DomainModel.SEPARATED, separators=False)\n        model.set_domain(Domain(attrs, classes, metas))\n        self.assertEqual(list(model), classes + metas + attrs)\n\n        model = DomainModel(order=DomainModel.SEPARATED, separators=True)\n        model.set_domain(Domain(attrs, classes, metas))\n        self.assertEqual(\n            list(model),\n            classes + [PyListModel.Separator] + metas + [PyListModel.Separator] + attrs)\n\n    def test_read_only(self):\n        model = DomainModel()\n        domain = Domain([ContinuousVariable(x) for x in \"abc\"])\n        model.set_domain(domain)\n        index = model.index(0, 0)\n\n        self.assertRaises(TypeError, model.append, 42)\n        self.assertRaises(TypeError, model.extend, [42])\n        self.assertRaises(TypeError, model.insert, 0, 42)\n        self.assertRaises(TypeError, model.remove, 0)\n        self.assertRaises(TypeError, model.pop)\n        self.assertRaises(TypeError, model.clear)\n        self.assertRaises(TypeError, model.reverse)\n        self.assertRaises(TypeError, model.sort)\n        with self.assertRaises(TypeError):\n            model[0] = 1\n        with self.assertRaises(TypeError):\n            del model[0]\n\n        self.assertFalse(model.setData(index, domain[0], Qt.EditRole))\n        self.assertTrue(model.setData(index, \"foo\", Qt.ToolTipRole))\n\n        self.assertFalse(model.setItemData(index, {Qt.EditRole: domain[0],\n                                                   Qt.ToolTipRole: \"foo\"}))\n        self.assertTrue(model.setItemData(index, {Qt.ToolTipRole: \"foo\"}))\n\n        self.assertFalse(model.insertRows(0, 1))\n        self.assertEqual(list(model), list(domain.variables))\n        self.assertFalse(model.removeRows(0, 1))\n        self.assertEqual(list(model), list(domain.variables))\n\n\nclass TestContinuousPalettesModel(GuiTest):\n    def setUp(self):\n        self.palette1, self.palette2 = \\\n            list(colorpalettes.ContinuousPalettes.values())[:2]\n\n    def test_all_categories(self):\n        model = ContinuousPalettesModel()\n        shown = {palette.name for palette in model.items\n                 if isinstance(palette, colorpalettes.Palette)}\n        expected = {palette.name\n                    for palette in colorpalettes.ContinuousPalettes.values()}\n        self.assertEqual(expected, shown)\n\n        shown = {name for name in model.items if isinstance(name, str)}\n        expected = {palette.category\n                    for palette in colorpalettes.ContinuousPalettes.values()}\n        self.assertEqual(expected, shown)\n\n    def test_category_selection(self):\n        categories = ('Diverging', 'Linear')\n        model = ContinuousPalettesModel(categories=categories)\n        shown = {palette.name\n                 for palette in model.items\n                 if isinstance(palette, colorpalettes.Palette)}\n        expected = {palette.name\n                    for palette in colorpalettes.ContinuousPalettes.values()\n                    if palette.category in categories}\n        self.assertEqual(expected, shown)\n        self.assertIn(\"Diverging\", model.items)\n        self.assertIn(\"Linear\", model.items)\n\n    def test_single_category(self):\n        category = 'Diverging'\n        model = ContinuousPalettesModel(categories=(category, ))\n        shown = {palette.name\n                 for palette in model.items\n                 if isinstance(palette, colorpalettes.Palette)}\n        expected = {palette.name\n                    for palette in colorpalettes.ContinuousPalettes.values()\n                    if palette.category == category}\n        self.assertEqual(expected, shown)\n        self.assertEqual(len(model.items), len(shown))\n\n    def test_count(self):\n        model = ContinuousPalettesModel()\n        model.items = [self.palette1, self.palette1]\n        self.assertEqual(model.rowCount(QModelIndex()), 2)\n        self.assertEqual(model.columnCount(QModelIndex()), 1)\n\n    def test_data(self):\n        model = ContinuousPalettesModel()\n        model.items = [\"Palettes\", self.palette1, self.palette2]\n        data = model.data\n        index = model.index\n\n        self.assertEqual(data(index(0, 0), Qt.EditRole), \"Palettes\")\n        self.assertEqual(data(index(1, 0), Qt.EditRole),\n                         self.palette1.friendly_name)\n        self.assertEqual(data(index(2, 0), Qt.EditRole),\n                         self.palette2.friendly_name)\n\n        self.assertEqual(data(index(0, 0), Qt.DisplayRole), \"Palettes\")\n        self.assertEqual(data(index(1, 0), Qt.DisplayRole),\n                         self.palette1.friendly_name)\n        self.assertEqual(data(index(2, 0), Qt.DisplayRole),\n                         self.palette2.friendly_name)\n\n        self.assertIsNone(data(index(0, 0), Qt.DecorationRole))\n        with patch.object(self.palette1, \"color_strip\") as color_strip:\n            self.assertIs(data(index(1, 0), Qt.DecorationRole),\n                          color_strip.return_value)\n        with patch.object(self.palette2, \"color_strip\") as color_strip:\n            self.assertIs(data(index(2, 0), Qt.DecorationRole),\n                          color_strip.return_value)\n\n        self.assertIsNone(data(index(0, 0), Qt.UserRole))\n        self.assertIs(data(index(1, 0), Qt.UserRole), self.palette1)\n        self.assertIs(data(index(2, 0), Qt.UserRole), self.palette2)\n\n        self.assertIsNone(data(index(2, 0), Qt.FontRole))\n\n    def test_select_flags(self):\n        model = ContinuousPalettesModel()\n        model.items = [\"Palettes\", self.palette1, self.palette2]\n        self.assertFalse(model.flags(model.index(0, 0)) & Qt.ItemIsSelectable)\n        self.assertTrue(model.flags(model.index(1, 0)) & Qt.ItemIsSelectable)\n        self.assertTrue(model.flags(model.index(2, 0)) & Qt.ItemIsSelectable)\n\n    def testIndexOf(self):\n        model = ContinuousPalettesModel()\n        model.items = [\"Palettes\", self.palette1, self.palette2]\n        self.assertEqual(model.indexOf(self.palette1), 1)\n        self.assertEqual(model.indexOf(self.palette1.name), 1)\n        self.assertEqual(model.indexOf(self.palette1.friendly_name), 1)\n        self.assertEqual(model.indexOf(self.palette2), 2)\n        self.assertEqual(model.indexOf(self.palette2.name), 2)\n        self.assertEqual(model.indexOf(self.palette2.friendly_name), 2)\n        self.assertIsNone(model.indexOf(42))\n\n\nclass TestPyListModelTooltip(GuiTest):\n    def test_tooltips_size(self):\n        def data(i):\n            return model.data(model.index(i, 0))\n\n        def tip(i):\n            return model.data(model.index(i, 0), Qt.ToolTipRole)\n\n        # Not enough tooptips - return None\n        model = PyListModelTooltip([\"foo\", \"bar\", \"baz\"], [\"footip\", \"bartip\"])\n        self.assertEqual(data(1), \"bar\")\n        self.assertEqual(data(2), \"baz\")\n        self.assertIsNone(data(3))\n        self.assertEqual(tip(1), \"bartip\")\n        self.assertIsNone(tip(2))\n\n        # No tooltips\n        model = PyListModelTooltip([\"foo\", \"bar\", \"baz\"])\n        self.assertIsNone(tip(1))\n        self.assertIsNone(tip(2))\n\n        # Too many tooltips\n        model = PyListModelTooltip([\"foo\", \"bar\"], [\"footip\", \"bartip\", \"btip\"])\n        self.assertEqual(data(0), \"foo\")\n        self.assertEqual(data(1), \"bar\")\n        self.assertIsNone(data(2))\n        self.assertEqual(tip(1), \"bartip\")\n        self.assertEqual(tip(2), \"btip\")\n\n    def test_tooltip_arg(self):\n        def tip(i):\n            return model.data(model.index(i, 0), Qt.ToolTipRole)\n\n        # Allow generators\n        s = dict(a=\"ta\", b=\"tb\")\n        model = PyListModelTooltip(s, s.values())\n        self.assertEqual(tip(0), \"ta\")\n        self.assertEqual(tip(1), \"tb\")\n\n        # Basically backward compatibility; this behaviour diverges from\n        # behaviour of data role\n        s = []\n        model = PyListModelTooltip([\"foo\"], s)\n        self.assertIsNone(tip(0))\n\n        s += [\"footip\"]\n        self.assertEqual(tip(1), \"footip\")\n\n\nclass TestTableModel(unittest.TestCase, dbt):\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        self.conn, self.iris = self.create_iris_sql_table()\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    @dbt.run_on([\"postgres\", \"mssql\"])\n    def test_dense_data(self):\n        table = SqlTable(self.conn, self.iris, inspect_values=True)\n        table.domain = Domain(table.domain.attributes[:-1],\n                              table.domain.attributes[-1])\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def test_local_dense_data(self):\n        table = Table(\"iris.tab\")\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def _dense_data(self, table, data, index):\n        # Y: categorical\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: continuous\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 1), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 1), Qt.EditRole), Value)\n        self.assertIsNone(data(index(0, 1), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 1), Qt.ForegroundRole))\n        self.assertEqual(table[0, 0], data(index(0, 1), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 1), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[0], data(index(0, 1), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 1), TableModel.VariableStatsRole), BasicStats)\n\n    def test_sparse_data(self):\n        table = Table(test_filename(\"datasets/iris_basket.basket\"))\n        model = TableModel(table)\n        data, index = model.data, model.index\n\n        # Y: 2d\n        self.assertListEqual([table[0, 4], table[0, 5], table[0, 6]],\n                             [data(index(0, i), Qt.DisplayRole) for i in range(3)])\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: basket\n        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 3), Qt.DisplayRole))\n        self.assertIsNone(data(index(0, 3), Qt.EditRole))\n        self.assertIsNone(data(index(0, 3), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 3), Qt.ForegroundRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ClassValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableStatsRole))\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "new_file_content": "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\nimport unittest\nfrom unittest.mock import patch\n\nfrom scipy.sparse import csr_matrix\n\nfrom AnyQt.QtCore import Qt, QModelIndex\nfrom AnyQt.QtTest import QSignalSpy\nfrom AnyQt.QtGui import QBrush, QColor\n\nfrom orangewidget.tests.base import GuiTest\n\nfrom Orange.data import \\\n    Domain, Table, Value, \\\n    ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable\nfrom Orange.statistics.basic_stats import BasicStats\nfrom Orange.widgets.utils import colorpalettes\nfrom Orange.widgets.utils.itemmodels import \\\n    PyTableModel, PyListModel, PyListModelTooltip,\\\n    VariableListModel, DomainModel, ContinuousPalettesModel, \\\n    TableModel, _as_contiguous_range\nfrom Orange.widgets.gui import TableVariable\nfrom Orange.tests import test_filename\nfrom Orange.tests.sql.base import DataBaseTest as dbt\nfrom Orange.data.sql.table import SqlTable\n\n\nclass TestUtils(unittest.TestCase):\n    def test_as_contiguous_range(self):\n        self.assertEqual(_as_contiguous_range(slice(1, 8), 20), (1, 8, 1))\n        self.assertEqual(_as_contiguous_range(slice(1, 8), 6), (1, 6, 1))\n        self.assertEqual(_as_contiguous_range(slice(8, 1, -1), 6), (2, 6, 1))\n        self.assertEqual(_as_contiguous_range(slice(8), 6), (0, 6, 1))\n        self.assertEqual(_as_contiguous_range(slice(8, None, -1), 6), (0, 6, 1))\n        self.assertEqual(_as_contiguous_range(slice(7, None, -1), 9), (0, 8, 1))\n        self.assertEqual(_as_contiguous_range(slice(None, None, -1), 9),\n                         (0, 9, 1))\n\n\nclass TestPyTableModel(unittest.TestCase):\n    def setUp(self):\n        self.model = PyTableModel([[1, 4],\n                                   [2, 3]])\n\n    def test_init(self):\n        self.model = PyTableModel()\n        self.assertEqual(self.model.rowCount(), 0)\n\n    def test_init_wrap_empty(self):\n        # pylint: disable=protected-access\n        t = []\n        model = PyTableModel(t)\n        self.assertIs(model._table, t)\n        t.append([1, 2, 3])\n        self.assertEqual(list(model), [[1, 2, 3]])\n\n    def test_rowCount(self):\n        self.assertEqual(self.model.rowCount(), 2)\n        self.assertEqual(len(self.model), 2)\n\n    def test_columnCount(self):\n        self.assertEqual(self.model.columnCount(), 2)\n\n    def test_data(self):\n        mi = self.model.index(0, 0)\n        self.assertEqual(self.model.data(mi), '1')\n        self.assertEqual(self.model.data(mi, Qt.EditRole), 1)\n\n    def test_editable(self):\n        editable_model = PyTableModel([[0]], editable=True)\n        self.assertFalse(bool(self.model.flags(self.model.index(0, 0)) & Qt.ItemIsEditable))\n        self.assertTrue(bool(editable_model.flags(editable_model.index(0, 0)) & Qt.ItemIsEditable))\n\n    def test_sort(self):\n        self.model.sort(1)\n        self.assertEqual(self.model.index(0, 0).data(Qt.EditRole), 2)\n\n    def test_setHeaderLabels(self):\n        self.model.setHorizontalHeaderLabels(['Col 1', 'Col 2'])\n        self.assertEqual(self.model.headerData(1, Qt.Horizontal), 'Col 2')\n        self.assertEqual(self.model.headerData(1, Qt.Vertical), 2)\n\n    def test_removeRows(self):\n        self.model.removeRows(0, 1)\n        self.assertEqual(len(self.model), 1)\n        self.assertEqual(self.model[0][1], 3)\n\n    def test_removeColumns(self):\n        self.model.removeColumns(0, 1)\n        self.assertEqual(self.model.columnCount(), 1)\n        self.assertEqual(self.model[1][0], 3)\n\n    def test_insertRows(self):\n        self.model.insertRows(0, 1)\n        self.assertEqual(self.model[1][0], 1)\n\n    def test_insertColumns(self):\n        self.model.insertColumns(0, 1)\n        self.assertEqual(self.model[0], ['', 1, 4])\n\n    def test_wrap(self):\n        self.model.wrap([[0]])\n        self.assertEqual(self.model.rowCount(), 1)\n        self.assertEqual(self.model.columnCount(), 1)\n\n    def test_clear(self):\n        self.model.clear()\n        self.assertEqual(self.model.rowCount(), 0)\n\n    def test_append(self):\n        self.model.append([5, 6])\n        self.assertEqual(self.model[2][1], 6)\n        self.assertEqual(self.model.rowCount(), 3)\n\n    def test_extend(self):\n        self.model.extend([[5, 6]])\n        self.assertEqual(self.model[2][1], 6)\n        self.assertEqual(self.model.rowCount(), 3)\n\n    def test_insert(self):\n        self.model.insert(0, [5, 6])\n        self.assertEqual(self.model[0][1], 6)\n        self.assertEqual(self.model.rowCount(), 3)\n\n    def test_remove(self):\n        self.model.remove([2, 3])\n        self.assertEqual(self.model.rowCount(), 1)\n\n    def test_other_roles(self):\n        self.model.append([2, 3])\n        self.model.setData(self.model.index(2, 0),\n                           Qt.AlignCenter,\n                           Qt.TextAlignmentRole)\n        del self.model[1]\n        self.assertTrue(Qt.AlignCenter &\n                        self.model.data(self.model.index(1, 0),\n                                        Qt.TextAlignmentRole))\n\n    def test_set_iten_slice(self):\n        self.model[:1] = [[10, 11], [12, 13], [14, 15]]\n        self.assertEqual(list(self.model), [[10, 11], [12, 13], [14, 15], [2, 3]])\n\n        self.model[1:3] = []\n        self.assertEqual(list(self.model), [[10, 11], [2, 3]])\n\n        self.model[:] = [[20, 21]]\n        self.assertEqual(list(self.model), [[20, 21]])\n\n        self.model[1:] = [[10, 11], [2, 3]]\n        self.assertEqual(list(self.model), [[20, 21], [10, 11], [2, 3]])\n\n    def test_emits_column_changes_on_row_insert(self):\n        inserted = []\n        removed = []\n        model = PyTableModel()\n        model.columnsInserted.connect(inserted.append)\n        model.columnsRemoved.connect(removed.append)\n        inserted = QSignalSpy(model.columnsInserted)\n        removed = QSignalSpy(model.columnsRemoved)\n        model.append([2])\n        self.assertEqual(list(inserted)[-1][1:], [0, 0])\n        model.append([2, 3])\n        self.assertEqual(list(inserted)[-1][1:], [1, 1])\n        del model[:]\n        self.assertEqual(list(removed)[-1][1:], [0, 1])\n        model.extend([[0, 1], [0, 2]])\n        self.assertEqual(list(inserted)[-1][1:], [0, 1])\n        model.clear()\n        self.assertEqual(list(removed)[-1][1:], [0, 1])\n        model[:] = [[1], [2]]\n        self.assertEqual(list(inserted)[-1][1:], [0, 0])\n\n\nclass TestVariableListModel(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.disc = DiscreteVariable(\"gender\", values=(\"M\", \"F\"))\n        cls.cont = ContinuousVariable(\"age\")\n        cls.string = StringVariable(\"name\")\n        cls.time = TimeVariable(\"birth\")\n        cls.model = VariableListModel([\n            cls.cont, None, \"Foo\", cls.disc, cls.string, cls.time])\n\n    def test_placeholder(self):\n        model = self.model\n        self.assertEqual(model.data(model.index(1)), \"None\")\n        model.placeholder = \"Bar\"\n        self.assertEqual(model.data(model.index(1)), \"Bar\")\n        model.placeholder = \"None\"\n\n    def test_displayrole(self):\n        data, index = self.model.data, self.model.index\n        self.assertEqual(data(index(0)), \"age\")\n        self.assertEqual(data(index(1)), \"None\")\n        self.assertEqual(data(index(2)), \"Foo\")\n        self.assertEqual(data(index(3)), \"gender\")\n        self.assertEqual(data(index(4)), \"name\")\n        self.assertEqual(data(index(5)), \"birth\")\n\n    def test_tooltip(self):\n        def get_tooltip(i):\n            return self.model.data(self.model.index(i), Qt.ToolTipRole)\n\n        text = get_tooltip(0)\n        self.assertIn(\"age\", text)\n        self.assertIn(\"Numeric\", text)\n\n        self.assertIsNone(get_tooltip(1))\n        self.assertIsNone(get_tooltip(2))\n\n        text = get_tooltip(3)\n        self.assertIn(\"gender\", text)\n        self.assertIn(\"M\", text)\n        self.assertIn(\"F\", text)\n        self.assertIn(\"2\", text)\n        self.assertIn(\"Categorical\", text)\n\n        text = get_tooltip(4)\n        self.assertIn(\"name\", text)\n        self.assertIn(\"Text\", text)\n\n        text = get_tooltip(5)\n        self.assertIn(\"birth\", text)\n        self.assertIn(\"Time\", text)\n\n        self.cont.attributes = {\"foo\": \"bar\"}\n        text = get_tooltip(0)\n        self.assertIn(\"foo\", text)\n        self.assertIn(\"bar\", text)\n\n    def test_table_variable(self):\n        self.assertEqual(\n            [self.model.data(self.model.index(i), TableVariable)\n             for i in range(self.model.rowCount())],\n            [self.cont, None, None, self.disc, self.string, self.time])\n\n    def test_other_roles(self):\n        with patch.object(PyListModel, \"data\") as data:\n            index = self.model.index(0)\n            _ = self.model.data(index, Qt.BackgroundRole)\n            self.assertEqual(data.call_args[0][1:], (index, Qt.BackgroundRole))\n\n    def test_invalid_index(self):\n        self.assertIsNone(self.model.data(self.model.index(0).parent()))\n\n\nclass TestDomainModel(unittest.TestCase):\n    def test_init_with_single_section(self):\n        model = DomainModel(order=DomainModel.CLASSES)\n        self.assertEqual(model.order, (DomainModel.CLASSES, ))\n\n    def test_separators(self):\n        attrs = [ContinuousVariable(n) for n in \"abg\"]\n        classes = [ContinuousVariable(n) for n in \"deh\"]\n        metas = [ContinuousVariable(n) for n in \"ijf\"]\n\n        model = DomainModel()\n        sep = [model.Separator]\n        model.set_domain(Domain(attrs, classes, metas))\n        self.assertEqual(list(model), classes + sep + metas + sep + attrs)\n\n        model = DomainModel()\n        model.set_domain(Domain(attrs, [], metas))\n        self.assertEqual(list(model), metas + sep + attrs)\n\n        model = DomainModel()\n        model.set_domain(Domain([], [], metas))\n        self.assertEqual(list(model), metas)\n\n        model = DomainModel(placeholder=\"foo\")\n        model.set_domain(Domain([], [], metas))\n        self.assertEqual(list(model), [None] + sep + metas)\n\n        model = DomainModel(placeholder=\"foo\")\n        model.set_domain(Domain(attrs, [], metas))\n        self.assertEqual(list(model), [None] + sep + metas + sep + attrs)\n\n    def test_placeholder_placement(self):\n        model = DomainModel(placeholder=\"foo\")\n        sep = model.Separator\n        self.assertEqual(model.order, (None, sep) + model.SEPARATED)\n\n        model = DomainModel(order=(\"bar\", ), placeholder=\"foo\")\n        self.assertEqual(model.order, (None, \"bar\"))\n\n        model = DomainModel(order=(\"bar\", None, \"baz\"), placeholder=\"foo\")\n        self.assertEqual(model.order, (\"bar\", None, \"baz\"))\n\n        model = DomainModel(order=(\"bar\", sep, \"baz\"),\n                            placeholder=\"foo\")\n        self.assertEqual(model.order, (None, sep, \"bar\", sep, \"baz\"))\n\n    def test_subparts(self):\n        attrs = [ContinuousVariable(n) for n in \"abg\"]\n        classes = [ContinuousVariable(n) for n in \"deh\"]\n        metas = [ContinuousVariable(n) for n in \"ijf\"]\n\n        m = DomainModel\n        sep = m.Separator\n        model = DomainModel(\n            order=(m.ATTRIBUTES | m.METAS, sep, m.CLASSES))\n        model.set_domain(Domain(attrs, classes, metas))\n        self.assertEqual(list(model), attrs + metas + [sep] + classes)\n\n        m = DomainModel\n        sep = m.Separator\n        model = DomainModel(\n            order=(m.ATTRIBUTES | m.METAS, sep, m.CLASSES),\n            alphabetical=True)\n        model.set_domain(Domain(attrs, classes, metas))\n        self.assertEqual(list(model),\n                         sorted(attrs + metas, key=lambda x: x.name) +\n                         [sep] +\n                         sorted(classes, key=lambda x: x.name))\n\n    def test_filtering(self):\n        cont = [ContinuousVariable(n) for n in \"abc\"]\n        disc = [DiscreteVariable(n) for n in \"def\"]\n        attrs = cont + disc\n\n        model = DomainModel(valid_types=(ContinuousVariable, ))\n        model.set_domain(Domain(attrs))\n        self.assertEqual(list(model), cont)\n\n        model = DomainModel(valid_types=(DiscreteVariable, ))\n        model.set_domain(Domain(attrs))\n        self.assertEqual(list(model), disc)\n\n        disc[0].attributes[\"hidden\"] = True\n        model.set_domain(Domain(attrs))\n        self.assertEqual(list(model), disc[1:])\n\n        model = DomainModel(valid_types=(DiscreteVariable, ),\n                            skip_hidden_vars=False)\n        model.set_domain(Domain(attrs))\n        self.assertEqual(list(model), disc)\n\n    def test_no_separators(self):\n        \"\"\"\n        GH-2697\n        \"\"\"\n        attrs = [ContinuousVariable(n) for n in \"abg\"]\n        classes = [ContinuousVariable(n) for n in \"deh\"]\n        metas = [ContinuousVariable(n) for n in \"ijf\"]\n\n        model = DomainModel(order=DomainModel.SEPARATED, separators=False)\n        model.set_domain(Domain(attrs, classes, metas))\n        self.assertEqual(list(model), classes + metas + attrs)\n\n        model = DomainModel(order=DomainModel.SEPARATED, separators=True)\n        model.set_domain(Domain(attrs, classes, metas))\n        self.assertEqual(\n            list(model),\n            classes + [PyListModel.Separator] + metas + [PyListModel.Separator] + attrs)\n\n    def test_read_only(self):\n        model = DomainModel()\n        domain = Domain([ContinuousVariable(x) for x in \"abc\"])\n        model.set_domain(domain)\n        index = model.index(0, 0)\n\n        self.assertRaises(TypeError, model.append, 42)\n        self.assertRaises(TypeError, model.extend, [42])\n        self.assertRaises(TypeError, model.insert, 0, 42)\n        self.assertRaises(TypeError, model.remove, 0)\n        self.assertRaises(TypeError, model.pop)\n        self.assertRaises(TypeError, model.clear)\n        self.assertRaises(TypeError, model.reverse)\n        self.assertRaises(TypeError, model.sort)\n        with self.assertRaises(TypeError):\n            model[0] = 1\n        with self.assertRaises(TypeError):\n            del model[0]\n\n        self.assertFalse(model.setData(index, domain[0], Qt.EditRole))\n        self.assertTrue(model.setData(index, \"foo\", Qt.ToolTipRole))\n\n        self.assertFalse(model.setItemData(index, {Qt.EditRole: domain[0],\n                                                   Qt.ToolTipRole: \"foo\"}))\n        self.assertTrue(model.setItemData(index, {Qt.ToolTipRole: \"foo\"}))\n\n        self.assertFalse(model.insertRows(0, 1))\n        self.assertEqual(list(model), list(domain.variables))\n        self.assertFalse(model.removeRows(0, 1))\n        self.assertEqual(list(model), list(domain.variables))\n\n\nclass TestContinuousPalettesModel(GuiTest):\n    def setUp(self):\n        self.palette1, self.palette2 = \\\n            list(colorpalettes.ContinuousPalettes.values())[:2]\n\n    def test_all_categories(self):\n        model = ContinuousPalettesModel()\n        shown = {palette.name for palette in model.items\n                 if isinstance(palette, colorpalettes.Palette)}\n        expected = {palette.name\n                    for palette in colorpalettes.ContinuousPalettes.values()}\n        self.assertEqual(expected, shown)\n\n        shown = {name for name in model.items if isinstance(name, str)}\n        expected = {palette.category\n                    for palette in colorpalettes.ContinuousPalettes.values()}\n        self.assertEqual(expected, shown)\n\n    def test_category_selection(self):\n        categories = ('Diverging', 'Linear')\n        model = ContinuousPalettesModel(categories=categories)\n        shown = {palette.name\n                 for palette in model.items\n                 if isinstance(palette, colorpalettes.Palette)}\n        expected = {palette.name\n                    for palette in colorpalettes.ContinuousPalettes.values()\n                    if palette.category in categories}\n        self.assertEqual(expected, shown)\n        self.assertIn(\"Diverging\", model.items)\n        self.assertIn(\"Linear\", model.items)\n\n    def test_single_category(self):\n        category = 'Diverging'\n        model = ContinuousPalettesModel(categories=(category, ))\n        shown = {palette.name\n                 for palette in model.items\n                 if isinstance(palette, colorpalettes.Palette)}\n        expected = {palette.name\n                    for palette in colorpalettes.ContinuousPalettes.values()\n                    if palette.category == category}\n        self.assertEqual(expected, shown)\n        self.assertEqual(len(model.items), len(shown))\n\n    def test_count(self):\n        model = ContinuousPalettesModel()\n        model.items = [self.palette1, self.palette1]\n        self.assertEqual(model.rowCount(QModelIndex()), 2)\n        self.assertEqual(model.columnCount(QModelIndex()), 1)\n\n    def test_data(self):\n        model = ContinuousPalettesModel()\n        model.items = [\"Palettes\", self.palette1, self.palette2]\n        data = model.data\n        index = model.index\n\n        self.assertEqual(data(index(0, 0), Qt.EditRole), \"Palettes\")\n        self.assertEqual(data(index(1, 0), Qt.EditRole),\n                         self.palette1.friendly_name)\n        self.assertEqual(data(index(2, 0), Qt.EditRole),\n                         self.palette2.friendly_name)\n\n        self.assertEqual(data(index(0, 0), Qt.DisplayRole), \"Palettes\")\n        self.assertEqual(data(index(1, 0), Qt.DisplayRole),\n                         self.palette1.friendly_name)\n        self.assertEqual(data(index(2, 0), Qt.DisplayRole),\n                         self.palette2.friendly_name)\n\n        self.assertIsNone(data(index(0, 0), Qt.DecorationRole))\n        with patch.object(self.palette1, \"color_strip\") as color_strip:\n            self.assertIs(data(index(1, 0), Qt.DecorationRole),\n                          color_strip.return_value)\n        with patch.object(self.palette2, \"color_strip\") as color_strip:\n            self.assertIs(data(index(2, 0), Qt.DecorationRole),\n                          color_strip.return_value)\n\n        self.assertIsNone(data(index(0, 0), Qt.UserRole))\n        self.assertIs(data(index(1, 0), Qt.UserRole), self.palette1)\n        self.assertIs(data(index(2, 0), Qt.UserRole), self.palette2)\n\n        self.assertIsNone(data(index(2, 0), Qt.FontRole))\n\n    def test_select_flags(self):\n        model = ContinuousPalettesModel()\n        model.items = [\"Palettes\", self.palette1, self.palette2]\n        self.assertFalse(model.flags(model.index(0, 0)) & Qt.ItemIsSelectable)\n        self.assertTrue(model.flags(model.index(1, 0)) & Qt.ItemIsSelectable)\n        self.assertTrue(model.flags(model.index(2, 0)) & Qt.ItemIsSelectable)\n\n    def testIndexOf(self):\n        model = ContinuousPalettesModel()\n        model.items = [\"Palettes\", self.palette1, self.palette2]\n        self.assertEqual(model.indexOf(self.palette1), 1)\n        self.assertEqual(model.indexOf(self.palette1.name), 1)\n        self.assertEqual(model.indexOf(self.palette1.friendly_name), 1)\n        self.assertEqual(model.indexOf(self.palette2), 2)\n        self.assertEqual(model.indexOf(self.palette2.name), 2)\n        self.assertEqual(model.indexOf(self.palette2.friendly_name), 2)\n        self.assertIsNone(model.indexOf(42))\n\n\nclass TestPyListModelTooltip(GuiTest):\n    def test_tooltips_size(self):\n        def data(i):\n            return model.data(model.index(i, 0))\n\n        def tip(i):\n            return model.data(model.index(i, 0), Qt.ToolTipRole)\n\n        # Not enough tooptips - return None\n        model = PyListModelTooltip([\"foo\", \"bar\", \"baz\"], [\"footip\", \"bartip\"])\n        self.assertEqual(data(1), \"bar\")\n        self.assertEqual(data(2), \"baz\")\n        self.assertIsNone(data(3))\n        self.assertEqual(tip(1), \"bartip\")\n        self.assertIsNone(tip(2))\n\n        # No tooltips\n        model = PyListModelTooltip([\"foo\", \"bar\", \"baz\"])\n        self.assertIsNone(tip(1))\n        self.assertIsNone(tip(2))\n\n        # Too many tooltips\n        model = PyListModelTooltip([\"foo\", \"bar\"], [\"footip\", \"bartip\", \"btip\"])\n        self.assertEqual(data(0), \"foo\")\n        self.assertEqual(data(1), \"bar\")\n        self.assertIsNone(data(2))\n        self.assertEqual(tip(1), \"bartip\")\n        self.assertEqual(tip(2), \"btip\")\n\n    def test_tooltip_arg(self):\n        def tip(i):\n            return model.data(model.index(i, 0), Qt.ToolTipRole)\n\n        # Allow generators\n        s = dict(a=\"ta\", b=\"tb\")\n        model = PyListModelTooltip(s, s.values())\n        self.assertEqual(tip(0), \"ta\")\n        self.assertEqual(tip(1), \"tb\")\n\n        # Basically backward compatibility; this behaviour diverges from\n        # behaviour of data role\n        s = []\n        model = PyListModelTooltip([\"foo\"], s)\n        self.assertIsNone(tip(0))\n\n        s += [\"footip\"]\n        self.assertEqual(tip(1), \"footip\")\n\n\nclass TestTableModel(unittest.TestCase, dbt):\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        self.conn, self.iris = self.create_iris_sql_table()\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    @dbt.run_on([\"postgres\", \"mssql\"])\n    def test_dense_data(self):\n        table = SqlTable(self.conn, self.iris, inspect_values=True)\n        table.domain = Domain(table.domain.attributes[:-1],\n                              table.domain.attributes[-1])\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def test_local_dense_data(self):\n        table = Table(\"iris.tab\")\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def _dense_data(self, table, data, index):\n        # Y: categorical\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: continuous\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 1), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 1), Qt.EditRole), Value)\n        self.assertIsNone(data(index(0, 1), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 1), Qt.ForegroundRole))\n        self.assertEqual(table[0, 0], data(index(0, 1), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 1), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[0], data(index(0, 1), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 1), TableModel.VariableStatsRole), BasicStats)\n\n    def test_sparse_data(self):\n        table = Table(test_filename(\"datasets/iris_basket.basket\"))\n        model = TableModel(table)\n        data, index = model.data, model.index\n\n        # Y: 2d\n        self.assertListEqual([table[0, 4], table[0, 5], table[0, 6]],\n                             [data(index(0, i), Qt.DisplayRole) for i in range(3)])\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: sparse\n        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 3), Qt.DisplayRole))\n        self.assertIsNone(data(index(0, 3), Qt.EditRole))\n        self.assertIsNone(data(index(0, 3), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 3), Qt.ForegroundRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ClassValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableStatsRole))\n\n        # X: sparse_bool\n        table = Table.from_numpy(Domain(table.domain.class_vars, metas=table.domain.attributes),\n                                 csr_matrix(table.Y), metas=table.X)\n        model = TableModel(table)\n        data, index = model.data, model.index\n\n        self.assertEqual(\"Iris-setosa\", data(index(0, 1), Qt.DisplayRole))\n\n        # metas: sparse\n        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 0), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/utils/tests/test_itemmodels.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "14913e611",
                "new_commit_hash": "01b48baae",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/utils/tests/test_itemmodels.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/utils/tests/test_itemmodels.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 3,
                            "length": 6
                        },
                        "new_range": {
                            "start": 3,
                            "length": 8
                        },
                        "section": ""
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "import unittest",
                                "type": "context"
                            },
                            {
                                "content": "from unittest.mock import patch",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "from scipy.sparse import csr_matrix",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "from AnyQt.QtCore import Qt, QModelIndex",
                                "type": "context"
                            },
                            {
                                "content": "from AnyQt.QtTest import QSignalSpy",
                                "type": "context"
                            },
                            {
                                "content": "from AnyQt.QtGui import QBrush, QColor",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [
                        {
                            "file_name": "Orange/widgets/utils/tests/test_itemmodels.py",
                            "type": "statement",
                            "name": "",
                            "content": "from scipy.sparse import csr_matrix",
                            "ast_type_str": "ImportFrom",
                            "start_lineno": 6,
                            "end_lineno": 6,
                            "parent": null
                        }
                    ],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 599,
                            "length": 7
                        },
                        "new_range": {
                            "start": 601,
                            "length": 7
                        },
                        "section": "class TestTableModel(unittest.TestCase, dbt):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        # X: basket",
                                "type": "deleted"
                            },
                            {
                                "content": "        # X: sparse",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",",
                                "type": "context"
                            },
                            {
                                "content": "                         data(index(0, 3), Qt.DisplayRole))",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertIsNone(data(index(0, 3), Qt.EditRole))",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/utils/tests/test_itemmodels.py",
                            "type": "class",
                            "name": "TestTableModel",
                            "content": "class TestTableModel(unittest.TestCase, dbt):\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        self.conn, self.iris = self.create_iris_sql_table()\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    @dbt.run_on([\"postgres\", \"mssql\"])\n    def test_dense_data(self):\n        table = SqlTable(self.conn, self.iris, inspect_values=True)\n        table.domain = Domain(table.domain.attributes[:-1],\n                              table.domain.attributes[-1])\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def test_local_dense_data(self):\n        table = Table(\"iris.tab\")\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def _dense_data(self, table, data, index):\n        # Y: categorical\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: continuous\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 1), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 1), Qt.EditRole), Value)\n        self.assertIsNone(data(index(0, 1), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 1), Qt.ForegroundRole))\n        self.assertEqual(table[0, 0], data(index(0, 1), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 1), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[0], data(index(0, 1), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 1), TableModel.VariableStatsRole), BasicStats)\n\n    def test_sparse_data(self):\n        table = Table(test_filename(\"datasets/iris_basket.basket\"))\n        model = TableModel(table)\n        data, index = model.data, model.index\n\n        # Y: 2d\n        self.assertListEqual([table[0, 4], table[0, 5], table[0, 6]],\n                             [data(index(0, i), Qt.DisplayRole) for i in range(3)])\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: basket\n        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 3), Qt.DisplayRole))\n        self.assertIsNone(data(index(0, 3), Qt.EditRole))\n        self.assertIsNone(data(index(0, 3), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 3), Qt.ForegroundRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ClassValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableStatsRole))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 536,
                            "end_lineno": 611,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/widgets/utils/tests/test_itemmodels.py",
                            "type": "method",
                            "name": "TestTableModel.test_sparse_data",
                            "content": "class TestTableModel(unittest.TestCase, dbt):\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        self.conn, self.iris = self.create_iris_sql_table()\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    @dbt.run_on([\"postgres\", \"mssql\"])\n    def test_dense_data(self):\n        table = SqlTable(self.conn, self.iris, inspect_values=True)\n        table.domain = Domain(table.domain.attributes[:-1],\n                              table.domain.attributes[-1])\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def test_local_dense_data(self):\n        table = Table(\"iris.tab\")\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def _dense_data(self, table, data, index):\n        # Y: categorical\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: continuous\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 1), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 1), Qt.EditRole), Value)\n        self.assertIsNone(data(index(0, 1), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 1), Qt.ForegroundRole))\n        self.assertEqual(table[0, 0], data(index(0, 1), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 1), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[0], data(index(0, 1), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 1), TableModel.VariableStatsRole), BasicStats)\n\n    def test_sparse_data(self):\n        table = Table(test_filename(\"datasets/iris_basket.basket\"))\n        model = TableModel(table)\n        data, index = model.data, model.index\n\n        # Y: 2d\n        self.assertListEqual([table[0, 4], table[0, 5], table[0, 6]],\n                             [data(index(0, i), Qt.DisplayRole) for i in range(3)])\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: basket\n        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 3), Qt.DisplayRole))\n        self.assertIsNone(data(index(0, 3), Qt.EditRole))\n        self.assertIsNone(data(index(0, 3), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 3), Qt.ForegroundRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ClassValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableStatsRole))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 584,
                            "end_lineno": 611,
                            "parent": {
                                "file_name": "Orange/widgets/utils/tests/test_itemmodels.py",
                                "type": "class",
                                "name": "TestTableModel",
                                "content": "class TestTableModel(unittest.TestCase, dbt):\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        self.conn, self.iris = self.create_iris_sql_table()\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    @dbt.run_on([\"postgres\", \"mssql\"])\n    def test_dense_data(self):\n        table = SqlTable(self.conn, self.iris, inspect_values=True)\n        table.domain = Domain(table.domain.attributes[:-1],\n                              table.domain.attributes[-1])\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def test_local_dense_data(self):\n        table = Table(\"iris.tab\")\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def _dense_data(self, table, data, index):\n        # Y: categorical\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: continuous\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 1), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 1), Qt.EditRole), Value)\n        self.assertIsNone(data(index(0, 1), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 1), Qt.ForegroundRole))\n        self.assertEqual(table[0, 0], data(index(0, 1), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 1), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[0], data(index(0, 1), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 1), TableModel.VariableStatsRole), BasicStats)\n\n    def test_sparse_data(self):\n        table = Table(test_filename(\"datasets/iris_basket.basket\"))\n        model = TableModel(table)\n        data, index = model.data, model.index\n\n        # Y: 2d\n        self.assertListEqual([table[0, 4], table[0, 5], table[0, 6]],\n                             [data(index(0, i), Qt.DisplayRole) for i in range(3)])\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: basket\n        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 3), Qt.DisplayRole))\n        self.assertIsNone(data(index(0, 3), Qt.EditRole))\n        self.assertIsNone(data(index(0, 3), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 3), Qt.ForegroundRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ClassValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableStatsRole))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 536,
                                "end_lineno": 611,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 610,
                            "length": 6
                        },
                        "new_range": {
                            "start": 612,
                            "length": 20
                        },
                        "section": "class TestTableModel(unittest.TestCase, dbt):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.assertIsNone(data(index(0, 3), TableModel.VariableRole))",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertIsNone(data(index(0, 3), TableModel.VariableStatsRole))",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        # X: sparse_bool",
                                "type": "added"
                            },
                            {
                                "content": "        table = Table.from_numpy(Domain(table.domain.class_vars, metas=table.domain.attributes),",
                                "type": "added"
                            },
                            {
                                "content": "                                 csr_matrix(table.Y), metas=table.X)",
                                "type": "added"
                            },
                            {
                                "content": "        model = TableModel(table)",
                                "type": "added"
                            },
                            {
                                "content": "        data, index = model.data, model.index",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(\"Iris-setosa\", data(index(0, 1), Qt.DisplayRole))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        # metas: sparse",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",",
                                "type": "added"
                            },
                            {
                                "content": "                         data(index(0, 0), Qt.DisplayRole))",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)",
                                "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/utils/tests/test_itemmodels.py",
                            "type": "class",
                            "name": "TestTableModel",
                            "content": "class TestTableModel(unittest.TestCase, dbt):\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        self.conn, self.iris = self.create_iris_sql_table()\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    @dbt.run_on([\"postgres\", \"mssql\"])\n    def test_dense_data(self):\n        table = SqlTable(self.conn, self.iris, inspect_values=True)\n        table.domain = Domain(table.domain.attributes[:-1],\n                              table.domain.attributes[-1])\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def test_local_dense_data(self):\n        table = Table(\"iris.tab\")\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def _dense_data(self, table, data, index):\n        # Y: categorical\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: continuous\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 1), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 1), Qt.EditRole), Value)\n        self.assertIsNone(data(index(0, 1), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 1), Qt.ForegroundRole))\n        self.assertEqual(table[0, 0], data(index(0, 1), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 1), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[0], data(index(0, 1), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 1), TableModel.VariableStatsRole), BasicStats)\n\n    def test_sparse_data(self):\n        table = Table(test_filename(\"datasets/iris_basket.basket\"))\n        model = TableModel(table)\n        data, index = model.data, model.index\n\n        # Y: 2d\n        self.assertListEqual([table[0, 4], table[0, 5], table[0, 6]],\n                             [data(index(0, i), Qt.DisplayRole) for i in range(3)])\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: sparse\n        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 3), Qt.DisplayRole))\n        self.assertIsNone(data(index(0, 3), Qt.EditRole))\n        self.assertIsNone(data(index(0, 3), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 3), Qt.ForegroundRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ClassValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableStatsRole))\n\n        # X: sparse_bool\n        table = Table.from_numpy(Domain(table.domain.class_vars, metas=table.domain.attributes),\n                                 csr_matrix(table.Y), metas=table.X)\n        model = TableModel(table)\n        data, index = model.data, model.index\n\n        self.assertEqual(\"Iris-setosa\", data(index(0, 1), Qt.DisplayRole))\n\n        # metas: sparse\n        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 0), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 538,
                            "end_lineno": 627,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/widgets/utils/tests/test_itemmodels.py",
                            "type": "method",
                            "name": "TestTableModel.test_sparse_data",
                            "content": "class TestTableModel(unittest.TestCase, dbt):\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        self.conn, self.iris = self.create_iris_sql_table()\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    @dbt.run_on([\"postgres\", \"mssql\"])\n    def test_dense_data(self):\n        table = SqlTable(self.conn, self.iris, inspect_values=True)\n        table.domain = Domain(table.domain.attributes[:-1],\n                              table.domain.attributes[-1])\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def test_local_dense_data(self):\n        table = Table(\"iris.tab\")\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def _dense_data(self, table, data, index):\n        # Y: categorical\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: continuous\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 1), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 1), Qt.EditRole), Value)\n        self.assertIsNone(data(index(0, 1), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 1), Qt.ForegroundRole))\n        self.assertEqual(table[0, 0], data(index(0, 1), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 1), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[0], data(index(0, 1), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 1), TableModel.VariableStatsRole), BasicStats)\n\n    def test_sparse_data(self):\n        table = Table(test_filename(\"datasets/iris_basket.basket\"))\n        model = TableModel(table)\n        data, index = model.data, model.index\n\n        # Y: 2d\n        self.assertListEqual([table[0, 4], table[0, 5], table[0, 6]],\n                             [data(index(0, i), Qt.DisplayRole) for i in range(3)])\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: sparse\n        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 3), Qt.DisplayRole))\n        self.assertIsNone(data(index(0, 3), Qt.EditRole))\n        self.assertIsNone(data(index(0, 3), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 3), Qt.ForegroundRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ClassValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableStatsRole))\n\n        # X: sparse_bool\n        table = Table.from_numpy(Domain(table.domain.class_vars, metas=table.domain.attributes),\n                                 csr_matrix(table.Y), metas=table.X)\n        model = TableModel(table)\n        data, index = model.data, model.index\n\n        self.assertEqual(\"Iris-setosa\", data(index(0, 1), Qt.DisplayRole))\n\n        # metas: sparse\n        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 0), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 586,
                            "end_lineno": 627,
                            "parent": {
                                "file_name": "Orange/widgets/utils/tests/test_itemmodels.py",
                                "type": "class",
                                "name": "TestTableModel",
                                "content": "class TestTableModel(unittest.TestCase, dbt):\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        self.conn, self.iris = self.create_iris_sql_table()\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    @dbt.run_on([\"postgres\", \"mssql\"])\n    def test_dense_data(self):\n        table = SqlTable(self.conn, self.iris, inspect_values=True)\n        table.domain = Domain(table.domain.attributes[:-1],\n                              table.domain.attributes[-1])\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def test_local_dense_data(self):\n        table = Table(\"iris.tab\")\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def _dense_data(self, table, data, index):\n        # Y: categorical\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: continuous\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 1), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 1), Qt.EditRole), Value)\n        self.assertIsNone(data(index(0, 1), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 1), Qt.ForegroundRole))\n        self.assertEqual(table[0, 0], data(index(0, 1), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 1), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[0], data(index(0, 1), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 1), TableModel.VariableStatsRole), BasicStats)\n\n    def test_sparse_data(self):\n        table = Table(test_filename(\"datasets/iris_basket.basket\"))\n        model = TableModel(table)\n        data, index = model.data, model.index\n\n        # Y: 2d\n        self.assertListEqual([table[0, 4], table[0, 5], table[0, 6]],\n                             [data(index(0, i), Qt.DisplayRole) for i in range(3)])\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: sparse\n        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 3), Qt.DisplayRole))\n        self.assertIsNone(data(index(0, 3), Qt.EditRole))\n        self.assertIsNone(data(index(0, 3), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 3), Qt.ForegroundRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ClassValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableStatsRole))\n\n        # X: sparse_bool\n        table = Table.from_numpy(Domain(table.domain.class_vars, metas=table.domain.attributes),\n                                 csr_matrix(table.Y), metas=table.X)\n        model = TableModel(table)\n        data, index = model.data, model.index\n\n        self.assertEqual(\"Iris-setosa\", data(index(0, 1), Qt.DisplayRole))\n\n        # metas: sparse\n        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 0), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 538,
                                "end_lineno": 627,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "a4f624b6f47211df257a00f5195078d0075437c9^",
    "new_commit_hash": "a4f624b6f47211df257a00f5195078d0075437c9",
    "commit_message": "fix sparse metas",
    "commit_date": "2023-03-23T12:32:58+01:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "a4f624b6f47211df257a00f5195078d0075437c9",
    "test_file_codes": [
        "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\nimport unittest\nfrom unittest.mock import patch\n\nfrom scipy.sparse import csr_matrix\n\nfrom AnyQt.QtCore import Qt, QModelIndex\nfrom AnyQt.QtTest import QSignalSpy\nfrom AnyQt.QtGui import QBrush, QColor\n\nfrom orangewidget.tests.base import GuiTest\n\nfrom Orange.data import \\\n    Domain, Table, Value, \\\n    ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable\nfrom Orange.statistics.basic_stats import BasicStats\nfrom Orange.widgets.utils import colorpalettes\nfrom Orange.widgets.utils.itemmodels import \\\n    PyTableModel, PyListModel, PyListModelTooltip,\\\n    VariableListModel, DomainModel, ContinuousPalettesModel, \\\n    TableModel, _as_contiguous_range\nfrom Orange.widgets.gui import TableVariable\nfrom Orange.tests import test_filename\nfrom Orange.tests.sql.base import DataBaseTest as dbt\nfrom Orange.data.sql.table import SqlTable\n\n\nclass TestUtils(unittest.TestCase):\n    def test_as_contiguous_range(self):\n        self.assertEqual(_as_contiguous_range(slice(1, 8), 20), (1, 8, 1))\n        self.assertEqual(_as_contiguous_range(slice(1, 8), 6), (1, 6, 1))\n        self.assertEqual(_as_contiguous_range(slice(8, 1, -1), 6), (2, 6, 1))\n        self.assertEqual(_as_contiguous_range(slice(8), 6), (0, 6, 1))\n        self.assertEqual(_as_contiguous_range(slice(8, None, -1), 6), (0, 6, 1))\n        self.assertEqual(_as_contiguous_range(slice(7, None, -1), 9), (0, 8, 1))\n        self.assertEqual(_as_contiguous_range(slice(None, None, -1), 9),\n                         (0, 9, 1))\n\n\nclass TestPyTableModel(unittest.TestCase):\n    def setUp(self):\n        self.model = PyTableModel([[1, 4],\n                                   [2, 3]])\n\n    def test_init(self):\n        self.model = PyTableModel()\n        self.assertEqual(self.model.rowCount(), 0)\n\n    def test_init_wrap_empty(self):\n        # pylint: disable=protected-access\n        t = []\n        model = PyTableModel(t)\n        self.assertIs(model._table, t)\n        t.append([1, 2, 3])\n        self.assertEqual(list(model), [[1, 2, 3]])\n\n    def test_rowCount(self):\n        self.assertEqual(self.model.rowCount(), 2)\n        self.assertEqual(len(self.model), 2)\n\n    def test_columnCount(self):\n        self.assertEqual(self.model.columnCount(), 2)\n\n    def test_data(self):\n        mi = self.model.index(0, 0)\n        self.assertEqual(self.model.data(mi), '1')\n        self.assertEqual(self.model.data(mi, Qt.EditRole), 1)\n\n    def test_editable(self):\n        editable_model = PyTableModel([[0]], editable=True)\n        self.assertFalse(bool(self.model.flags(self.model.index(0, 0)) & Qt.ItemIsEditable))\n        self.assertTrue(bool(editable_model.flags(editable_model.index(0, 0)) & Qt.ItemIsEditable))\n\n    def test_sort(self):\n        self.model.sort(1)\n        self.assertEqual(self.model.index(0, 0).data(Qt.EditRole), 2)\n\n    def test_setHeaderLabels(self):\n        self.model.setHorizontalHeaderLabels(['Col 1', 'Col 2'])\n        self.assertEqual(self.model.headerData(1, Qt.Horizontal), 'Col 2')\n        self.assertEqual(self.model.headerData(1, Qt.Vertical), 2)\n\n    def test_removeRows(self):\n        self.model.removeRows(0, 1)\n        self.assertEqual(len(self.model), 1)\n        self.assertEqual(self.model[0][1], 3)\n\n    def test_removeColumns(self):\n        self.model.removeColumns(0, 1)\n        self.assertEqual(self.model.columnCount(), 1)\n        self.assertEqual(self.model[1][0], 3)\n\n    def test_insertRows(self):\n        self.model.insertRows(0, 1)\n        self.assertEqual(self.model[1][0], 1)\n\n    def test_insertColumns(self):\n        self.model.insertColumns(0, 1)\n        self.assertEqual(self.model[0], ['', 1, 4])\n\n    def test_wrap(self):\n        self.model.wrap([[0]])\n        self.assertEqual(self.model.rowCount(), 1)\n        self.assertEqual(self.model.columnCount(), 1)\n\n    def test_clear(self):\n        self.model.clear()\n        self.assertEqual(self.model.rowCount(), 0)\n\n    def test_append(self):\n        self.model.append([5, 6])\n        self.assertEqual(self.model[2][1], 6)\n        self.assertEqual(self.model.rowCount(), 3)\n\n    def test_extend(self):\n        self.model.extend([[5, 6]])\n        self.assertEqual(self.model[2][1], 6)\n        self.assertEqual(self.model.rowCount(), 3)\n\n    def test_insert(self):\n        self.model.insert(0, [5, 6])\n        self.assertEqual(self.model[0][1], 6)\n        self.assertEqual(self.model.rowCount(), 3)\n\n    def test_remove(self):\n        self.model.remove([2, 3])\n        self.assertEqual(self.model.rowCount(), 1)\n\n    def test_other_roles(self):\n        self.model.append([2, 3])\n        self.model.setData(self.model.index(2, 0),\n                           Qt.AlignCenter,\n                           Qt.TextAlignmentRole)\n        del self.model[1]\n        self.assertTrue(Qt.AlignCenter &\n                        self.model.data(self.model.index(1, 0),\n                                        Qt.TextAlignmentRole))\n\n    def test_set_iten_slice(self):\n        self.model[:1] = [[10, 11], [12, 13], [14, 15]]\n        self.assertEqual(list(self.model), [[10, 11], [12, 13], [14, 15], [2, 3]])\n\n        self.model[1:3] = []\n        self.assertEqual(list(self.model), [[10, 11], [2, 3]])\n\n        self.model[:] = [[20, 21]]\n        self.assertEqual(list(self.model), [[20, 21]])\n\n        self.model[1:] = [[10, 11], [2, 3]]\n        self.assertEqual(list(self.model), [[20, 21], [10, 11], [2, 3]])\n\n    def test_emits_column_changes_on_row_insert(self):\n        inserted = []\n        removed = []\n        model = PyTableModel()\n        model.columnsInserted.connect(inserted.append)\n        model.columnsRemoved.connect(removed.append)\n        inserted = QSignalSpy(model.columnsInserted)\n        removed = QSignalSpy(model.columnsRemoved)\n        model.append([2])\n        self.assertEqual(list(inserted)[-1][1:], [0, 0])\n        model.append([2, 3])\n        self.assertEqual(list(inserted)[-1][1:], [1, 1])\n        del model[:]\n        self.assertEqual(list(removed)[-1][1:], [0, 1])\n        model.extend([[0, 1], [0, 2]])\n        self.assertEqual(list(inserted)[-1][1:], [0, 1])\n        model.clear()\n        self.assertEqual(list(removed)[-1][1:], [0, 1])\n        model[:] = [[1], [2]]\n        self.assertEqual(list(inserted)[-1][1:], [0, 0])\n\n\nclass TestVariableListModel(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        cls.disc = DiscreteVariable(\"gender\", values=(\"M\", \"F\"))\n        cls.cont = ContinuousVariable(\"age\")\n        cls.string = StringVariable(\"name\")\n        cls.time = TimeVariable(\"birth\")\n        cls.model = VariableListModel([\n            cls.cont, None, \"Foo\", cls.disc, cls.string, cls.time])\n\n    def test_placeholder(self):\n        model = self.model\n        self.assertEqual(model.data(model.index(1)), \"None\")\n        model.placeholder = \"Bar\"\n        self.assertEqual(model.data(model.index(1)), \"Bar\")\n        model.placeholder = \"None\"\n\n    def test_displayrole(self):\n        data, index = self.model.data, self.model.index\n        self.assertEqual(data(index(0)), \"age\")\n        self.assertEqual(data(index(1)), \"None\")\n        self.assertEqual(data(index(2)), \"Foo\")\n        self.assertEqual(data(index(3)), \"gender\")\n        self.assertEqual(data(index(4)), \"name\")\n        self.assertEqual(data(index(5)), \"birth\")\n\n    def test_tooltip(self):\n        def get_tooltip(i):\n            return self.model.data(self.model.index(i), Qt.ToolTipRole)\n\n        text = get_tooltip(0)\n        self.assertIn(\"age\", text)\n        self.assertIn(\"Numeric\", text)\n\n        self.assertIsNone(get_tooltip(1))\n        self.assertIsNone(get_tooltip(2))\n\n        text = get_tooltip(3)\n        self.assertIn(\"gender\", text)\n        self.assertIn(\"M\", text)\n        self.assertIn(\"F\", text)\n        self.assertIn(\"2\", text)\n        self.assertIn(\"Categorical\", text)\n\n        text = get_tooltip(4)\n        self.assertIn(\"name\", text)\n        self.assertIn(\"Text\", text)\n\n        text = get_tooltip(5)\n        self.assertIn(\"birth\", text)\n        self.assertIn(\"Time\", text)\n\n        self.cont.attributes = {\"foo\": \"bar\"}\n        text = get_tooltip(0)\n        self.assertIn(\"foo\", text)\n        self.assertIn(\"bar\", text)\n\n    def test_table_variable(self):\n        self.assertEqual(\n            [self.model.data(self.model.index(i), TableVariable)\n             for i in range(self.model.rowCount())],\n            [self.cont, None, None, self.disc, self.string, self.time])\n\n    def test_other_roles(self):\n        with patch.object(PyListModel, \"data\") as data:\n            index = self.model.index(0)\n            _ = self.model.data(index, Qt.BackgroundRole)\n            self.assertEqual(data.call_args[0][1:], (index, Qt.BackgroundRole))\n\n    def test_invalid_index(self):\n        self.assertIsNone(self.model.data(self.model.index(0).parent()))\n\n\nclass TestDomainModel(unittest.TestCase):\n    def test_init_with_single_section(self):\n        model = DomainModel(order=DomainModel.CLASSES)\n        self.assertEqual(model.order, (DomainModel.CLASSES, ))\n\n    def test_separators(self):\n        attrs = [ContinuousVariable(n) for n in \"abg\"]\n        classes = [ContinuousVariable(n) for n in \"deh\"]\n        metas = [ContinuousVariable(n) for n in \"ijf\"]\n\n        model = DomainModel()\n        sep = [model.Separator]\n        model.set_domain(Domain(attrs, classes, metas))\n        self.assertEqual(list(model), classes + sep + metas + sep + attrs)\n\n        model = DomainModel()\n        model.set_domain(Domain(attrs, [], metas))\n        self.assertEqual(list(model), metas + sep + attrs)\n\n        model = DomainModel()\n        model.set_domain(Domain([], [], metas))\n        self.assertEqual(list(model), metas)\n\n        model = DomainModel(placeholder=\"foo\")\n        model.set_domain(Domain([], [], metas))\n        self.assertEqual(list(model), [None] + sep + metas)\n\n        model = DomainModel(placeholder=\"foo\")\n        model.set_domain(Domain(attrs, [], metas))\n        self.assertEqual(list(model), [None] + sep + metas + sep + attrs)\n\n    def test_placeholder_placement(self):\n        model = DomainModel(placeholder=\"foo\")\n        sep = model.Separator\n        self.assertEqual(model.order, (None, sep) + model.SEPARATED)\n\n        model = DomainModel(order=(\"bar\", ), placeholder=\"foo\")\n        self.assertEqual(model.order, (None, \"bar\"))\n\n        model = DomainModel(order=(\"bar\", None, \"baz\"), placeholder=\"foo\")\n        self.assertEqual(model.order, (\"bar\", None, \"baz\"))\n\n        model = DomainModel(order=(\"bar\", sep, \"baz\"),\n                            placeholder=\"foo\")\n        self.assertEqual(model.order, (None, sep, \"bar\", sep, \"baz\"))\n\n    def test_subparts(self):\n        attrs = [ContinuousVariable(n) for n in \"abg\"]\n        classes = [ContinuousVariable(n) for n in \"deh\"]\n        metas = [ContinuousVariable(n) for n in \"ijf\"]\n\n        m = DomainModel\n        sep = m.Separator\n        model = DomainModel(\n            order=(m.ATTRIBUTES | m.METAS, sep, m.CLASSES))\n        model.set_domain(Domain(attrs, classes, metas))\n        self.assertEqual(list(model), attrs + metas + [sep] + classes)\n\n        m = DomainModel\n        sep = m.Separator\n        model = DomainModel(\n            order=(m.ATTRIBUTES | m.METAS, sep, m.CLASSES),\n            alphabetical=True)\n        model.set_domain(Domain(attrs, classes, metas))\n        self.assertEqual(list(model),\n                         sorted(attrs + metas, key=lambda x: x.name) +\n                         [sep] +\n                         sorted(classes, key=lambda x: x.name))\n\n    def test_filtering(self):\n        cont = [ContinuousVariable(n) for n in \"abc\"]\n        disc = [DiscreteVariable(n) for n in \"def\"]\n        attrs = cont + disc\n\n        model = DomainModel(valid_types=(ContinuousVariable, ))\n        model.set_domain(Domain(attrs))\n        self.assertEqual(list(model), cont)\n\n        model = DomainModel(valid_types=(DiscreteVariable, ))\n        model.set_domain(Domain(attrs))\n        self.assertEqual(list(model), disc)\n\n        disc[0].attributes[\"hidden\"] = True\n        model.set_domain(Domain(attrs))\n        self.assertEqual(list(model), disc[1:])\n\n        model = DomainModel(valid_types=(DiscreteVariable, ),\n                            skip_hidden_vars=False)\n        model.set_domain(Domain(attrs))\n        self.assertEqual(list(model), disc)\n\n    def test_no_separators(self):\n        \"\"\"\n        GH-2697\n        \"\"\"\n        attrs = [ContinuousVariable(n) for n in \"abg\"]\n        classes = [ContinuousVariable(n) for n in \"deh\"]\n        metas = [ContinuousVariable(n) for n in \"ijf\"]\n\n        model = DomainModel(order=DomainModel.SEPARATED, separators=False)\n        model.set_domain(Domain(attrs, classes, metas))\n        self.assertEqual(list(model), classes + metas + attrs)\n\n        model = DomainModel(order=DomainModel.SEPARATED, separators=True)\n        model.set_domain(Domain(attrs, classes, metas))\n        self.assertEqual(\n            list(model),\n            classes + [PyListModel.Separator] + metas + [PyListModel.Separator] + attrs)\n\n    def test_read_only(self):\n        model = DomainModel()\n        domain = Domain([ContinuousVariable(x) for x in \"abc\"])\n        model.set_domain(domain)\n        index = model.index(0, 0)\n\n        self.assertRaises(TypeError, model.append, 42)\n        self.assertRaises(TypeError, model.extend, [42])\n        self.assertRaises(TypeError, model.insert, 0, 42)\n        self.assertRaises(TypeError, model.remove, 0)\n        self.assertRaises(TypeError, model.pop)\n        self.assertRaises(TypeError, model.clear)\n        self.assertRaises(TypeError, model.reverse)\n        self.assertRaises(TypeError, model.sort)\n        with self.assertRaises(TypeError):\n            model[0] = 1\n        with self.assertRaises(TypeError):\n            del model[0]\n\n        self.assertFalse(model.setData(index, domain[0], Qt.EditRole))\n        self.assertTrue(model.setData(index, \"foo\", Qt.ToolTipRole))\n\n        self.assertFalse(model.setItemData(index, {Qt.EditRole: domain[0],\n                                                   Qt.ToolTipRole: \"foo\"}))\n        self.assertTrue(model.setItemData(index, {Qt.ToolTipRole: \"foo\"}))\n\n        self.assertFalse(model.insertRows(0, 1))\n        self.assertEqual(list(model), list(domain.variables))\n        self.assertFalse(model.removeRows(0, 1))\n        self.assertEqual(list(model), list(domain.variables))\n\n\nclass TestContinuousPalettesModel(GuiTest):\n    def setUp(self):\n        self.palette1, self.palette2 = \\\n            list(colorpalettes.ContinuousPalettes.values())[:2]\n\n    def test_all_categories(self):\n        model = ContinuousPalettesModel()\n        shown = {palette.name for palette in model.items\n                 if isinstance(palette, colorpalettes.Palette)}\n        expected = {palette.name\n                    for palette in colorpalettes.ContinuousPalettes.values()}\n        self.assertEqual(expected, shown)\n\n        shown = {name for name in model.items if isinstance(name, str)}\n        expected = {palette.category\n                    for palette in colorpalettes.ContinuousPalettes.values()}\n        self.assertEqual(expected, shown)\n\n    def test_category_selection(self):\n        categories = ('Diverging', 'Linear')\n        model = ContinuousPalettesModel(categories=categories)\n        shown = {palette.name\n                 for palette in model.items\n                 if isinstance(palette, colorpalettes.Palette)}\n        expected = {palette.name\n                    for palette in colorpalettes.ContinuousPalettes.values()\n                    if palette.category in categories}\n        self.assertEqual(expected, shown)\n        self.assertIn(\"Diverging\", model.items)\n        self.assertIn(\"Linear\", model.items)\n\n    def test_single_category(self):\n        category = 'Diverging'\n        model = ContinuousPalettesModel(categories=(category, ))\n        shown = {palette.name\n                 for palette in model.items\n                 if isinstance(palette, colorpalettes.Palette)}\n        expected = {palette.name\n                    for palette in colorpalettes.ContinuousPalettes.values()\n                    if palette.category == category}\n        self.assertEqual(expected, shown)\n        self.assertEqual(len(model.items), len(shown))\n\n    def test_count(self):\n        model = ContinuousPalettesModel()\n        model.items = [self.palette1, self.palette1]\n        self.assertEqual(model.rowCount(QModelIndex()), 2)\n        self.assertEqual(model.columnCount(QModelIndex()), 1)\n\n    def test_data(self):\n        model = ContinuousPalettesModel()\n        model.items = [\"Palettes\", self.palette1, self.palette2]\n        data = model.data\n        index = model.index\n\n        self.assertEqual(data(index(0, 0), Qt.EditRole), \"Palettes\")\n        self.assertEqual(data(index(1, 0), Qt.EditRole),\n                         self.palette1.friendly_name)\n        self.assertEqual(data(index(2, 0), Qt.EditRole),\n                         self.palette2.friendly_name)\n\n        self.assertEqual(data(index(0, 0), Qt.DisplayRole), \"Palettes\")\n        self.assertEqual(data(index(1, 0), Qt.DisplayRole),\n                         self.palette1.friendly_name)\n        self.assertEqual(data(index(2, 0), Qt.DisplayRole),\n                         self.palette2.friendly_name)\n\n        self.assertIsNone(data(index(0, 0), Qt.DecorationRole))\n        with patch.object(self.palette1, \"color_strip\") as color_strip:\n            self.assertIs(data(index(1, 0), Qt.DecorationRole),\n                          color_strip.return_value)\n        with patch.object(self.palette2, \"color_strip\") as color_strip:\n            self.assertIs(data(index(2, 0), Qt.DecorationRole),\n                          color_strip.return_value)\n\n        self.assertIsNone(data(index(0, 0), Qt.UserRole))\n        self.assertIs(data(index(1, 0), Qt.UserRole), self.palette1)\n        self.assertIs(data(index(2, 0), Qt.UserRole), self.palette2)\n\n        self.assertIsNone(data(index(2, 0), Qt.FontRole))\n\n    def test_select_flags(self):\n        model = ContinuousPalettesModel()\n        model.items = [\"Palettes\", self.palette1, self.palette2]\n        self.assertFalse(model.flags(model.index(0, 0)) & Qt.ItemIsSelectable)\n        self.assertTrue(model.flags(model.index(1, 0)) & Qt.ItemIsSelectable)\n        self.assertTrue(model.flags(model.index(2, 0)) & Qt.ItemIsSelectable)\n\n    def testIndexOf(self):\n        model = ContinuousPalettesModel()\n        model.items = [\"Palettes\", self.palette1, self.palette2]\n        self.assertEqual(model.indexOf(self.palette1), 1)\n        self.assertEqual(model.indexOf(self.palette1.name), 1)\n        self.assertEqual(model.indexOf(self.palette1.friendly_name), 1)\n        self.assertEqual(model.indexOf(self.palette2), 2)\n        self.assertEqual(model.indexOf(self.palette2.name), 2)\n        self.assertEqual(model.indexOf(self.palette2.friendly_name), 2)\n        self.assertIsNone(model.indexOf(42))\n\n\nclass TestPyListModelTooltip(GuiTest):\n    def test_tooltips_size(self):\n        def data(i):\n            return model.data(model.index(i, 0))\n\n        def tip(i):\n            return model.data(model.index(i, 0), Qt.ToolTipRole)\n\n        # Not enough tooptips - return None\n        model = PyListModelTooltip([\"foo\", \"bar\", \"baz\"], [\"footip\", \"bartip\"])\n        self.assertEqual(data(1), \"bar\")\n        self.assertEqual(data(2), \"baz\")\n        self.assertIsNone(data(3))\n        self.assertEqual(tip(1), \"bartip\")\n        self.assertIsNone(tip(2))\n\n        # No tooltips\n        model = PyListModelTooltip([\"foo\", \"bar\", \"baz\"])\n        self.assertIsNone(tip(1))\n        self.assertIsNone(tip(2))\n\n        # Too many tooltips\n        model = PyListModelTooltip([\"foo\", \"bar\"], [\"footip\", \"bartip\", \"btip\"])\n        self.assertEqual(data(0), \"foo\")\n        self.assertEqual(data(1), \"bar\")\n        self.assertIsNone(data(2))\n        self.assertEqual(tip(1), \"bartip\")\n        self.assertEqual(tip(2), \"btip\")\n\n    def test_tooltip_arg(self):\n        def tip(i):\n            return model.data(model.index(i, 0), Qt.ToolTipRole)\n\n        # Allow generators\n        s = dict(a=\"ta\", b=\"tb\")\n        model = PyListModelTooltip(s, s.values())\n        self.assertEqual(tip(0), \"ta\")\n        self.assertEqual(tip(1), \"tb\")\n\n        # Basically backward compatibility; this behaviour diverges from\n        # behaviour of data role\n        s = []\n        model = PyListModelTooltip([\"foo\"], s)\n        self.assertIsNone(tip(0))\n\n        s += [\"footip\"]\n        self.assertEqual(tip(1), \"footip\")\n\n\nclass TestTableModel(unittest.TestCase, dbt):\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        self.conn, self.iris = self.create_iris_sql_table()\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    @dbt.run_on([\"postgres\", \"mssql\"])\n    def test_dense_data(self):\n        table = SqlTable(self.conn, self.iris, inspect_values=True)\n        table.domain = Domain(table.domain.attributes[:-1],\n                              table.domain.attributes[-1])\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def test_local_dense_data(self):\n        table = Table(\"iris.tab\")\n        model = TableModel(table)\n\n        self._dense_data(table, model.data, model.index)\n\n    def _dense_data(self, table, data, index):\n        # Y: categorical\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: continuous\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 1), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 0], data(index(0, 1), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 1), Qt.EditRole), Value)\n        self.assertIsNone(data(index(0, 1), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 1), Qt.ForegroundRole))\n        self.assertEqual(table[0, 0], data(index(0, 1), TableModel.ValueRole))\n        self.assertEqual(table[0, 4], data(index(0, 1), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[0], data(index(0, 1), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 1), TableModel.VariableStatsRole), BasicStats)\n\n    def test_sparse_data(self):\n        table = Table(test_filename(\"datasets/iris_basket.basket\"))\n        model = TableModel(table)\n        data, index = model.data, model.index\n\n        # Y: 2d\n        self.assertListEqual([table[0, 4], table[0, 5], table[0, 6]],\n                             [data(index(0, i), Qt.DisplayRole) for i in range(3)])\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n\n        # X: sparse\n        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 3), Qt.DisplayRole))\n        self.assertIsNone(data(index(0, 3), Qt.EditRole))\n        self.assertIsNone(data(index(0, 3), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 3), Qt.ForegroundRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ClassValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableStatsRole))\n\n        # X: sparse_bool\n        table = Table.from_numpy(Domain(table.domain.class_vars, metas=table.domain.attributes),\n                                 csr_matrix(table.Y), metas=table.X)\n        model = TableModel(table)\n        data, index = model.data, model.index\n\n        self.assertEqual(\"Iris-setosa\", data(index(0, 1), Qt.DisplayRole))\n\n        # metas: sparse\n        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 0), Qt.DisplayRole))\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.35.0.dev0+a4f624b to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9\nProcessing dependencies for Orange3==3.35.0.dev0+a4f624b\nSearching for xlsxwriter\nReading https://pypi.org/simple/xlsxwriter/\nDownloading https://files.pythonhosted.org/packages/a7/ea/53d1fe468e63e092cf16e2c18d16f50c29851242f9dd12d6a66e0d7f0d02/XlsxWriter-3.2.0-py3-none-any.whl#sha256=ecfd5405b3e0e228219bcaf24c2ca0915e012ca9464a14048021d21a995d490e\nBest match: XlsxWriter 3.2.0\nProcessing XlsxWriter-3.2.0-py3-none-any.whl\nInstalling XlsxWriter-3.2.0-py3-none-any.whl to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages\nAdding XlsxWriter 3.2.0 to easy-install.pth file\nInstalling vba_extract.py script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/XlsxWriter-3.2.0-py3.7.egg\nSearching for xlrd>=1.2.0\nReading https://pypi.org/simple/xlrd/\nDownloading https://files.pythonhosted.org/packages/a6/0c/c2a72d51fe56e08a08acc85d13013558a2d793028ae7385448a6ccdfae64/xlrd-2.0.1-py2.py3-none-any.whl#sha256=6a33ee89877bd9abc1158129f6e94be74e2679636b8a205b43b85206c3f0bbdd\nBest match: xlrd 2.0.1\nProcessing xlrd-2.0.1-py2.py3-none-any.whl\nInstalling xlrd-2.0.1-py2.py3-none-any.whl to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages\nAdding xlrd 2.0.1 to easy-install.pth file\nInstalling runxlrd.py script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/xlrd-2.0.1-py3.7.egg\nSearching for serverfiles\nReading https://pypi.org/simple/serverfiles/\nDownloading https://files.pythonhosted.org/packages/33/36/794fe1c4ed29b0f56a26d72e956baf0285d8fe9e29faf36797a28a8ad45b/serverfiles-0.3.1.tar.gz#sha256=5e10fc32e758791e3735bc08bce2ed4702a83b1e45ab96c5d59cc8aeecfbebe1\nBest match: serverfiles 0.3.1\nProcessing serverfiles-0.3.1.tar.gz\nWriting /tmp/easy_install-jfb1zy54/serverfiles-0.3.1/setup.cfg\nRunning serverfiles-0.3.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-jfb1zy54/serverfiles-0.3.1/egg-dist-tmp-fkfe74fz\ncreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/serverfiles-0.3.1-py3.7.egg\nExtracting serverfiles-0.3.1-py3.7.egg to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages\nAdding serverfiles 0.3.1 to easy-install.pth file\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/serverfiles-0.3.1-py3.7.egg\nSearching for scipy>=1.9\nReading https://pypi.org/simple/scipy/\nDownloading https://files.pythonhosted.org/packages/d9/7b/2b8ac283cf32465ed08bc20a83d559fe7b174a484781702ba8accea001d6/scipy-1.15.0.tar.gz#sha256=300742e2cc94e36a2880ebe464a1c8b4352a7b0f3e36ec3d2ac006cdbe0219ac\nBest match: scipy 1.15.0\nProcessing scipy-1.15.0.tar.gz\nVerifying Orange installation...\n❌ Orange verification failed\nPython 3.7 installation failed, trying Python 3.8...\nAttempting installation with Python 3.8...\nrunning build_ext\nbuilding 'Orange.classification._tree_scorers' extension\ncreating build/temp.linux-x86_64-cpython-38/Orange/classification\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/include/python3.8 -c Orange/classification/_tree_scorers.c -o build/temp.linux-x86_64-cpython-38/Orange/classification/_tree_scorers.o\ncreating build/lib.linux-x86_64-cpython-38/Orange/classification\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-38/Orange/classification/_tree_scorers.o -L/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-38/Orange/classification/_tree_scorers.cpython-38-x86_64-linux-gnu.so\nbuilding 'Orange.data._contingency' extension\ncreating build/temp.linux-x86_64-cpython-38/Orange/data\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/include/python3.8 -c Orange/data/_contingency.c -o build/temp.linux-x86_64-cpython-38/Orange/data/_contingency.o\ncreating build/lib.linux-x86_64-cpython-38/Orange/data\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-38/Orange/data/_contingency.o -L/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-38/Orange/data/_contingency.cpython-38-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 -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/include/python3.8 -c Orange/data/_io.c -o build/temp.linux-x86_64-cpython-38/Orange/data/_io.o\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-38/Orange/data/_io.o -L/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-38/Orange/data/_io.cpython-38-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 -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/include/python3.8 -c Orange/data/_valuecount.c -o build/temp.linux-x86_64-cpython-38/Orange/data/_valuecount.o\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-38/Orange/data/_valuecount.o -L/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-38/Orange/data/_valuecount.cpython-38-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 -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/include/python3.8 -c Orange/data/_variable.c -o build/temp.linux-x86_64-cpython-38/Orange/data/_variable.o\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-38/Orange/data/_variable.o -L/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-38/Orange/data/_variable.cpython-38-x86_64-linux-gnu.so\nbuilding 'Orange.distance._distance' extension\ncreating build/temp.linux-x86_64-cpython-38/Orange/distance\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/include/python3.8 -c Orange/distance/_distance.c -o build/temp.linux-x86_64-cpython-38/Orange/distance/_distance.o\ncreating build/lib.linux-x86_64-cpython-38/Orange/distance\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-38/Orange/distance/_distance.o -L/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-38/Orange/distance/_distance.cpython-38-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._discretize' extension\ncreating build/temp.linux-x86_64-cpython-38/Orange/preprocess\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/include/python3.8 -c Orange/preprocess/_discretize.c -o build/temp.linux-x86_64-cpython-38/Orange/preprocess/_discretize.o\ncreating build/lib.linux-x86_64-cpython-38/Orange/preprocess\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-38/Orange/preprocess/_discretize.o -L/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-38/Orange/preprocess/_discretize.cpython-38-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._relieff' extension\nc++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/include/python3.8 -c Orange/preprocess/_relieff.cpp -o build/temp.linux-x86_64-cpython-38/Orange/preprocess/_relieff.o\nc++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -pthread -shared build/temp.linux-x86_64-cpython-38/Orange/preprocess/_relieff.o -L/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-38/Orange/preprocess/_relieff.cpython-38-x86_64-linux-gnu.so\nbuilding 'Orange.projection._som' extension\ncreating build/temp.linux-x86_64-cpython-38/Orange/projection\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/include/python3.8 -c Orange/projection/_som.c -o build/temp.linux-x86_64-cpython-38/Orange/projection/_som.o\ncreating build/lib.linux-x86_64-cpython-38/Orange/projection\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-38/Orange/projection/_som.o -L/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-38/Orange/projection/_som.cpython-38-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 -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/include/python3.8 -c Orange/classification/_simple_tree.c -o build/temp.linux-x86_64-cpython-38/Orange/classification/_simple_tree.o\ncc -pthread -shared -Wl,--exclude-libs,ALL build/temp.linux-x86_64-cpython-38/Orange/classification/_simple_tree.o -L/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-38/Orange/classification/_simple_tree.cpython-38-x86_64-linux-gnu.so\nbuilding 'Orange.widgets.utils._grid_density' extension\ncreating build/temp.linux-x86_64-cpython-38/Orange/widgets/utils\nc++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/include/python3.8 -c Orange/widgets/utils/_grid_density.cpp -o build/temp.linux-x86_64-cpython-38/Orange/widgets/utils/_grid_density.o\ncreating build/lib.linux-x86_64-cpython-38/Orange/widgets/utils\nc++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -pthread -shared build/temp.linux-x86_64-cpython-38/Orange/widgets/utils/_grid_density.o -L/home/gcpuser/.local/share/uv/python/cpython-3.8.20-linux-x86_64-gnu/lib -lm -o build/lib.linux-x86_64-cpython-38/Orange/widgets/utils/_grid_density.cpython-38-x86_64-linux-gnu.so\ncopying build/lib.linux-x86_64-cpython-38/Orange/classification/_tree_scorers.cpython-38-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-cpython-38/Orange/data/_contingency.cpython-38-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-38/Orange/data/_io.cpython-38-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-38/Orange/data/_valuecount.cpython-38-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-38/Orange/data/_variable.cpython-38-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-38/Orange/distance/_distance.cpython-38-x86_64-linux-gnu.so -> Orange/distance\ncopying build/lib.linux-x86_64-cpython-38/Orange/preprocess/_discretize.cpython-38-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-cpython-38/Orange/preprocess/_relieff.cpython-38-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-cpython-38/Orange/projection/_som.cpython-38-x86_64-linux-gnu.so -> Orange/projection\ncopying build/lib.linux-x86_64-cpython-38/Orange/classification/_simple_tree.cpython-38-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-cpython-38/Orange/widgets/utils/_grid_density.cpython-38-x86_64-linux-gnu.so -> Orange/widgets/utils\nrunning develop\nrunning 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\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/npy_math.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/npy_math.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/npy_math.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/npy_math.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/npy_math.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayscalars.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/npy_math.h won't be automatically included in the manifest: the path must be relative\ndependency /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ufuncobject.h won't be automatically included in the manifest: the path must be relative\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-cpython-38/Orange/classification/_tree_scorers.cpython-38-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-cpython-38/Orange/data/_contingency.cpython-38-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-38/Orange/data/_io.cpython-38-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-38/Orange/data/_valuecount.cpython-38-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-38/Orange/data/_variable.cpython-38-x86_64-linux-gnu.so -> Orange/data\ncopying build/lib.linux-x86_64-cpython-38/Orange/distance/_distance.cpython-38-x86_64-linux-gnu.so -> Orange/distance\ncopying build/lib.linux-x86_64-cpython-38/Orange/preprocess/_discretize.cpython-38-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-cpython-38/Orange/preprocess/_relieff.cpython-38-x86_64-linux-gnu.so -> Orange/preprocess\ncopying build/lib.linux-x86_64-cpython-38/Orange/projection/_som.cpython-38-x86_64-linux-gnu.so -> Orange/projection\ncopying build/lib.linux-x86_64-cpython-38/Orange/classification/_simple_tree.cpython-38-x86_64-linux-gnu.so -> Orange/classification\ncopying build/lib.linux-x86_64-cpython-38/Orange/widgets/utils/_grid_density.cpython-38-x86_64-linux-gnu.so -> Orange/widgets/utils\nCreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.35.0.dev0+a4f624b to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9\nProcessing dependencies for Orange3==3.35.0.dev0+a4f624b\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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for setuptools==75.3.0\nBest match: setuptools 75.3.0\nAdding setuptools 75.3.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for scipy==1.10.1\nBest match: scipy 1.10.1\nAdding scipy 1.10.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for scikit-learn==1.1.3\nBest match: scikit-learn 1.1.3\nAdding scikit-learn 1.1.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for requests==2.32.3\nBest match: requests 2.32.3\nAdding requests 2.32.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for qtconsole==5.6.1\nBest match: qtconsole 5.6.1\nAdding qtconsole 5.6.1 to easy-install.pth file\nInstalling jupyter-qtconsole script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for PyYAML==6.0.2\nBest match: PyYAML 6.0.2\nAdding PyYAML 6.0.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for pyqtgraph==0.13.3\nBest match: pyqtgraph 0.13.3\nAdding pyqtgraph 0.13.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for pygments==2.19.1\nBest match: pygments 2.19.1\nAdding pygments 2.19.1 to easy-install.pth file\nInstalling pygmentize script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for pip==24.3.1\nBest match: pip 24.3.1\nAdding pip 24.3.1 to easy-install.pth file\nInstalling pip script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for pandas==2.0.3\nBest match: pandas 2.0.3\nAdding pandas 2.0.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for openpyxl==3.1.5\nBest match: openpyxl 3.1.5\nAdding openpyxl 3.1.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for numpy==1.24.4\nBest match: numpy 1.24.4\nAdding numpy 1.24.4 to easy-install.pth file\nInstalling f2py script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\nInstalling f2py3.8 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for networkx==3.1\nBest match: networkx 3.1\nAdding networkx 3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for matplotlib==3.7.5\nBest match: matplotlib 3.7.5\nAdding matplotlib 3.7.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for keyrings.alt==5.0.2\nBest match: keyrings.alt 5.0.2\nAdding keyrings.alt 5.0.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for keyring==25.5.0\nBest match: keyring 25.5.0\nAdding keyring 25.5.0 to easy-install.pth file\nInstalling keyring script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for joblib==1.4.2\nBest match: joblib 1.4.2\nAdding joblib 1.4.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for httpx==0.28.1\nBest match: httpx 0.28.1\nAdding httpx 0.28.1 to easy-install.pth file\nInstalling httpx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for threadpoolctl==3.5.0\nBest match: threadpoolctl 3.5.0\nAdding threadpoolctl 3.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for urllib3==2.2.3\nBest match: urllib3 2.2.3\nAdding urllib3 2.2.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for packaging==24.2\nBest match: packaging 24.2\nAdding packaging 24.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for ipykernel==6.29.5\nBest match: ipykernel 6.29.5\nAdding ipykernel 6.29.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for jupyter-client==8.6.3\nBest match: jupyter-client 8.6.3\nAdding jupyter-client 8.6.3 to easy-install.pth file\nInstalling jupyter-kernel script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\nInstalling jupyter-kernelspec script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\nInstalling jupyter-run script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for jupyter-core==5.7.2\nBest match: jupyter-core 5.7.2\nAdding jupyter-core 5.7.2 to easy-install.pth file\nInstalling jupyter script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\nInstalling jupyter-migrate script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\nInstalling jupyter-troubleshoot script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for traitlets==5.14.3\nBest match: traitlets 5.14.3\nAdding traitlets 5.14.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for tzdata==2024.2\nBest match: tzdata 2024.2\nAdding tzdata 2024.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for typing-extensions==4.12.2\nBest match: typing-extensions 4.12.2\nAdding typing-extensions 4.12.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/setuptools/_vendor\nSearching for qasync==0.27.1\nBest match: qasync 0.27.1\nAdding qasync 0.27.1 to easy-install.pth file\ndetected new path './setuptools/_vendor'\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for requests-cache==1.2.1\nBest match: requests-cache 1.2.1\nAdding requests-cache 1.2.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for et-xmlfile==2.0.0\nBest match: et-xmlfile 2.0.0\nAdding et-xmlfile 2.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for importlib-resources==6.4.5\nBest match: importlib-resources 6.4.5\nAdding importlib-resources 6.4.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for pillow==10.4.0\nBest match: pillow 10.4.0\nAdding pillow 10.4.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for kiwisolver==1.4.7\nBest match: kiwisolver 1.4.7\nAdding kiwisolver 1.4.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for fonttools==4.55.3\nBest match: fonttools 4.55.3\nAdding fonttools 4.55.3 to easy-install.pth file\nInstalling fonttools script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for cycler==0.12.1\nBest match: cycler 0.12.1\nAdding cycler 0.12.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for contourpy==1.1.1\nBest match: contourpy 1.1.1\nAdding contourpy 1.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for jaraco.context==6.0.1\nBest match: jaraco.context 6.0.1\nAdding jaraco.context 6.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for jaraco.classes==3.4.0\nBest match: jaraco.classes 3.4.0\nAdding jaraco.classes 3.4.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for importlib-metadata==8.5.0\nBest match: importlib-metadata 8.5.0\nAdding importlib-metadata 8.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for jaraco.functools==4.1.0\nBest match: jaraco.functools 4.1.0\nAdding jaraco.functools 4.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for httpcore==1.0.7\nBest match: httpcore 1.0.7\nAdding httpcore 1.0.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for anyio==4.5.2\nBest match: anyio 4.5.2\nAdding anyio 4.5.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for tornado==6.4.2\nBest match: tornado 6.4.2\nAdding tornado 6.4.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for matplotlib-inline==0.1.7\nBest match: matplotlib-inline 0.1.7\nAdding matplotlib-inline 0.1.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for ipython==8.12.3\nBest match: ipython 8.12.3\nAdding ipython 8.12.3 to easy-install.pth file\nInstalling ipython script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\nInstalling ipython3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for debugpy==1.8.11\nBest match: debugpy 1.8.11\nAdding debugpy 1.8.11 to easy-install.pth file\nInstalling debugpy script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for comm==0.2.2\nBest match: comm 0.2.2\nAdding comm 0.2.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for platformdirs==4.3.6\nBest match: platformdirs 4.3.6\nAdding platformdirs 4.3.6 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for cattrs==24.1.2\nBest match: cattrs 24.1.2\nAdding cattrs 24.1.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for attrs==24.3.0\nBest match: attrs 24.3.0\nAdding attrs 24.3.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for zipp==3.20.2\nBest match: zipp 3.20.2\nAdding zipp 3.20.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for backports.tarfile==1.2.0\nBest match: backports.tarfile 1.2.0\nbackports.tarfile 1.2.0 is already the active version in easy-install.pth\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/setuptools/_vendor\nSearching for more-itertools==10.5.0\nBest match: more-itertools 10.5.0\nAdding more-itertools 10.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for h11==0.14.0\nBest match: h11 0.14.0\nAdding h11 0.14.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for stack-data==0.6.3\nBest match: stack-data 0.6.3\nAdding stack-data 0.6.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for cffi==1.17.1\nBest match: cffi 1.17.1\nAdding cffi 1.17.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for pure-eval==0.2.3\nBest match: pure-eval 0.2.3\nAdding pure-eval 0.2.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for asttokens==3.0.0\nBest match: asttokens 3.0.0\nAdding asttokens 3.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for executing==2.1.0\nBest match: executing 2.1.0\nAdding executing 2.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nSearching for pycparser==2.22\nBest match: pycparser 2.22\nAdding pycparser 2.22 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages\nFinished processing dependencies for Orange3==3.35.0.dev0+a4f624b\nVerifying Orange installation...\n✅ Orange installation successful!\nSuccessfully installed orange using Python 3.8\n",
    "setup_res_stderr": "Using CPython 3.7.9\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nResolved 18 packages in 194ms\nPrepared 18 packages in 1ms\nInstalled 18 packages in 183ms\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\n  × No solution found when resolving dependencies:\n  ╰─▶ Because the current Python version (3.7.9) does not satisfy Python>=3.8 and all of:\n          scipy>=1.9.0,<=1.9.1\n          scipy>=1.10.0,<=1.10.1\n      depend on Python>=3.8,<3.12, we can conclude that all of:\n          scipy>=1.9.0,<=1.9.1\n          scipy>=1.10.0,<=1.10.1\n       cannot be used.\n      And because only the following versions of scipy are available:\n          scipy<=1.9.0\n          scipy==1.9.1\n          scipy==1.9.2\n          scipy==1.9.3\n          scipy==1.10.0\n          scipy==1.10.1\n          scipy==1.11.0\n          scipy==1.11.1\n          scipy==1.11.2\n          scipy==1.11.3\n          scipy==1.11.4\n          scipy==1.12.0\n          scipy==1.13.0\n          scipy==1.13.1\n          scipy==1.14.0\n          scipy==1.14.1\n          scipy==1.15.0\n      we can conclude that all of:\n          scipy>=1.9.0,<1.9.2\n          scipy>1.9.3,<1.11.0\n       cannot be used. (1)\n\n      Because the current Python version (3.7.9) does not satisfy Python>=3.8 and scipy>=1.9.2,<=1.9.3 depends on Python>=3.8,\n      we can conclude that scipy>=1.9.2,<=1.9.3 cannot be used.\n      And because we know from (1) that all of:\n          scipy>=1.9.0,<1.9.2\n          scipy>1.9.3,<1.11.0\n       cannot be used, we can conclude that scipy>=1.9.0,<1.11.0 cannot be used.\n      And because scipy==1.11.0 was yanked (reason: License Violation), we can conclude that scipy>=1.9.0,<1.11.1 cannot be\n      used. (2)\n\n      Because the current Python version (3.7.9) does not satisfy Python>=3.8 and scipy>=1.11.1,<=1.11.3 depends on\n      Python>=3.9,<3.13, we can conclude that scipy>=1.11.1,<=1.11.3 cannot be used.\n      And because we know from (2) that scipy>=1.9.0,<1.11.1 cannot be used, we can conclude that scipy>=1.9.0,<1.11.4 cannot\n      be used. (3)\n\n      Because the current Python version (3.7.9) does not satisfy Python>=3.8 and scipy>=1.11.4,<=1.13.1 depends on\n      Python>=3.9, we can conclude that scipy>=1.11.4,<=1.13.1 cannot be used.\n      And because we know from (3) that scipy>=1.9.0,<1.11.4 cannot be used, we can conclude that scipy>=1.9.0,<1.14.0 cannot\n      be used. (4)\n\n      Because the current Python version (3.7.9) does not satisfy Python>=3.8 and scipy>=1.14.0 depends on Python>=3.10, we can\n      conclude that scipy>=1.14.0 cannot be used.\n      And because we know from (4) that scipy>=1.9.0,<1.14.0 cannot be used, we can conclude that scipy>=1.9.0 cannot be used.\n      And because you require scipy>=1.9, we can conclude that your requirements are unsatisfiable.\n\n      hint: Pre-releases are available for `scipy` in the requested range (e.g., 1.15.0rc2), but pre-releases weren't enabled\n      (try: `--prerelease=allow`)\n  × No solution found when resolving dependencies:\n  ╰─▶ Because the current Python version (3.7.9) does not satisfy Python>=3.8 and pyqtgraph>=0.13.1,<=0.13.3 depends on\n      Python>=3.8, we can conclude that pyqtgraph>=0.13.1,<=0.13.3 cannot be used.\n      And because only the following versions of pyqtgraph are available:\n          pyqtgraph<=0.13.1\n          pyqtgraph==0.13.2\n          pyqtgraph==0.13.3\n          pyqtgraph==0.13.4\n          pyqtgraph==0.13.5\n          pyqtgraph==0.13.6\n          pyqtgraph==0.13.7\n      we can conclude that pyqtgraph>=0.13.1,<0.13.4 cannot be used. (1)\n\n      Because the current Python version (3.7.9) does not satisfy Python>=3.9 and pyqtgraph>=0.13.4 depends on Python>=3.9, we\n      can conclude that pyqtgraph>=0.13.4 cannot be used.\n      And because we know from (1) that pyqtgraph>=0.13.1,<0.13.4 cannot be used, we can conclude that pyqtgraph>=0.13.1 cannot\n      be used.\n      And because you require pyqtgraph>=0.13.1, we can conclude that your requirements are unsatisfiable.\nResolved 2 packages in 10ms\nInstalled 2 packages in 15ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nResolved 19 packages in 286ms\nInstalled 16 packages in 2.15s\n + catboost==1.2.7\n + cycler==0.11.0\n + fonttools==4.38.0\n + graphviz==0.20.1\n + kiwisolver==1.4.5\n + matplotlib==3.5.3\n + pandas==1.3.5\n + pillow==9.5.0\n + plotly==5.18.0\n + pyparsing==3.1.4\n + python-dateutil==2.9.0.post0\n + pytz==2024.2\n + scipy==1.7.3\n + six==1.17.0\n + tenacity==8.2.3\n + xgboost==1.6.2\nResolved 5 packages in 49ms\nInstalled 3 packages in 104ms\n + joblib==1.3.2\n + scikit-learn==1.0.2\n + threadpoolctl==3.1.0\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.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:3427:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 3427 |   __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:4883:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 4883 |   __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:5629:43: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5629 |           for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {\n      |                                           ^\nOrange/classification/_tree_scorers.c:5750:39: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5750 |           __pyx_t_20 = ((__pyx_v_left >= __pyx_v_min_leaf) != 0);\n      |                                       ^~\nOrange/classification/_tree_scorers.c:5756:53: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5756 |           __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:7217:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7217 |         for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_16compute_predictions_csc’:\nOrange/classification/_tree_scorers.c:7874:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7874 |         for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c:7934:150: warning: comparison of integer expressions of different signedness: ‘__pyx_t_5numpy_int32_t’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]\n 7934 |               __pyx_t_16 = (((*((__pyx_t_5numpy_int32_t const  *) ( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_15 * __pyx_v_indices.strides[0]) ))) != __pyx_v_i) != 0);\n      |                                                                                                                                                      ^~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.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_a4f624b6f47211df257a00f5195078d0075437c9/.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 '*.svg' under directory 'Orange/canvas'\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 '*.svg' under directory 'distribute'\nwarning: no files found matching 'COPYING'\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/pkg_resources/__init__.py:119: PkgResourcesDeprecationWarning:  is an invalid version and will not be supported in a future release\n  PkgResourcesDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.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,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.7/site-packages/pkg_resources/__init__.py:119: PkgResourcesDeprecationWarning:  is an invalid version and will not be supported in a future release\n  PkgResourcesDeprecationWarning,\nerror: Couldn't find a setup script in /tmp/easy_install-ju7_rw8z/scipy-1.15.0.tar.gz\nUsing CPython 3.8.20\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nResolved 15 packages in 127ms\nPrepared 15 packages in 1ms\nInstalled 15 packages in 75ms\n + cython==0.29.37\n + exceptiongroup==1.2.2\n + iniconfig==2.0.0\n + numpy==1.24.4\n + packaging==24.2\n + pluggy==1.5.0\n + pyqt5==5.15.11\n + pyqt5-qt5==5.15.16\n + pyqt5-sip==12.15.0\n + pyqtwebengine==5.15.7\n + pyqtwebengine-qt5==5.15.16\n + pytest==8.3.4\n + setuptools==75.3.0\n + tomli==2.2.1\n + wheel==0.45.1\nResolved 59 packages in 81ms\nInstalled 55 packages in 172ms\n + anyio==4.5.2\n + backports-tarfile==1.2.0\n + baycomp==1.0.3\n + bottleneck==1.4.0\n + certifi==2024.12.14\n + cffi==1.17.1\n + chardet==5.2.0\n + charset-normalizer==3.4.1\n + contourpy==1.1.1\n + cryptography==44.0.0\n + cycler==0.12.1\n + et-xmlfile==2.0.0\n + fonttools==4.55.3\n + h11==0.14.0\n + httpcore==1.0.7\n + httpx==0.28.1\n + idna==3.10\n + importlib-metadata==8.5.0\n + importlib-resources==6.4.5\n + jaraco-classes==3.4.0\n + jaraco-context==6.0.1\n + jaraco-functools==4.1.0\n + jeepney==0.8.0\n + joblib==1.4.2\n + keyring==25.5.0\n + keyrings-alt==5.0.2\n + kiwisolver==1.4.7\n + matplotlib==3.7.5\n + more-itertools==10.5.0\n + networkx==3.1\n + openpyxl==3.1.5\n + opentsne==1.0.1\n + pandas==2.0.3\n + pillow==10.4.0\n + pip==24.3.1\n + pycparser==2.22\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.2\n + requests==2.32.3\n + scikit-learn==1.1.3\n + scipy==1.10.1\n + secretstorage==3.3.3\n + serverfiles==0.3.1\n + six==1.17.0\n + sniffio==1.3.1\n + threadpoolctl==3.5.0\n + typing-extensions==4.12.2\n + tzdata==2024.2\n + urllib3==2.2.3\n + xlrd==2.0.1\n + xlsxwriter==3.2.0\n + zipp==3.20.2\nResolved 64 packages in 59ms\nInstalled 41 packages in 97ms\n + anyqt==0.2.0\n + asttokens==3.0.0\n + attrs==24.3.0\n + backcall==0.2.0\n + cattrs==24.1.2\n + comm==0.2.2\n + commonmark==0.9.1\n + debugpy==1.8.11\n + decorator==5.1.1\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + executing==2.1.0\n + ipykernel==6.29.5\n + ipython==8.12.3\n + jedi==0.19.2\n + jupyter-client==8.6.3\n + jupyter-core==5.7.2\n + matplotlib-inline==0.1.7\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.3.6\n + prompt-toolkit==3.0.48\n + psutil==6.1.1\n + ptyprocess==0.7.0\n + pure-eval==0.2.3\n + pygments==2.19.1\n + pyqtgraph==0.13.3\n + pyzmq==26.2.0\n + qasync==0.27.1\n + qtconsole==5.6.1\n + qtpy==2.4.2\n + requests-cache==1.2.1\n + stack-data==0.6.3\n + tornado==6.4.2\n + traitlets==5.14.3\n + url-normalize==1.4.3\n + wcwidth==0.2.13\nResolved 2 packages in 9ms\nInstalled 2 packages in 18ms\n + psycopg2==2.9.10\n + pymssql==2.3.2\nResolved 23 packages in 14ms\nInstalled 6 packages in 653ms\n + catboost==1.2.7\n + graphviz==0.20.3\n + nvidia-nccl-cu12==2.24.3\n + plotly==5.24.1\n + tenacity==9.0.0\n + xgboost==2.1.3\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1940,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:5,\n                 from Orange/classification/_tree_scorers.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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:3427:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 3427 |   __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:4883:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 4883 |   __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:5629:43: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5629 |           for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {\n      |                                           ^\nOrange/classification/_tree_scorers.c:5750:39: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5750 |           __pyx_t_20 = ((__pyx_v_left >= __pyx_v_min_leaf) != 0);\n      |                                       ^~\nOrange/classification/_tree_scorers.c:5756:53: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5756 |           __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:7217:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7217 |         for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_16compute_predictions_csc’:\nOrange/classification/_tree_scorers.c:7874:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7874 |         for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c:7934:150: warning: comparison of integer expressions of different signedness: ‘__pyx_t_5numpy_int32_t’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]\n 7934 |               __pyx_t_16 = (((*((__pyx_t_5numpy_int32_t const  *) ( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_15 * __pyx_v_indices.strides[0]) ))) != __pyx_v_i) != 0);\n      |                                                                                                                                                      ^~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1940,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:5,\n                 from Orange/data/_contingency.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1940,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:5,\n                 from Orange/data/_valuecount.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1940,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:5,\n                 from Orange/distance/_distance.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1940,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:5,\n                 from Orange/preprocess/_discretize.c:774:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1940,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:5,\n                 from Orange/preprocess/_relieff.cpp:790:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1940,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:5,\n                 from Orange/projection/_som.c:775:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/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_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/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/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_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/setuptools/_distutils/dist.py:261: UserWarning: Unknown distribution option: 'test_suite'\n  warnings.warn(msg)\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/setuptools/_distutils/dist.py:261: UserWarning: Unknown distribution option: 'test_suite'\n  warnings.warn(msg)\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/setuptools/command/develop.py:41: EasyInstallDeprecationWarning: easy_install command is deprecated.\n!!\n\n        ********************************************************************************\n        Please avoid running ``setup.py`` and ``easy_install``.\n        Instead, use pypa/build, pypa/installer or other\n        standards-based tools.\n\n        See https://github.com/pypa/setuptools/issues/917 for details.\n        ********************************************************************************\n\n!!\n  easy_install.initialize_options(self)\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/.venv/lib/python3.8/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.\n!!\n\n        ********************************************************************************\n        Please avoid running ``setup.py`` directly.\n        Instead, use pypa/build, pypa/installer or other\n        standards-based tools.\n\n        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.\n        ********************************************************************************\n\n!!\n  self.initialize_options()\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 '*.svg' under directory 'Orange/canvas'\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 '*.svg' under directory 'distribute'\nwarning: no files found matching 'COPYING'\n",
    "new_commit_res_code": 1,
    "new_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.8.20, pytest-8.3.4, pluggy-1.5.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9\nconfigfile: pyproject.toml\nplugins: anyio-4.5.2, typeguard-4.3.0\ncollected 49 items\n\nr2e_tests/test_1.py E............................................ss..    [100%]\n\n==================================== ERRORS ====================================\n_______________________ ERROR at setup of test_filename ________________________\nfile /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/Orange/tests/__init__.py, line 68\n  def test_filename(path):\nE       fixture 'path' not found\n>       available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory\n>       use 'pytest --fixtures [testpath]' for help on them.\n\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/Orange/tests/__init__.py:68\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestUtils::test_as_contiguous_range\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_append\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_clear\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_columnCount\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_data\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_editable\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_emits_column_changes_on_row_insert\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_extend\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_init\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_init_wrap_empty\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_insert\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_insertColumns\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_insertRows\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_other_roles\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_remove\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_removeColumns\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_removeRows\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_rowCount\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_setHeaderLabels\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_set_iten_slice\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_sort\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_wrap\nPASSED r2e_tests/test_1.py::TestVariableListModel::test_displayrole\nPASSED r2e_tests/test_1.py::TestVariableListModel::test_invalid_index\nPASSED r2e_tests/test_1.py::TestVariableListModel::test_other_roles\nPASSED r2e_tests/test_1.py::TestVariableListModel::test_placeholder\nPASSED r2e_tests/test_1.py::TestVariableListModel::test_table_variable\nPASSED r2e_tests/test_1.py::TestVariableListModel::test_tooltip\nPASSED r2e_tests/test_1.py::TestDomainModel::test_filtering\nPASSED r2e_tests/test_1.py::TestDomainModel::test_init_with_single_section\nPASSED r2e_tests/test_1.py::TestDomainModel::test_no_separators\nPASSED r2e_tests/test_1.py::TestDomainModel::test_placeholder_placement\nPASSED r2e_tests/test_1.py::TestDomainModel::test_read_only\nPASSED r2e_tests/test_1.py::TestDomainModel::test_separators\nPASSED r2e_tests/test_1.py::TestDomainModel::test_subparts\nPASSED r2e_tests/test_1.py::TestContinuousPalettesModel::testIndexOf\nPASSED r2e_tests/test_1.py::TestContinuousPalettesModel::test_all_categories\nPASSED r2e_tests/test_1.py::TestContinuousPalettesModel::test_category_selection\nPASSED r2e_tests/test_1.py::TestContinuousPalettesModel::test_count\nPASSED r2e_tests/test_1.py::TestContinuousPalettesModel::test_data\nPASSED r2e_tests/test_1.py::TestContinuousPalettesModel::test_select_flags\nPASSED r2e_tests/test_1.py::TestContinuousPalettesModel::test_single_category\nPASSED r2e_tests/test_1.py::TestPyListModelTooltip::test_tooltip_arg\nPASSED r2e_tests/test_1.py::TestPyListModelTooltip::test_tooltips_size\nPASSED r2e_tests/test_1.py::TestTableModel::test_local_dense_data\nPASSED r2e_tests/test_1.py::TestTableModel::test_sparse_data\nSKIPPED [1] r2e_tests/test_1.py:546: No connection provided for mssql\nSKIPPED [1] r2e_tests/test_1.py:546: No connection provided for postgres\nERROR r2e_tests/test_1.py::test_filename\n==================== 46 passed, 2 skipped, 1 error in 2.59s ====================\nWidgets left: 0    Max widgets: 0 \n\n",
    "new_commit_res_stderr": "",
    "old_commit_res_code": 1,
    "old_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.8.20, pytest-8.3.4, pluggy-1.5.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9\nconfigfile: pyproject.toml\nplugins: anyio-4.5.2, typeguard-4.3.0\ncollected 49 items\n\nr2e_tests/test_1.py E............................................ss.F    [100%]\n\n==================================== ERRORS ====================================\n_______________________ ERROR at setup of test_filename ________________________\nfile /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/Orange/tests/__init__.py, line 68\n  def test_filename(path):\nE       fixture 'path' not found\n>       available fixtures: anyio_backend, anyio_backend_name, anyio_backend_options, cache, capfd, capfdbinary, caplog, capsys, capsysbinary, doctest_namespace, monkeypatch, pytestconfig, record_property, record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory\n>       use 'pytest --fixtures [testpath]' for help on them.\n\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_a4f624b6f47211df257a00f5195078d0075437c9/Orange/tests/__init__.py:68\n=================================== FAILURES ===================================\n_______________________ TestTableModel.test_sparse_data ________________________\n\nself = <r2e_tests.test_1.TestTableModel testMethod=test_sparse_data>\n\n    def test_sparse_data(self):\n        table = Table(test_filename(\"datasets/iris_basket.basket\"))\n        model = TableModel(table)\n        data, index = model.data, model.index\n    \n        # Y: 2d\n        self.assertListEqual([table[0, 4], table[0, 5], table[0, 6]],\n                             [data(index(0, i), Qt.DisplayRole) for i in range(3)])\n        self.assertIsInstance(data(index(0, 0), Qt.DisplayRole), str)\n        self.assertEqual(table[0, 4], data(index(0, 0), Qt.EditRole))\n        self.assertIsInstance(data(index(0, 0), Qt.EditRole), Value)\n        self.assertIsInstance(data(index(0, 0), Qt.BackgroundRole), QBrush)\n        self.assertIsInstance(data(index(0, 0), Qt.ForegroundRole), QColor)\n        self.assertEqual(table[0, 4], data(index(0, 0), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 0), TableModel.ClassValueRole))\n        self.assertEqual(table.domain[4], data(index(0, 0), TableModel.VariableRole))\n        self.assertIsInstance(data(index(0, 0), TableModel.VariableStatsRole), BasicStats)\n    \n        # X: sparse\n        self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 3), Qt.DisplayRole))\n        self.assertIsNone(data(index(0, 3), Qt.EditRole))\n        self.assertIsNone(data(index(0, 3), Qt.BackgroundRole))\n        self.assertIsNone(data(index(0, 3), Qt.ForegroundRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.ClassValueRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableRole))\n        self.assertIsNone(data(index(0, 3), TableModel.VariableStatsRole))\n    \n        # X: sparse_bool\n        table = Table.from_numpy(Domain(table.domain.class_vars, metas=table.domain.attributes),\n                                 csr_matrix(table.Y), metas=table.X)\n        model = TableModel(table)\n        data, index = model.data, model.index\n    \n        self.assertEqual(\"Iris-setosa\", data(index(0, 1), Qt.DisplayRole))\n    \n        # metas: sparse\n>       self.assertEqual(\"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\",\n                         data(index(0, 0), Qt.DisplayRole))\nE       AssertionError: 'sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2' != 'sepal_length=1'\nE       - sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2\nE       + sepal_length=1\n\nr2e_tests/test_1.py:624: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestUtils::test_as_contiguous_range\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_append\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_clear\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_columnCount\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_data\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_editable\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_emits_column_changes_on_row_insert\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_extend\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_init\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_init_wrap_empty\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_insert\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_insertColumns\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_insertRows\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_other_roles\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_remove\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_removeColumns\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_removeRows\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_rowCount\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_setHeaderLabels\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_set_iten_slice\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_sort\nPASSED r2e_tests/test_1.py::TestPyTableModel::test_wrap\nPASSED r2e_tests/test_1.py::TestVariableListModel::test_displayrole\nPASSED r2e_tests/test_1.py::TestVariableListModel::test_invalid_index\nPASSED r2e_tests/test_1.py::TestVariableListModel::test_other_roles\nPASSED r2e_tests/test_1.py::TestVariableListModel::test_placeholder\nPASSED r2e_tests/test_1.py::TestVariableListModel::test_table_variable\nPASSED r2e_tests/test_1.py::TestVariableListModel::test_tooltip\nPASSED r2e_tests/test_1.py::TestDomainModel::test_filtering\nPASSED r2e_tests/test_1.py::TestDomainModel::test_init_with_single_section\nPASSED r2e_tests/test_1.py::TestDomainModel::test_no_separators\nPASSED r2e_tests/test_1.py::TestDomainModel::test_placeholder_placement\nPASSED r2e_tests/test_1.py::TestDomainModel::test_read_only\nPASSED r2e_tests/test_1.py::TestDomainModel::test_separators\nPASSED r2e_tests/test_1.py::TestDomainModel::test_subparts\nPASSED r2e_tests/test_1.py::TestContinuousPalettesModel::testIndexOf\nPASSED r2e_tests/test_1.py::TestContinuousPalettesModel::test_all_categories\nPASSED r2e_tests/test_1.py::TestContinuousPalettesModel::test_category_selection\nPASSED r2e_tests/test_1.py::TestContinuousPalettesModel::test_count\nPASSED r2e_tests/test_1.py::TestContinuousPalettesModel::test_data\nPASSED r2e_tests/test_1.py::TestContinuousPalettesModel::test_select_flags\nPASSED r2e_tests/test_1.py::TestContinuousPalettesModel::test_single_category\nPASSED r2e_tests/test_1.py::TestPyListModelTooltip::test_tooltip_arg\nPASSED r2e_tests/test_1.py::TestPyListModelTooltip::test_tooltips_size\nPASSED r2e_tests/test_1.py::TestTableModel::test_local_dense_data\nSKIPPED [1] r2e_tests/test_1.py:546: No connection provided for mssql\nSKIPPED [1] r2e_tests/test_1.py:546: No connection provided for postgres\nERROR r2e_tests/test_1.py::test_filename\nFAILED r2e_tests/test_1.py::TestTableModel::test_sparse_data - AssertionError...\n=============== 1 failed, 45 passed, 2 skipped, 1 error in 2.02s ===============\nWidgets left: 0    Max widgets: 0 \n\n",
    "old_commit_res_stderr": ""
}
Orange/widgets/utils/itemmodels.py Orange/widgets/utils/tests/test_itemmodels.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** Incomplete Display of Sparse Metas Results in Truncated Meta Information

**Description:**
When working with tables that include sparse metas, the meta information displayed is incomplete. Instead of showing the full meta data, such as `"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2"`, only a partial string like `"sepal_length=1"` is displayed.

**Example Code:**
```python
from Orange.data import Table
from Orange.widgets.utils.itemmodels import TableModel
from AnyQt.QtCore import Qt

# Create a table with sparse metas
table = Table.from_numpy(
    Domain(class_vars=table.domain.class_vars, metas=table.domain.attributes),
    csr_matrix(table.Y),
    metas=table.X
)
model = TableModel(table)
data, index = model.data, model.index

# Attempt to retrieve and display meta information
display_meta = data(index(0, 3), Qt.DisplayRole)
print(display_meta)  # Outputs: "sepal_length=1" instead of the full string
```

**Expected Behavior:**
All meta information should be fully displayed without any truncation when using sparse metas. For example, the output should be `"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2"`.

**Actual Behavior:**
The meta information is partially displayed, resulting in incomplete data such as `"sepal_length=1"`, which hinders the ability to view full meta details.

[/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/utils/itemmodels.py
from numbers import Number, Integral
from math import isnan, isinf

import operator
from collections import namedtuple, defaultdict
from collections.abc import Sequence
from contextlib import contextmanager
from functools import reduce, partial, wraps
from itertools import chain
from warnings import warn
from xml.sax.saxutils import escape

from AnyQt.QtCore import (
    Qt, QObject, QAbstractListModel, QModelIndex,
    QItemSelectionModel, QItemSelection)
from AnyQt.QtCore import pyqtSignal as Signal
from AnyQt.QtGui import QColor, QBrush
from AnyQt.QtWidgets import (
    QWidget, QBoxLayout, QToolButton, QAbstractButton, QAction
)

import numpy

from orangewidget.utils.itemmodels import (
    PyListModel, AbstractSortTableModel as _AbstractSortTableModel
)

from Orange.widgets.utils.colorpalettes import ContinuousPalettes, ContinuousPalette
from Orange.data import Value, Variable, Storage, DiscreteVariable, ContinuousVariable
from Orange.data.domain import filter_visible
from Orange.widgets import gui
from Orange.widgets.utils import datacaching
from Orange.statistics import basic_stats
from Orange.util import deprecated

__all__ = [
    "PyListModel", "VariableListModel", "PyListModelTooltip", "DomainModel",
    "AbstractSortTableModel", "PyTableModel", "TableModel",
    "ModelActionsWidget", "ListSingleSelectionModel"
]

@contextmanager
def signal_blocking(obj):
    blocked = obj.signalsBlocked()
    obj.blockSignals(True)
    try:
        yield
    finally:
        obj.blockSignals(blocked)


def _as_contiguous_range(the_slice, length):
    start, stop, step = the_slice.indices(length)
    if step == -1:
        # Equivalent range with positive step
        start, stop, step = stop + 1, start + 1, 1
    elif not (step == 1 or step is None):
        raise IndexError("Non-contiguous range.")
    return start, stop, step


class AbstractSortTableModel(_AbstractSortTableModel):
    # these were defined on TableModel below. When the AbstractSortTableModel
    # was extracted and made a base of TableModel these deprecations were
    # misplaced, they belong in TableModel.
    @deprecated('Orange.widgets.utils.itemmodels.AbstractSortTableModel.mapFromSourceRows')
    def mapFromTableRows(self, rows):
        return self.mapFromSourceRows(rows)

    @deprecated('Orange.widgets.utils.itemmodels.AbstractSortTableModel.mapToSourceRows')
    def mapToTableRows(self, rows):
        return self.mapToSourceRows(rows)


class PyTableModel(AbstractSortTableModel):
    """ A model for displaying python tables (sequences of sequences) in
    QTableView objects.

    Parameters
    ----------
    sequence : list
        The initial list to wrap.
    parent : QObject
        Parent QObject.
    editable: bool or sequence
        If True, all items are flagged editable. If sequence, the True-ish
        fields mark their respective columns editable.

    Notes
    -----
    The model rounds numbers to human readable precision, e.g.:
    1.23e-04, 1.234, 1234.5, 12345, 1.234e06.

    To set additional item roles, use setData().
    """

    @staticmethod
    def _RoleData():
        return defaultdict(lambda: defaultdict(dict))

    # All methods are either necessary overrides of super methods, or
    # methods likened to the Python list's. Hence, docstrings aren't.
    # pylint: disable=missing-docstring
    def __init__(self, sequence=None, parent=None, editable=False):
        super().__init__(parent)
        self._rows = self._cols = 0
        self._headers = {}
        self._editable = editable
        self._table = None
        self._roleData = {}
        if sequence is None:
            sequence = []
        self.wrap(sequence)

    def rowCount(self, parent=QModelIndex()):
        return 0 if parent.isValid() else self._rows

    def columnCount(self, parent=QModelIndex()):
        return 0 if parent.isValid() else self._cols

    def flags(self, index):
        flags = super().flags(index)
        if not self._editable or not index.isValid():
            return flags
        if isinstance(self._editable, Sequence):
            return flags | Qt.ItemIsEditable if self._editable[index.column()] else flags
        return flags | Qt.ItemIsEditable

    def setData(self, index, value, role):
        row = self.mapFromSourceRows(index.row())
        if role == Qt.EditRole:
            self[row][index.column()] = value
            self.dataChanged.emit(index, index)
        else:
            self._roleData[row][index.column()][role] = value
        return True

    def data(self, index, role=Qt.DisplayRole):
        if not index.isValid():
            return

        row, column = self.mapToSourceRows(index.row()), index.column()

        role_value = self._roleData.get(row, {}).get(column, {}).get(role)
        if role_value is not None:
            return role_value

        try:
            value = self[row][column]
        except IndexError:
            return
        if role == Qt.EditRole:
            return value
        if role == Qt.DecorationRole and isinstance(value, Variable):
            return gui.attributeIconDict[value]
        if role == Qt.DisplayRole:
            if (isinstance(value, Number) and
                    not (isnan(value) or isinf(value) or isinstance(value, Integral))):
                absval = abs(value)
                strlen = len(str(int(absval)))
                value = '{:.{}{}}'.format(value,
                                          2 if absval < .001 else
                                          3 if strlen < 2 else
                                          1 if strlen < 5 else
                                          0 if strlen < 6 else
                                          3,
                                          'f' if (absval == 0 or
                                                  absval >= .001 and
                                                  strlen < 6)
                                          else 'e')
            return str(value)
        if role == Qt.TextAlignmentRole and isinstance(value, Number):
            return Qt.AlignRight | Qt.AlignVCenter
        if role == Qt.ToolTipRole:
            return str(value)

    def sortColumnData(self, column):
        return [row[column] for row in self._table]

    def setHorizontalHeaderLabels(self, labels):
        """
        Parameters
        ----------
        labels : list of str or list of Variable
        """
        self._headers[Qt.Horizontal] = tuple(labels)

    def setVerticalHeaderLabels(self, labels):
        """
        Parameters
        ----------
        labels : list of str or list of Variable
        """
        self._headers[Qt.Vertical] = tuple(labels)

    def headerData(self, section, orientation, role=Qt.DisplayRole):
        headers = self._headers.get(orientation)

        if headers and section < len(headers):
            section = self.mapToSourceRows(section) if orientation == Qt.Vertical else section
            value = headers[section]

            if role == Qt.ToolTipRole:
                role = Qt.DisplayRole

            if role == Qt.DisplayRole:
                return value.name if isinstance(value, Variable) else value

            if role == Qt.DecorationRole:
                if isinstance(value, Variable):
                    return gui.attributeIconDict[value]

        # Use QAbstractItemModel default for non-existent header/sections
        return super().headerData(section, orientation, role)

    def removeRows(self, row, count, parent=QModelIndex()):
        if not parent.isValid():
            del self[row:row + count]
            for rowidx in range(row, row + count):
                self._roleData.pop(rowidx, None)
            self._rows = self._table_dim()[0]
            return True
        return False

    def removeColumns(self, column, count, parent=QModelIndex()):
        self.beginRemoveColumns(parent, column, column + count - 1)
        for row in self._table:
            del row[column:column + count]
        for cols in self._roleData.values():
            for col in range(column, column + count):
                cols.pop(col, None)
        del self._headers.get(Qt.Horizontal, [])[column:column + count]
        self._cols = self._table_dim()[1]
        self.endRemoveColumns()
        return True

    def _table_dim(self):
        return len(self._table), max(map(len, self), default=0)

    def insertRows(self, row, count, parent=QModelIndex()):
        self.beginInsertRows(parent, row, row + count - 1)
        self._table[row:row] = [[''] * self.columnCount() for _ in range(count)]
        self._rows = self._table_dim()[0]
        self.endInsertRows()
        return True

    def insertColumns(self, column, count, parent=QModelIndex()):
        self.beginInsertColumns(parent, column, column + count - 1)
        for row in self._table:
            row[column:column] = [''] * count
        self._cols = self._table_dim()[1]
        self.endInsertColumns()
        return True

    def __len__(self):
        return len(self._table)

    def __bool__(self):
        return len(self) != 0

    def __iter__(self):
        return iter(self._table)

    def __getitem__(self, item):
        return self._table[item]

    def __delitem__(self, i):
        if isinstance(i, slice):
            start, stop, _ = _as_contiguous_range(i, len(self))
            stop -= 1
        else:
            start = stop = i = i if i >= 0 else len(self) + i
        if stop < start:
            return
        self._check_sort_order()
        self.beginRemoveRows(QModelIndex(), start, stop)
        del self._table[i]
        rows = self._table_dim()[0]
        self._rows = rows
        self.endRemoveRows()
        self._update_column_count()

    def __setitem__(self, i, value):
        self._check_sort_order()
        if isinstance(i, slice):
            start, stop, _ = _as_contiguous_range(i, len(self))
            self.removeRows(start, stop - start)
            if len(value) == 0:
                return
            self.beginInsertRows(QModelIndex(), start, start + len(value) - 1)
            self._table[start:start] = value
            self._rows = self._table_dim()[0]
            self.endInsertRows()
            self._update_column_count()
        else:
            self._table[i] = value
            self.dataChanged.emit(self.index(i, 0),
                                  self.index(i, self.columnCount() - 1))

    def _update_column_count(self):
        cols_before = self._cols
        cols_after = self._table_dim()[1]
        if cols_before < cols_after:
            self.beginInsertColumns(QModelIndex(), cols_before, cols_after - 1)
            self._cols = cols_after
            self.endInsertColumns()
        elif cols_before > cols_after:
            self.beginRemoveColumns(QModelIndex(), cols_after, cols_before - 1)
            self._cols = cols_after
            self.endRemoveColumns()

    def _check_sort_order(self):
        if self.mapToSourceRows(Ellipsis) is not Ellipsis:
            warn("Can't modify PyTableModel when it's sorted",
                 RuntimeWarning, stacklevel=3)
            raise RuntimeError("Can't modify PyTableModel when it's sorted")

    def wrap(self, table):
        self.beginResetModel()
        self._table = table
        self._roleData = self._RoleData()
        self._rows, self._cols = self._table_dim()
        self.resetSorting()
        self.endResetModel()

    def tolist(self):
        return self._table

    def clear(self):
        self.beginResetModel()
        self._table.clear()
        self.resetSorting()
        self._roleData.clear()
        self._rows, self._cols = self._table_dim()
        self.endResetModel()

    def append(self, row):
        self.extend([row])

    def _insertColumns(self, rows):
        n_max = max(map(len, rows))
        if self.columnCount() < n_max:
            self.insertColumns(self.columnCount(), n_max - self.columnCount())

    def extend(self, rows):
        i, rows = len(self), list(rows)
        self.insertRows(i, len(rows))
        self._insertColumns(rows)
        self[i:] = rows

    def insert(self, i, row):
        self.insertRows(i, 1)
        self._insertColumns((row,))
        self[i] = row

    def remove(self, val):
        del self[self._table.index(val)]


class PyListModelTooltip(PyListModel):
    def __init__(self, iterable=None, tooltips=(), **kwargs):
        super().__init__(iterable, **kwargs)
        if not isinstance(tooltips, Sequence):
            # may be a generator; if not, fail
            tooltips = list(tooltips)
        self.tooltips = tooltips

    def data(self, index, role=Qt.DisplayRole):
        if role == Qt.ToolTipRole:
            if index.row() >= len(self.tooltips):
                return None
            return self.tooltips[index.row()]
        else:
            return super().data(index, role)


class VariableListModel(PyListModel):
    MIME_TYPE = "application/x-Orange-VariableList"

    def __init__(self, *args, placeholder=None, **kwargs):
        super().__init__(*args, **kwargs)
        self.placeholder = placeholder

    def data(self, index, role=Qt.DisplayRole):
        if self._is_index_valid(index):
            var = self[index.row()]
            if var is None and role == Qt.DisplayRole:
                return self.placeholder or "None"
            if not isinstance(var, Variable):
                return super().data(index, role)
            elif role == Qt.DisplayRole:
                return var.name
            elif role == Qt.DecorationRole:
                return gui.attributeIconDict[var]
            elif role == Qt.ToolTipRole:
                return self.variable_tooltip(var)
            elif role == gui.TableVariable:
                return var
            else:
                return PyListModel.data(self, index, role)

    def variable_tooltip(self, var):
        if var.is_discrete:
            return self.discrete_variable_tooltip(var)
        elif var.is_time:
            return self.time_variable_toltip(var)
        elif var.is_continuous:
            return self.continuous_variable_toltip(var)
        elif var.is_string:
            return self.string_variable_tooltip(var)

    def variable_labels_tooltip(self, var):
        text = ""
        if var.attributes:
            items = [(safe_text(key), safe_text(value))
                     for key, value in var.attributes.items()]
            labels = list(map("%s = %s".__mod__, items))
            text += "<br/>Variable Labels:<br/>"
            text += "<br/>".join(labels)
        return text

    def discrete_variable_tooltip(self, var):
        text = "<b>%s</b><br/>Categorical with %i values: " %\
               (safe_text(var.name), len(var.values))
        text += ", ".join("%r" % safe_text(v) for v in var.values)
        text += self.variable_labels_tooltip(var)
        return text

    def time_variable_toltip(self, var):
        text = "<b>%s</b><br/>Time" % safe_text(var.name)
        text += self.variable_labels_tooltip(var)
        return text

    def continuous_variable_toltip(self, var):
        text = "<b>%s</b><br/>Numeric" % safe_text(var.name)
        text += self.variable_labels_tooltip(var)
        return text

    def string_variable_tooltip(self, var):
        text = "<b>%s</b><br/>Text" % safe_text(var.name)
        text += self.variable_labels_tooltip(var)
        return text


class DomainModel(VariableListModel):
    ATTRIBUTES, CLASSES, METAS = 1, 2, 4
    MIXED = ATTRIBUTES | CLASSES | METAS
    SEPARATED = (CLASSES, PyListModel.Separator,
                 METAS, PyListModel.Separator,
                 ATTRIBUTES)
    PRIMITIVE = (DiscreteVariable, ContinuousVariable)

    def __init__(self, order=SEPARATED, separators=True, placeholder=None,
                 valid_types=None, alphabetical=False, skip_hidden_vars=True, **kwargs):
        """

        Parameters
        ----------
        order: tuple or int
            Order of attributes, metas, classes, separators and other options
        separators: bool
            If False, remove separators from `order`.
        placeholder: str
            The text that is shown when no variable is selected
        valid_types: tuple
            (Sub)types of `Variable` that are included in the model
        alphabetical: bool
            If true, variables are sorted alphabetically.
        skip_hidden_vars: bool
            If true, variables marked as "hidden" are skipped.
        """
        super().__init__(placeholder=placeholder, **kwargs)
        if isinstance(order, int):
            order = (order,)
        if placeholder is not None and None not in order:
            # Add None for the placeholder if it's not already there
            # Include separator if the current order uses them
            order = (None,) + \
                    (self.Separator, ) * (self.Separator in order) + \
                    order
        if not separators:
            order = [e for e in order if e is not self.Separator]
        self.order = order
        self.valid_types = valid_types
        self.alphabetical = alphabetical
        self.skip_hidden_vars = skip_hidden_vars
        self._within_set_domain = False
        self.set_domain(None)

    def set_domain(self, domain):
        self.beginResetModel()
        content = []
        # The logic related to separators is a bit complicated: it ensures that
        # even when a section is empty we don't have two separators in a row
        # or a separator at the end
        add_separator = False
        for section in self.order:
            if section is self.Separator:
                add_separator = True
                continue
            if isinstance(section, int):
                if domain is None:
                    continue
                to_add = list(chain(
                    *(vars for i, vars in enumerate(
                        (domain.attributes, domain.class_vars, domain.metas))
                      if (1 << i) & section)))
                if self.skip_hidden_vars:
                    to_add = list(filter_visible(to_add))
                if self.valid_types is not None:
                    to_add = [var for var in to_add
                              if isinstance(var, self.valid_types)]
                if self.alphabetical:
                    to_add = sorted(to_add, key=lambda x: x.name)
            elif isinstance(section, list):
                to_add = section
            else:
                to_add = [section]
            if to_add:
                if add_separator and content:
                    content.append(self.Separator)
                    add_separator = False
                content += to_add
        try:
            self._within_set_domain = True
            self[:] = content
        finally:
            self._within_set_domain = False
        self.endResetModel()

    def prevent_modification(method):  # pylint: disable=no-self-argument
        @wraps(method)
        # pylint: disable=protected-access
        def e(self, *args, **kwargs):
            if self._within_set_domain:
                method(self, *args, **kwargs)
            else:
                raise TypeError(
                    "{} can be modified only by calling 'set_domain'".
                    format(type(self).__name__))
        return e

    @prevent_modification
    def extend(self, iterable):
        return super().extend(iterable)

    @prevent_modification
    def append(self, item):
        return super().append(item)

    @prevent_modification
    def insert(self, i, val):
        return super().insert(i, val)

    @prevent_modification
    def remove(self, val):
        return super().remove(val)

    @prevent_modification
    def pop(self, i):
        return super().pop(i)

    @prevent_modification
    def clear(self):
        return super().clear()

    @prevent_modification
    def __delitem__(self, s):
        return super().__delitem__(s)

    @prevent_modification
    def __setitem__(self, s, value):
        return super().__setitem__(s, value)

    @prevent_modification
    def reverse(self):
        return super().reverse()

    @prevent_modification
    def sort(self, *args, **kwargs):
        return super().sort(*args, **kwargs)

    def setData(self, index, value, role=Qt.EditRole):
        # reimplemented
        if role == Qt.EditRole:
            return False
        else:
            return super().setData(index, value, role)

    def setItemData(self, index, data):
        # reimplemented
        if Qt.EditRole in data:
            return False
        else:
            return super().setItemData(index, data)

    def insertRows(self, row, count, parent=QModelIndex()):
        # reimplemented
        return False

    def removeRows(self, row, count, parent=QModelIndex()):
        # reimplemented
        return False

_html_replace = [("<", "&lt;"), (">", "&gt;")]


def safe_text(text):
    for old, new in _html_replace:
        text = str(text).replace(old, new)
    return text


class ContinuousPalettesModel(QAbstractListModel):
    """
    Model for combo boxes
    """
    KeyRole = Qt.UserRole + 1
    def __init__(self, parent=None, categories=None, icon_width=64):
        super().__init__(parent)
        self.icon_width = icon_width

        palettes = list(ContinuousPalettes.values())
        if categories is None:
            # Use dict, not set, to keep order of categories
            categories = dict.fromkeys(palette.category for palette in palettes)

        self.items = []
        for category in categories:
            self.items.append(category)
            self.items += [palette for palette in palettes
                           if palette.category == category]
        if len(categories) == 1:
            del self.items[0]

    def rowCount(self, parent):
        return 0 if parent.isValid() else len(self.items)

    @staticmethod
    def columnCount(parent):
        return 0 if parent.isValid() else 1

    def data(self, index, role):
        item = self.items[index.row()]
        if isinstance(item, str):
            if role in [Qt.EditRole, Qt.DisplayRole]:
                return item
        else:
            if role in [Qt.EditRole, Qt.DisplayRole]:
                return item.friendly_name
            if role == Qt.DecorationRole:
                return item.color_strip(self.icon_width, 16)
            if role == Qt.UserRole:
                return item
            if role == self.KeyRole:
                return item.name
        return None

    def flags(self, index):
        item = self.items[index.row()]
        if isinstance(item, ContinuousPalette):
            return Qt.ItemIsEnabled | Qt.ItemIsSelectable
        else:
            return Qt.NoItemFlags

    def indexOf(self, x):
        if isinstance(x, str):
            for i, item in enumerate(self.items):
                if not isinstance(item, str) \
                        and x in (item.name, item.friendly_name):
                    return i
        elif isinstance(x, ContinuousPalette):
            return self.items.index(x)
        return None


class ListSingleSelectionModel(QItemSelectionModel):
    """ Item selection model for list item models with single selection.

    Defines signal:
        - selectedIndexChanged(QModelIndex)

    """
    selectedIndexChanged = Signal(QModelIndex)

    def __init__(self, model, parent=None):
        QItemSelectionModel.__init__(self, model, parent)
        self.selectionChanged.connect(self.onSelectionChanged)

    def onSelectionChanged(self, new, _):
        index = list(new.indexes())
        if index:
            index = index.pop()
        else:
            index = QModelIndex()

        self.selectedIndexChanged.emit(index)

    def selectedRow(self):
        """ Return QModelIndex of the selected row or invalid if no selection.
        """
        rows = self.selectedRows()
        if rows:
            return rows[0]
        else:
            return QModelIndex()

    def select(self, index, flags=QItemSelectionModel.ClearAndSelect):
        if isinstance(index, int):
            index = self.model().index(index)
        return QItemSelectionModel.select(self, index, flags)


def select_row(view, row):
    """
    Select a `row` in an item view.
    """
    selmodel = view.selectionModel()
    selmodel.select(view.model().index(row, 0),
                    QItemSelectionModel.ClearAndSelect |
                    QItemSelectionModel.Rows)


def select_rows(view, row_indices, command=QItemSelectionModel.ClearAndSelect):
    """
    Select several rows in view.

    :param QAbstractItemView view:
    :param row_indices: Integer indices of rows to select.
    :param command: QItemSelectionModel.SelectionFlags
    """
    selmodel = view.selectionModel()
    model = view.model()
    selection = QItemSelection()
    for row in row_indices:
        index = model.index(row, 0)
        selection.select(index, index)
    selmodel.select(selection, command | QItemSelectionModel.Rows)


class ModelActionsWidget(QWidget):
    def __init__(self, actions=None, parent=None,
                 direction=QBoxLayout.LeftToRight):
        QWidget.__init__(self, parent)
        self.actions = []
        self.buttons = []
        layout = QBoxLayout(direction)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)
        if actions is not None:
            for action in actions:
                self.addAction(action)
        self.setLayout(layout)

    def actionButton(self, action):
        if isinstance(action, QAction):
            button = QToolButton(self)
            button.setDefaultAction(action)
            return button
        elif isinstance(action, QAbstractButton):
            return action

    def insertAction(self, ind, action, *args):
        button = self.actionButton(action)
        self.layout().insertWidget(ind, button, *args)
        self.buttons.insert(ind, button)
        self.actions.insert(ind, action)
        return button

    def addAction(self, action, *args):
        return self.insertAction(-1, action, *args)


class TableModel(AbstractSortTableModel):
    """
    An adapter for using Orange.data.Table within Qt's Item View Framework.

    :param Orange.data.Table sourcedata: Source data table.
    :param QObject parent:
    """
    #: Orange.data.Value for the index.
    ValueRole = gui.TableValueRole  # next(gui.OrangeUserRole)
    #: Orange.data.Value of the row's class.
    ClassValueRole = gui.TableClassValueRole  # next(gui.OrangeUserRole)
    #: Orange.data.Variable of the column.
    VariableRole = gui.TableVariable  # next(gui.OrangeUserRole)
    #: Basic statistics of the column
    VariableStatsRole = next(gui.OrangeUserRole)
    #: The column's role (position) in the domain.
    #: One of Attribute, ClassVar or Meta
    DomainRole = next(gui.OrangeUserRole)

    #: Column domain roles
    ClassVar, Meta, Attribute = range(3)

    #: Default background color for domain roles
    ColorForRole = {
        ClassVar: QColor(160, 160, 160),
        Meta: QColor(220, 220, 200),
        Attribute: None,
    }

    #: Standard column descriptor
    Column = namedtuple(
        "Column", ["var", "role", "background", "format"])
    #: Basket column descriptor (i.e. sparse X/Y/metas/ compressed into
    #: a single column).
    Basket = namedtuple(
        "Basket", ["vars", "role", "background", "density", "format"])

    # The class uses the same names (X_density etc) as Table
    # pylint: disable=invalid-name
    def __init__(self, sourcedata, parent=None):
        super().__init__(parent)
        self.source = sourcedata
        self.domain = domain = sourcedata.domain

        self.X_density = sourcedata.X_density()
        self.Y_density = sourcedata.Y_density()
        self.M_density = sourcedata.metas_density()

        brush_for_role = {
            role: QBrush(c) if c is not None else None
            for role, c in self.ColorForRole.items()
        }

        def format_sparse(vars, row):
            row = row.tocsr()
            return ", ".join("{}={}".format(vars[i].name, vars[i].str_val(v))
                             for i, v in zip(row.indices, row.data))

        def format_sparse_bool(vars, row):
            row = row.tocsr()
            return ", ".join(vars[i].name for i in row.indices)

        def format_dense(var, val):
            return var.str_val(val)

        def make_basket_formatter(vars, density):
            formatter = (format_sparse if density == Storage.SPARSE
                         else format_sparse_bool)
            return partial(formatter, vars)

        def make_basket(vars, density, role):
            return TableModel.Basket(
                vars, TableModel.Attribute, brush_for_role[role], density,
                make_basket_formatter(vars, density)
            )

        def make_column(var, role):
            return TableModel.Column(
                var, role, brush_for_role[role],
                partial(format_dense, var)
            )

        columns = []

        if self.Y_density != Storage.DENSE and domain.class_vars:
            coldesc = make_basket(domain.class_vars, self.Y_density,
                                  TableModel.ClassVar)
            columns.append(coldesc)
        else:
            columns += [make_column(var, TableModel.ClassVar)
                        for var in domain.class_vars]

        if self.M_density != Storage.DENSE and domain.metas:
            coldesc = make_basket(domain.metas, self.M_density,
                                  TableModel.Meta)
            columns.append(coldesc)
        else:
            columns += [make_column(var, TableModel.Meta)
                        for var in domain.metas]

        if self.X_density != Storage.DENSE and domain.attributes:
            coldesc = make_basket(domain.attributes, self.X_density,
                                  TableModel.Attribute)
            columns.append(coldesc)
        else:
            columns += [make_column(var, TableModel.Attribute)
                        for var in domain.attributes]

        #: list of all domain variables (class_vars + metas + attrs)
        self.vars = domain.class_vars + domain.metas + domain.attributes
        self.columns = columns

        #: A list of all unique attribute labels (in all variables)
        self._labels = sorted(
            reduce(operator.ior,
                   [set(var.attributes) for var in self.vars],
                   set()))

        # column basic statistics (VariableStatsRole), computed when
        # first needed.
        self.__stats = None
        self.__rowCount = sourcedata.approx_len()
        self.__columnCount = len(self.columns)

        if self.__rowCount > (2 ** 31 - 1):
            raise ValueError("len(sourcedata) > 2 ** 31 - 1")

    def _get_source_item(self, row, coldesc):
        if isinstance(coldesc, self.Basket):
            # `self.source[row:row + 1]` returns Table
            # `self.source[row]` returns RowInstance
            if coldesc.role is self.ClassVar:
                return self.source[row:row + 1].Y
            if coldesc.role is self.Meta:
                return self.source[row:row + 1].metas
            if coldesc.role is self.Attribute:
                return self.source[row:row + 1].X
        return self.source[row, coldesc.var]

    def sortColumnData(self, column):
        return self._columnSortKeyData(column, TableModel.ValueRole)

    @deprecated('Orange.widgets.utils.itemmodels.TableModel.sortColumnData')
    def columnSortKeyData(self, column, role):
        return self._columnSortKeyData(column, role)

    def _columnSortKeyData(self, column, role):
        """
        Return a sequence of source table objects which can be used as
        `keys` for sorting.

        :param int column: Sort column.
        :param Qt.ItemRole role: Sort item role.

        """
        coldesc = self.columns[column]
        if isinstance(coldesc, TableModel.Column) \
                and role == TableModel.ValueRole:
            return self.source.get_column(coldesc.var)
        else:
            return numpy.asarray([self.index(i, column).data(role)
                                  for i in range(self.rowCount())])

    def data(self, index, role,
             # For optimizing out LOAD_GLOBAL byte code instructions in
             # the item role tests.
             _str=str,
             _Qt_DisplayRole=Qt.DisplayRole,
             _Qt_EditRole=Qt.EditRole,
             _Qt_BackgroundRole=Qt.BackgroundRole,
             _Qt_ForegroundRole=Qt.ForegroundRole,
             _ValueRole=ValueRole,
             _ClassValueRole=ClassValueRole,
             _VariableRole=VariableRole,
             _DomainRole=DomainRole,
             _VariableStatsRole=VariableStatsRole,
             # Some cached local precomputed values.
             # All of the above roles we respond to
             _recognizedRoles=frozenset([Qt.DisplayRole,
                                         Qt.EditRole,
                                         Qt.BackgroundRole,
                                         Qt.ForegroundRole,
                                         ValueRole,
                                         ClassValueRole,
                                         VariableRole,
                                         DomainRole,
                                         VariableStatsRole])):
        """
        Reimplemented from `QAbstractItemModel.data`
        """
        if role not in _recognizedRoles:
            return None

        row = index.row()
        if not 0 <= row <= self.__rowCount:
            return None

        row = self.mapToSourceRows(row)
        col = 0 if role is _ClassValueRole else index.column()

        try:
            coldesc = self.columns[col]
            instance = self._get_source_item(row, coldesc)
        except IndexError:
            self.layoutAboutToBeChanged.emit()
            self.beginRemoveRows(self.parent(), row, max(self.rowCount(), row))
            self.__rowCount = min(row, self.__rowCount)
            self.endRemoveRows()
            self.layoutChanged.emit()
            return None

        if role == _Qt_DisplayRole:
            return coldesc.format(instance)
        elif role in (_Qt_EditRole, _ValueRole) and isinstance(coldesc, TableModel.Column):
            return Value(coldesc.var, instance)
        elif role == _Qt_BackgroundRole:
            return coldesc.background
        elif role == _Qt_ForegroundRole:
            # The background is light-ish, force dark text color
            return coldesc.background and QColor(0, 0, 0, 200)
        elif role == _ClassValueRole \
                and isinstance(coldesc, TableModel.Column) \
                and len(self.domain.class_vars) == 1:
            return Value(coldesc.var, instance)
        elif role == _VariableRole and isinstance(coldesc, TableModel.Column):
            return coldesc.var
        elif role == _DomainRole:
            return coldesc.role
        elif role == _VariableStatsRole:
            return self._stats_for_column(col)
        else:
            return None

    def setData(self, index, value, role):
        row = self.mapFromSourceRows(index.row())
        if role == Qt.EditRole:
            try:
                self.source[row, index.column()] = value
            except (TypeError, IndexError):
                return False
            else:
                self.dataChanged.emit(index, index)
                return True
        else:
            return False

    def parent(self, index=QModelIndex()):
        """Reimplemented from `QAbstractTableModel.parent`."""
        return QModelIndex()

    def rowCount(self, parent=QModelIndex()):
        """Reimplemented from `QAbstractTableModel.rowCount`."""
        return 0 if parent.isValid() else self.__rowCount

    def columnCount(self, parent=QModelIndex()):
        """Reimplemented from `QAbstractTableModel.columnCount`."""
        return 0 if parent.isValid() else self.__columnCount

    def headerData(self, section, orientation, role):
        """Reimplemented from `QAbstractTableModel.headerData`."""
        if orientation == Qt.Vertical:
            if role == Qt.DisplayRole:
                return int(self.mapToSourceRows(section) + 1)
            return None

        coldesc = self.columns[section]
        if role == Qt.DisplayRole:
            if isinstance(coldesc, TableModel.Basket):
                return "{...}"
            else:
                return coldesc.var.name
        elif role == Qt.ToolTipRole:
            return self._tooltip(coldesc)
        elif role == TableModel.VariableRole \
                and isinstance(coldesc, TableModel.Column):
            return coldesc.var
        elif role == TableModel.VariableStatsRole:
            return self._stats_for_column(section)
        elif role == TableModel.DomainRole:
            return coldesc.role
        else:
            return None

    def _tooltip(self, coldesc):
        """
        Return an header tool tip text for an `column` descriptor.
        """
        if isinstance(coldesc, TableModel.Basket):
            return None

        labels = self._labels
        variable = coldesc.var
        pairs = [(escape(key), escape(str(variable.attributes[key])))
                 for key in labels if key in variable.attributes]
        tip = "<b>%s</b>" % escape(variable.name)
        tip = "<br/>".join([tip] + ["%s = %s" % pair for pair in pairs])
        return tip

    def _stats_for_column(self, column):
        """
        Return BasicStats for `column` index.
        """
        coldesc = self.columns[column]
        if isinstance(coldesc, TableModel.Basket):
            return None

        if self.__stats is None:
            self.__stats = datacaching.getCached(
                self.source, basic_stats.DomainBasicStats,
                (self.source, True)
            )

        return self.__stats[coldesc.var]

```
--- 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:** Incomplete Display of Sparse Metas Results in Truncated Meta Information

**Description:**
When working with tables that include sparse metas, the meta information displayed is incomplete. Instead of showing the full meta data, such as `"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2"`, only a partial string like `"sepal_length=1"` is displayed.

**Example Code:**
```python
from Orange.data import Table
from Orange.widgets.utils.itemmodels import TableModel
from AnyQt.QtCore import Qt

# Create a table with sparse metas
table = Table.from_numpy(
    Domain(class_vars=table.domain.class_vars, metas=table.domain.attributes),
    csr_matrix(table.Y),
    metas=table.X
)
model = TableModel(table)
data, index = model.data, model.index

# Attempt to retrieve and display meta information
display_meta = data(index(0, 3), Qt.DisplayRole)
print(display_meta)  # Outputs: "sepal_length=1" instead of the full string
```

**Expected Behavior:**
All meta information should be fully displayed without any truncation when using sparse metas. For example, the output should be `"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2"`.

**Actual Behavior:**
The meta information is partially displayed, resulting in incomplete data such as `"sepal_length=1"`, which hinders the ability to view full meta details.

[/ISSUE]
{
    "TestUtils.test_as_contiguous_range": "PASSED",
    "TestPyTableModel.test_append": "PASSED",
    "TestPyTableModel.test_clear": "PASSED",
    "TestPyTableModel.test_columnCount": "PASSED",
    "TestPyTableModel.test_data": "PASSED",
    "TestPyTableModel.test_editable": "PASSED",
    "TestPyTableModel.test_emits_column_changes_on_row_insert": "PASSED",
    "TestPyTableModel.test_extend": "PASSED",
    "TestPyTableModel.test_init": "PASSED",
    "TestPyTableModel.test_init_wrap_empty": "PASSED",
    "TestPyTableModel.test_insert": "PASSED",
    "TestPyTableModel.test_insertColumns": "PASSED",
    "TestPyTableModel.test_insertRows": "PASSED",
    "TestPyTableModel.test_other_roles": "PASSED",
    "TestPyTableModel.test_remove": "PASSED",
    "TestPyTableModel.test_removeColumns": "PASSED",
    "TestPyTableModel.test_removeRows": "PASSED",
    "TestPyTableModel.test_rowCount": "PASSED",
    "TestPyTableModel.test_setHeaderLabels": "PASSED",
    "TestPyTableModel.test_set_iten_slice": "PASSED",
    "TestPyTableModel.test_sort": "PASSED",
    "TestPyTableModel.test_wrap": "PASSED",
    "TestVariableListModel.test_displayrole": "PASSED",
    "TestVariableListModel.test_invalid_index": "PASSED",
    "TestVariableListModel.test_other_roles": "PASSED",
    "TestVariableListModel.test_placeholder": "PASSED",
    "TestVariableListModel.test_table_variable": "PASSED",
    "TestVariableListModel.test_tooltip": "PASSED",
    "TestDomainModel.test_filtering": "PASSED",
    "TestDomainModel.test_init_with_single_section": "PASSED",
    "TestDomainModel.test_no_separators": "PASSED",
    "TestDomainModel.test_placeholder_placement": "PASSED",
    "TestDomainModel.test_read_only": "PASSED",
    "TestDomainModel.test_separators": "PASSED",
    "TestDomainModel.test_subparts": "PASSED",
    "TestContinuousPalettesModel.testIndexOf": "PASSED",
    "TestContinuousPalettesModel.test_all_categories": "PASSED",
    "TestContinuousPalettesModel.test_category_selection": "PASSED",
    "TestContinuousPalettesModel.test_count": "PASSED",
    "TestContinuousPalettesModel.test_data": "PASSED",
    "TestContinuousPalettesModel.test_select_flags": "PASSED",
    "TestContinuousPalettesModel.test_single_category": "PASSED",
    "TestPyListModelTooltip.test_tooltip_arg": "PASSED",
    "TestPyListModelTooltip.test_tooltips_size": "PASSED",
    "TestTableModel.test_local_dense_data": "PASSED",
    "TestTableModel.test_sparse_data": "PASSED",
    "test_filename": "ERROR"
}
diff --git a/Orange/widgets/utils/itemmodels.py b/Orange/widgets/utils/itemmodels.py
index b2f165b91..a749b7115 100644
--- a/Orange/widgets/utils/itemmodels.py
+++ b/Orange/widgets/utils/itemmodels.py
@@ -844,7 +844,7 @@ class TableModel(AbstractSortTableModel):
 
         def make_basket(vars, density, role):
             return TableModel.Basket(
-                vars, TableModel.Attribute, brush_for_role[role], density,
+                vars, role, brush_for_role[role], density,
                 make_basket_formatter(vars, density)
             )
 
@@ -903,8 +903,7 @@ class TableModel(AbstractSortTableModel):
         if isinstance(coldesc, self.Basket):
             # `self.source[row:row + 1]` returns Table
             # `self.source[row]` returns RowInstance
-            if coldesc.role is self.ClassVar:
-                return self.source[row:row + 1].Y
+            # We only worry about X and metas, as Y cannot be sparse
             if coldesc.role is self.Meta:
                 return self.source[row:row + 1].metas
             if coldesc.role is self.Attribute:

{"Orange/widgets/utils/itemmodels.py": "from numbers import Number, Integral\nfrom math import isnan, isinf\n\nimport operator\nfrom collections import namedtuple, defaultdict\nfrom collections.abc import Sequence\nfrom contextlib import contextmanager\nfrom functools import reduce, partial, wraps\nfrom itertools import chain\nfrom warnings import warn\nfrom xml.sax.saxutils import escape\n\nfrom AnyQt.QtCore import (\n    Qt, QObject, QAbstractListModel, QModelIndex,\n    QItemSelectionModel, QItemSelection)\nfrom AnyQt.QtCore import pyqtSignal as Signal\nfrom AnyQt.QtGui import QColor, QBrush\nfrom AnyQt.QtWidgets import (\n    QWidget, QBoxLayout, QToolButton, QAbstractButton, QAction\n)\n\nimport numpy\n\nfrom orangewidget.utils.itemmodels import (\n    PyListModel, AbstractSortTableModel as _AbstractSortTableModel\n)\n\nfrom Orange.widgets.utils.colorpalettes import ContinuousPalettes, ContinuousPalette\nfrom Orange.data import Value, Variable, Storage, DiscreteVariable, ContinuousVariable\nfrom Orange.data.domain import filter_visible\nfrom Orange.widgets import gui\nfrom Orange.widgets.utils import datacaching\nfrom Orange.statistics import basic_stats\nfrom Orange.util import deprecated\n\n__all__ = [\n    \"PyListModel\", \"VariableListModel\", \"PyListModelTooltip\", \"DomainModel\",\n    \"AbstractSortTableModel\", \"PyTableModel\", \"TableModel\",\n    \"ModelActionsWidget\", \"ListSingleSelectionModel\"\n]\n\n@contextmanager\ndef signal_blocking(obj):\n    blocked = obj.signalsBlocked()\n    obj.blockSignals(True)\n    try:\n        yield\n    finally:\n        obj.blockSignals(blocked)\n\n\ndef _as_contiguous_range(the_slice, length):\n    start, stop, step = the_slice.indices(length)\n    if step == -1:\n        # Equivalent range with positive step\n        start, stop, step = stop + 1, start + 1, 1\n    elif not (step == 1 or step is None):\n        raise IndexError(\"Non-contiguous range.\")\n    return start, stop, step\n\n\nclass AbstractSortTableModel(_AbstractSortTableModel):\n    # these were defined on TableModel below. When the AbstractSortTableModel\n    # was extracted and made a base of TableModel these deprecations were\n    # misplaced, they belong in TableModel.\n    @deprecated('Orange.widgets.utils.itemmodels.AbstractSortTableModel.mapFromSourceRows')\n    def mapFromTableRows(self, rows):\n        return self.mapFromSourceRows(rows)\n\n    @deprecated('Orange.widgets.utils.itemmodels.AbstractSortTableModel.mapToSourceRows')\n    def mapToTableRows(self, rows):\n        return self.mapToSourceRows(rows)\n\n\nclass PyTableModel(AbstractSortTableModel):\n    \"\"\" A model for displaying python tables (sequences of sequences) in\n    QTableView objects.\n\n    Parameters\n    ----------\n    sequence : list\n        The initial list to wrap.\n    parent : QObject\n        Parent QObject.\n    editable: bool or sequence\n        If True, all items are flagged editable. If sequence, the True-ish\n        fields mark their respective columns editable.\n\n    Notes\n    -----\n    The model rounds numbers to human readable precision, e.g.:\n    1.23e-04, 1.234, 1234.5, 12345, 1.234e06.\n\n    To set additional item roles, use setData().\n    \"\"\"\n\n    @staticmethod\n    def _RoleData():\n        return defaultdict(lambda: defaultdict(dict))\n\n    # All methods are either necessary overrides of super methods, or\n    # methods likened to the Python list's. Hence, docstrings aren't.\n    # pylint: disable=missing-docstring\n    def __init__(self, sequence=None, parent=None, editable=False):\n        super().__init__(parent)\n        self._rows = self._cols = 0\n        self._headers = {}\n        self._editable = editable\n        self._table = None\n        self._roleData = {}\n        if sequence is None:\n            sequence = []\n        self.wrap(sequence)\n\n    def rowCount(self, parent=QModelIndex()):\n        return 0 if parent.isValid() else self._rows\n\n    def columnCount(self, parent=QModelIndex()):\n        return 0 if parent.isValid() else self._cols\n\n    def flags(self, index):\n        flags = super().flags(index)\n        if not self._editable or not index.isValid():\n            return flags\n        if isinstance(self._editable, Sequence):\n            return flags | Qt.ItemIsEditable if self._editable[index.column()] else flags\n        return flags | Qt.ItemIsEditable\n\n    def setData(self, index, value, role):\n        row = self.mapFromSourceRows(index.row())\n        if role == Qt.EditRole:\n            self[row][index.column()] = value\n            self.dataChanged.emit(index, index)\n        else:\n            self._roleData[row][index.column()][role] = value\n        return True\n\n    def data(self, index, role=Qt.DisplayRole):\n        if not index.isValid():\n            return\n\n        row, column = self.mapToSourceRows(index.row()), index.column()\n\n        role_value = self._roleData.get(row, {}).get(column, {}).get(role)\n        if role_value is not None:\n            return role_value\n\n        try:\n            value = self[row][column]\n        except IndexError:\n            return\n        if role == Qt.EditRole:\n            return value\n        if role == Qt.DecorationRole and isinstance(value, Variable):\n            return gui.attributeIconDict[value]\n        if role == Qt.DisplayRole:\n            if (isinstance(value, Number) and\n                    not (isnan(value) or isinf(value) or isinstance(value, Integral))):\n                absval = abs(value)\n                strlen = len(str(int(absval)))\n                value = '{:.{}{}}'.format(value,\n                                          2 if absval < .001 else\n                                          3 if strlen < 2 else\n                                          1 if strlen < 5 else\n                                          0 if strlen < 6 else\n                                          3,\n                                          'f' if (absval == 0 or\n                                                  absval >= .001 and\n                                                  strlen < 6)\n                                          else 'e')\n            return str(value)\n        if role == Qt.TextAlignmentRole and isinstance(value, Number):\n            return Qt.AlignRight | Qt.AlignVCenter\n        if role == Qt.ToolTipRole:\n            return str(value)\n\n    def sortColumnData(self, column):\n        return [row[column] for row in self._table]\n\n    def setHorizontalHeaderLabels(self, labels):\n        \"\"\"\n        Parameters\n        ----------\n        labels : list of str or list of Variable\n        \"\"\"\n        self._headers[Qt.Horizontal] = tuple(labels)\n\n    def setVerticalHeaderLabels(self, labels):\n        \"\"\"\n        Parameters\n        ----------\n        labels : list of str or list of Variable\n        \"\"\"\n        self._headers[Qt.Vertical] = tuple(labels)\n\n    def headerData(self, section, orientation, role=Qt.DisplayRole):\n        headers = self._headers.get(orientation)\n\n        if headers and section < len(headers):\n            section = self.mapToSourceRows(section) if orientation == Qt.Vertical else section\n            value = headers[section]\n\n            if role == Qt.ToolTipRole:\n                role = Qt.DisplayRole\n\n            if role == Qt.DisplayRole:\n                return value.name if isinstance(value, Variable) else value\n\n            if role == Qt.DecorationRole:\n                if isinstance(value, Variable):\n                    return gui.attributeIconDict[value]\n\n        # Use QAbstractItemModel default for non-existent header/sections\n        return super().headerData(section, orientation, role)\n\n    def removeRows(self, row, count, parent=QModelIndex()):\n        if not parent.isValid():\n            del self[row:row + count]\n            for rowidx in range(row, row + count):\n                self._roleData.pop(rowidx, None)\n            self._rows = self._table_dim()[0]\n            return True\n        return False\n\n    def removeColumns(self, column, count, parent=QModelIndex()):\n        self.beginRemoveColumns(parent, column, column + count - 1)\n        for row in self._table:\n            del row[column:column + count]\n        for cols in self._roleData.values():\n            for col in range(column, column + count):\n                cols.pop(col, None)\n        del self._headers.get(Qt.Horizontal, [])[column:column + count]\n        self._cols = self._table_dim()[1]\n        self.endRemoveColumns()\n        return True\n\n    def _table_dim(self):\n        return len(self._table), max(map(len, self), default=0)\n\n    def insertRows(self, row, count, parent=QModelIndex()):\n        self.beginInsertRows(parent, row, row + count - 1)\n        self._table[row:row] = [[''] * self.columnCount() for _ in range(count)]\n        self._rows = self._table_dim()[0]\n        self.endInsertRows()\n        return True\n\n    def insertColumns(self, column, count, parent=QModelIndex()):\n        self.beginInsertColumns(parent, column, column + count - 1)\n        for row in self._table:\n            row[column:column] = [''] * count\n        self._cols = self._table_dim()[1]\n        self.endInsertColumns()\n        return True\n\n    def __len__(self):\n        return len(self._table)\n\n    def __bool__(self):\n        return len(self) != 0\n\n    def __iter__(self):\n        return iter(self._table)\n\n    def __getitem__(self, item):\n        return self._table[item]\n\n    def __delitem__(self, i):\n        if isinstance(i, slice):\n            start, stop, _ = _as_contiguous_range(i, len(self))\n            stop -= 1\n        else:\n            start = stop = i = i if i >= 0 else len(self) + i\n        if stop < start:\n            return\n        self._check_sort_order()\n        self.beginRemoveRows(QModelIndex(), start, stop)\n        del self._table[i]\n        rows = self._table_dim()[0]\n        self._rows = rows\n        self.endRemoveRows()\n        self._update_column_count()\n\n    def __setitem__(self, i, value):\n        self._check_sort_order()\n        if isinstance(i, slice):\n            start, stop, _ = _as_contiguous_range(i, len(self))\n            self.removeRows(start, stop - start)\n            if len(value) == 0:\n                return\n            self.beginInsertRows(QModelIndex(), start, start + len(value) - 1)\n            self._table[start:start] = value\n            self._rows = self._table_dim()[0]\n            self.endInsertRows()\n            self._update_column_count()\n        else:\n            self._table[i] = value\n            self.dataChanged.emit(self.index(i, 0),\n                                  self.index(i, self.columnCount() - 1))\n\n    def _update_column_count(self):\n        cols_before = self._cols\n        cols_after = self._table_dim()[1]\n        if cols_before < cols_after:\n            self.beginInsertColumns(QModelIndex(), cols_before, cols_after - 1)\n            self._cols = cols_after\n            self.endInsertColumns()\n        elif cols_before > cols_after:\n            self.beginRemoveColumns(QModelIndex(), cols_after, cols_before - 1)\n            self._cols = cols_after\n            self.endRemoveColumns()\n\n    def _check_sort_order(self):\n        if self.mapToSourceRows(Ellipsis) is not Ellipsis:\n            warn(\"Can't modify PyTableModel when it's sorted\",\n                 RuntimeWarning, stacklevel=3)\n            raise RuntimeError(\"Can't modify PyTableModel when it's sorted\")\n\n    def wrap(self, table):\n        self.beginResetModel()\n        self._table = table\n        self._roleData = self._RoleData()\n        self._rows, self._cols = self._table_dim()\n        self.resetSorting()\n        self.endResetModel()\n\n    def tolist(self):\n        return self._table\n\n    def clear(self):\n        self.beginResetModel()\n        self._table.clear()\n        self.resetSorting()\n        self._roleData.clear()\n        self._rows, self._cols = self._table_dim()\n        self.endResetModel()\n\n    def append(self, row):\n        self.extend([row])\n\n    def _insertColumns(self, rows):\n        n_max = max(map(len, rows))\n        if self.columnCount() < n_max:\n            self.insertColumns(self.columnCount(), n_max - self.columnCount())\n\n    def extend(self, rows):\n        i, rows = len(self), list(rows)\n        self.insertRows(i, len(rows))\n        self._insertColumns(rows)\n        self[i:] = rows\n\n    def insert(self, i, row):\n        self.insertRows(i, 1)\n        self._insertColumns((row,))\n        self[i] = row\n\n    def remove(self, val):\n        del self[self._table.index(val)]\n\n\nclass PyListModelTooltip(PyListModel):\n    def __init__(self, iterable=None, tooltips=(), **kwargs):\n        super().__init__(iterable, **kwargs)\n        if not isinstance(tooltips, Sequence):\n            # may be a generator; if not, fail\n            tooltips = list(tooltips)\n        self.tooltips = tooltips\n\n    def data(self, index, role=Qt.DisplayRole):\n        if role == Qt.ToolTipRole:\n            if index.row() >= len(self.tooltips):\n                return None\n            return self.tooltips[index.row()]\n        else:\n            return super().data(index, role)\n\n\nclass VariableListModel(PyListModel):\n    MIME_TYPE = \"application/x-Orange-VariableList\"\n\n    def __init__(self, *args, placeholder=None, **kwargs):\n        super().__init__(*args, **kwargs)\n        self.placeholder = placeholder\n\n    def data(self, index, role=Qt.DisplayRole):\n        if self._is_index_valid(index):\n            var = self[index.row()]\n            if var is None and role == Qt.DisplayRole:\n                return self.placeholder or \"None\"\n            if not isinstance(var, Variable):\n                return super().data(index, role)\n            elif role == Qt.DisplayRole:\n                return var.name\n            elif role == Qt.DecorationRole:\n                return gui.attributeIconDict[var]\n            elif role == Qt.ToolTipRole:\n                return self.variable_tooltip(var)\n            elif role == gui.TableVariable:\n                return var\n            else:\n                return PyListModel.data(self, index, role)\n\n    def variable_tooltip(self, var):\n        if var.is_discrete:\n            return self.discrete_variable_tooltip(var)\n        elif var.is_time:\n            return self.time_variable_toltip(var)\n        elif var.is_continuous:\n            return self.continuous_variable_toltip(var)\n        elif var.is_string:\n            return self.string_variable_tooltip(var)\n\n    def variable_labels_tooltip(self, var):\n        text = \"\"\n        if var.attributes:\n            items = [(safe_text(key), safe_text(value))\n                     for key, value in var.attributes.items()]\n            labels = list(map(\"%s = %s\".__mod__, items))\n            text += \"<br/>Variable Labels:<br/>\"\n            text += \"<br/>\".join(labels)\n        return text\n\n    def discrete_variable_tooltip(self, var):\n        text = \"<b>%s</b><br/>Categorical with %i values: \" %\\\n               (safe_text(var.name), len(var.values))\n        text += \", \".join(\"%r\" % safe_text(v) for v in var.values)\n        text += self.variable_labels_tooltip(var)\n        return text\n\n    def time_variable_toltip(self, var):\n        text = \"<b>%s</b><br/>Time\" % safe_text(var.name)\n        text += self.variable_labels_tooltip(var)\n        return text\n\n    def continuous_variable_toltip(self, var):\n        text = \"<b>%s</b><br/>Numeric\" % safe_text(var.name)\n        text += self.variable_labels_tooltip(var)\n        return text\n\n    def string_variable_tooltip(self, var):\n        text = \"<b>%s</b><br/>Text\" % safe_text(var.name)\n        text += self.variable_labels_tooltip(var)\n        return text\n\n\nclass DomainModel(VariableListModel):\n    ATTRIBUTES, CLASSES, METAS = 1, 2, 4\n    MIXED = ATTRIBUTES | CLASSES | METAS\n    SEPARATED = (CLASSES, PyListModel.Separator,\n                 METAS, PyListModel.Separator,\n                 ATTRIBUTES)\n    PRIMITIVE = (DiscreteVariable, ContinuousVariable)\n\n    def __init__(self, order=SEPARATED, separators=True, placeholder=None,\n                 valid_types=None, alphabetical=False, skip_hidden_vars=True, **kwargs):\n        \"\"\"\n\n        Parameters\n        ----------\n        order: tuple or int\n            Order of attributes, metas, classes, separators and other options\n        separators: bool\n            If False, remove separators from `order`.\n        placeholder: str\n            The text that is shown when no variable is selected\n        valid_types: tuple\n            (Sub)types of `Variable` that are included in the model\n        alphabetical: bool\n            If true, variables are sorted alphabetically.\n        skip_hidden_vars: bool\n            If true, variables marked as \"hidden\" are skipped.\n        \"\"\"\n        super().__init__(placeholder=placeholder, **kwargs)\n        if isinstance(order, int):\n            order = (order,)\n        if placeholder is not None and None not in order:\n            # Add None for the placeholder if it's not already there\n            # Include separator if the current order uses them\n            order = (None,) + \\\n                    (self.Separator, ) * (self.Separator in order) + \\\n                    order\n        if not separators:\n            order = [e for e in order if e is not self.Separator]\n        self.order = order\n        self.valid_types = valid_types\n        self.alphabetical = alphabetical\n        self.skip_hidden_vars = skip_hidden_vars\n        self._within_set_domain = False\n        self.set_domain(None)\n\n    def set_domain(self, domain):\n        self.beginResetModel()\n        content = []\n        # The logic related to separators is a bit complicated: it ensures that\n        # even when a section is empty we don't have two separators in a row\n        # or a separator at the end\n        add_separator = False\n        for section in self.order:\n            if section is self.Separator:\n                add_separator = True\n                continue\n            if isinstance(section, int):\n                if domain is None:\n                    continue\n                to_add = list(chain(\n                    *(vars for i, vars in enumerate(\n                        (domain.attributes, domain.class_vars, domain.metas))\n                      if (1 << i) & section)))\n                if self.skip_hidden_vars:\n                    to_add = list(filter_visible(to_add))\n                if self.valid_types is not None:\n                    to_add = [var for var in to_add\n                              if isinstance(var, self.valid_types)]\n                if self.alphabetical:\n                    to_add = sorted(to_add, key=lambda x: x.name)\n            elif isinstance(section, list):\n                to_add = section\n            else:\n                to_add = [section]\n            if to_add:\n                if add_separator and content:\n                    content.append(self.Separator)\n                    add_separator = False\n                content += to_add\n        try:\n            self._within_set_domain = True\n            self[:] = content\n        finally:\n            self._within_set_domain = False\n        self.endResetModel()\n\n    def prevent_modification(method):  # pylint: disable=no-self-argument\n        @wraps(method)\n        # pylint: disable=protected-access\n        def e(self, *args, **kwargs):\n            if self._within_set_domain:\n                method(self, *args, **kwargs)\n            else:\n                raise TypeError(\n                    \"{} can be modified only by calling 'set_domain'\".\n                    format(type(self).__name__))\n        return e\n\n    @prevent_modification\n    def extend(self, iterable):\n        return super().extend(iterable)\n\n    @prevent_modification\n    def append(self, item):\n        return super().append(item)\n\n    @prevent_modification\n    def insert(self, i, val):\n        return super().insert(i, val)\n\n    @prevent_modification\n    def remove(self, val):\n        return super().remove(val)\n\n    @prevent_modification\n    def pop(self, i):\n        return super().pop(i)\n\n    @prevent_modification\n    def clear(self):\n        return super().clear()\n\n    @prevent_modification\n    def __delitem__(self, s):\n        return super().__delitem__(s)\n\n    @prevent_modification\n    def __setitem__(self, s, value):\n        return super().__setitem__(s, value)\n\n    @prevent_modification\n    def reverse(self):\n        return super().reverse()\n\n    @prevent_modification\n    def sort(self, *args, **kwargs):\n        return super().sort(*args, **kwargs)\n\n    def setData(self, index, value, role=Qt.EditRole):\n        # reimplemented\n        if role == Qt.EditRole:\n            return False\n        else:\n            return super().setData(index, value, role)\n\n    def setItemData(self, index, data):\n        # reimplemented\n        if Qt.EditRole in data:\n            return False\n        else:\n            return super().setItemData(index, data)\n\n    def insertRows(self, row, count, parent=QModelIndex()):\n        # reimplemented\n        return False\n\n    def removeRows(self, row, count, parent=QModelIndex()):\n        # reimplemented\n        return False\n\n_html_replace = [(\"<\", \"&lt;\"), (\">\", \"&gt;\")]\n\n\ndef safe_text(text):\n    for old, new in _html_replace:\n        text = str(text).replace(old, new)\n    return text\n\n\nclass ContinuousPalettesModel(QAbstractListModel):\n    \"\"\"\n    Model for combo boxes\n    \"\"\"\n    KeyRole = Qt.UserRole + 1\n    def __init__(self, parent=None, categories=None, icon_width=64):\n        super().__init__(parent)\n        self.icon_width = icon_width\n\n        palettes = list(ContinuousPalettes.values())\n        if categories is None:\n            # Use dict, not set, to keep order of categories\n            categories = dict.fromkeys(palette.category for palette in palettes)\n\n        self.items = []\n        for category in categories:\n            self.items.append(category)\n            self.items += [palette for palette in palettes\n                           if palette.category == category]\n        if len(categories) == 1:\n            del self.items[0]\n\n    def rowCount(self, parent):\n        return 0 if parent.isValid() else len(self.items)\n\n    @staticmethod\n    def columnCount(parent):\n        return 0 if parent.isValid() else 1\n\n    def data(self, index, role):\n        item = self.items[index.row()]\n        if isinstance(item, str):\n            if role in [Qt.EditRole, Qt.DisplayRole]:\n                return item\n        else:\n            if role in [Qt.EditRole, Qt.DisplayRole]:\n                return item.friendly_name\n            if role == Qt.DecorationRole:\n                return item.color_strip(self.icon_width, 16)\n            if role == Qt.UserRole:\n                return item\n            if role == self.KeyRole:\n                return item.name\n        return None\n\n    def flags(self, index):\n        item = self.items[index.row()]\n        if isinstance(item, ContinuousPalette):\n            return Qt.ItemIsEnabled | Qt.ItemIsSelectable\n        else:\n            return Qt.NoItemFlags\n\n    def indexOf(self, x):\n        if isinstance(x, str):\n            for i, item in enumerate(self.items):\n                if not isinstance(item, str) \\\n                        and x in (item.name, item.friendly_name):\n                    return i\n        elif isinstance(x, ContinuousPalette):\n            return self.items.index(x)\n        return None\n\n\nclass ListSingleSelectionModel(QItemSelectionModel):\n    \"\"\" Item selection model for list item models with single selection.\n\n    Defines signal:\n        - selectedIndexChanged(QModelIndex)\n\n    \"\"\"\n    selectedIndexChanged = Signal(QModelIndex)\n\n    def __init__(self, model, parent=None):\n        QItemSelectionModel.__init__(self, model, parent)\n        self.selectionChanged.connect(self.onSelectionChanged)\n\n    def onSelectionChanged(self, new, _):\n        index = list(new.indexes())\n        if index:\n            index = index.pop()\n        else:\n            index = QModelIndex()\n\n        self.selectedIndexChanged.emit(index)\n\n    def selectedRow(self):\n        \"\"\" Return QModelIndex of the selected row or invalid if no selection.\n        \"\"\"\n        rows = self.selectedRows()\n        if rows:\n            return rows[0]\n        else:\n            return QModelIndex()\n\n    def select(self, index, flags=QItemSelectionModel.ClearAndSelect):\n        if isinstance(index, int):\n            index = self.model().index(index)\n        return QItemSelectionModel.select(self, index, flags)\n\n\ndef select_row(view, row):\n    \"\"\"\n    Select a `row` in an item view.\n    \"\"\"\n    selmodel = view.selectionModel()\n    selmodel.select(view.model().index(row, 0),\n                    QItemSelectionModel.ClearAndSelect |\n                    QItemSelectionModel.Rows)\n\n\ndef select_rows(view, row_indices, command=QItemSelectionModel.ClearAndSelect):\n    \"\"\"\n    Select several rows in view.\n\n    :param QAbstractItemView view:\n    :param row_indices: Integer indices of rows to select.\n    :param command: QItemSelectionModel.SelectionFlags\n    \"\"\"\n    selmodel = view.selectionModel()\n    model = view.model()\n    selection = QItemSelection()\n    for row in row_indices:\n        index = model.index(row, 0)\n        selection.select(index, index)\n    selmodel.select(selection, command | QItemSelectionModel.Rows)\n\n\nclass ModelActionsWidget(QWidget):\n    def __init__(self, actions=None, parent=None,\n                 direction=QBoxLayout.LeftToRight):\n        QWidget.__init__(self, parent)\n        self.actions = []\n        self.buttons = []\n        layout = QBoxLayout(direction)\n        layout.setContentsMargins(0, 0, 0, 0)\n        self.setContentsMargins(0, 0, 0, 0)\n        self.setLayout(layout)\n        if actions is not None:\n            for action in actions:\n                self.addAction(action)\n        self.setLayout(layout)\n\n    def actionButton(self, action):\n        if isinstance(action, QAction):\n            button = QToolButton(self)\n            button.setDefaultAction(action)\n            return button\n        elif isinstance(action, QAbstractButton):\n            return action\n\n    def insertAction(self, ind, action, *args):\n        button = self.actionButton(action)\n        self.layout().insertWidget(ind, button, *args)\n        self.buttons.insert(ind, button)\n        self.actions.insert(ind, action)\n        return button\n\n    def addAction(self, action, *args):\n        return self.insertAction(-1, action, *args)\n\n\nclass TableModel(AbstractSortTableModel):\n    \"\"\"\n    An adapter for using Orange.data.Table within Qt's Item View Framework.\n\n    :param Orange.data.Table sourcedata: Source data table.\n    :param QObject parent:\n    \"\"\"\n    #: Orange.data.Value for the index.\n    ValueRole = gui.TableValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Value of the row's class.\n    ClassValueRole = gui.TableClassValueRole  # next(gui.OrangeUserRole)\n    #: Orange.data.Variable of the column.\n    VariableRole = gui.TableVariable  # next(gui.OrangeUserRole)\n    #: Basic statistics of the column\n    VariableStatsRole = next(gui.OrangeUserRole)\n    #: The column's role (position) in the domain.\n    #: One of Attribute, ClassVar or Meta\n    DomainRole = next(gui.OrangeUserRole)\n\n    #: Column domain roles\n    ClassVar, Meta, Attribute = range(3)\n\n    #: Default background color for domain roles\n    ColorForRole = {\n        ClassVar: QColor(160, 160, 160),\n        Meta: QColor(220, 220, 200),\n        Attribute: None,\n    }\n\n    #: Standard column descriptor\n    Column = namedtuple(\n        \"Column\", [\"var\", \"role\", \"background\", \"format\"])\n    #: Basket column descriptor (i.e. sparse X/Y/metas/ compressed into\n    #: a single column).\n    Basket = namedtuple(\n        \"Basket\", [\"vars\", \"role\", \"background\", \"density\", \"format\"])\n\n    # The class uses the same names (X_density etc) as Table\n    # pylint: disable=invalid-name\n    def __init__(self, sourcedata, parent=None):\n        super().__init__(parent)\n        self.source = sourcedata\n        self.domain = domain = sourcedata.domain\n\n        self.X_density = sourcedata.X_density()\n        self.Y_density = sourcedata.Y_density()\n        self.M_density = sourcedata.metas_density()\n\n        brush_for_role = {\n            role: QBrush(c) if c is not None else None\n            for role, c in self.ColorForRole.items()\n        }\n\n        def format_sparse(vars, row):\n            row = row.tocsr()\n            return \", \".join(\"{}={}\".format(vars[i].name, vars[i].str_val(v))\n                             for i, v in zip(row.indices, row.data))\n\n        def format_sparse_bool(vars, row):\n            row = row.tocsr()\n            return \", \".join(vars[i].name for i in row.indices)\n\n        def format_dense(var, val):\n            return var.str_val(val)\n\n        def make_basket_formatter(vars, density):\n            formatter = (format_sparse if density == Storage.SPARSE\n                         else format_sparse_bool)\n            return partial(formatter, vars)\n\n        def make_basket(vars, density, role):\n            return TableModel.Basket(\n                vars, TableModel.Attribute, brush_for_role[role], density,\n                make_basket_formatter(vars, density)\n            )\n\n        def make_column(var, role):\n            return TableModel.Column(\n                var, role, brush_for_role[role],\n                partial(format_dense, var)\n            )\n\n        columns = []\n\n        if self.Y_density != Storage.DENSE and domain.class_vars:\n            coldesc = make_basket(domain.class_vars, self.Y_density,\n                                  TableModel.ClassVar)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.ClassVar)\n                        for var in domain.class_vars]\n\n        if self.M_density != Storage.DENSE and domain.metas:\n            coldesc = make_basket(domain.metas, self.M_density,\n                                  TableModel.Meta)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Meta)\n                        for var in domain.metas]\n\n        if self.X_density != Storage.DENSE and domain.attributes:\n            coldesc = make_basket(domain.attributes, self.X_density,\n                                  TableModel.Attribute)\n            columns.append(coldesc)\n        else:\n            columns += [make_column(var, TableModel.Attribute)\n                        for var in domain.attributes]\n\n        #: list of all domain variables (class_vars + metas + attrs)\n        self.vars = domain.class_vars + domain.metas + domain.attributes\n        self.columns = columns\n\n        #: A list of all unique attribute labels (in all variables)\n        self._labels = sorted(\n            reduce(operator.ior,\n                   [set(var.attributes) for var in self.vars],\n                   set()))\n\n        # column basic statistics (VariableStatsRole), computed when\n        # first needed.\n        self.__stats = None\n        self.__rowCount = sourcedata.approx_len()\n        self.__columnCount = len(self.columns)\n\n        if self.__rowCount > (2 ** 31 - 1):\n            raise ValueError(\"len(sourcedata) > 2 ** 31 - 1\")\n\n    def _get_source_item(self, row, coldesc):\n        if isinstance(coldesc, self.Basket):\n            # `self.source[row:row + 1]` returns Table\n            # `self.source[row]` returns RowInstance\n            if coldesc.role is self.ClassVar:\n                return self.source[row:row + 1].Y\n            if coldesc.role is self.Meta:\n                return self.source[row:row + 1].metas\n            if coldesc.role is self.Attribute:\n                return self.source[row:row + 1].X\n        return self.source[row, coldesc.var]\n\n    def sortColumnData(self, column):\n        return self._columnSortKeyData(column, TableModel.ValueRole)\n\n    @deprecated('Orange.widgets.utils.itemmodels.TableModel.sortColumnData')\n    def columnSortKeyData(self, column, role):\n        return self._columnSortKeyData(column, role)\n\n    def _columnSortKeyData(self, column, role):\n        \"\"\"\n        Return a sequence of source table objects which can be used as\n        `keys` for sorting.\n\n        :param int column: Sort column.\n        :param Qt.ItemRole role: Sort item role.\n\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Column) \\\n                and role == TableModel.ValueRole:\n            return self.source.get_column(coldesc.var)\n        else:\n            return numpy.asarray([self.index(i, column).data(role)\n                                  for i in range(self.rowCount())])\n\n    def data(self, index, role,\n             # For optimizing out LOAD_GLOBAL byte code instructions in\n             # the item role tests.\n             _str=str,\n             _Qt_DisplayRole=Qt.DisplayRole,\n             _Qt_EditRole=Qt.EditRole,\n             _Qt_BackgroundRole=Qt.BackgroundRole,\n             _Qt_ForegroundRole=Qt.ForegroundRole,\n             _ValueRole=ValueRole,\n             _ClassValueRole=ClassValueRole,\n             _VariableRole=VariableRole,\n             _DomainRole=DomainRole,\n             _VariableStatsRole=VariableStatsRole,\n             # Some cached local precomputed values.\n             # All of the above roles we respond to\n             _recognizedRoles=frozenset([Qt.DisplayRole,\n                                         Qt.EditRole,\n                                         Qt.BackgroundRole,\n                                         Qt.ForegroundRole,\n                                         ValueRole,\n                                         ClassValueRole,\n                                         VariableRole,\n                                         DomainRole,\n                                         VariableStatsRole])):\n        \"\"\"\n        Reimplemented from `QAbstractItemModel.data`\n        \"\"\"\n        if role not in _recognizedRoles:\n            return None\n\n        row = index.row()\n        if not 0 <= row <= self.__rowCount:\n            return None\n\n        row = self.mapToSourceRows(row)\n        col = 0 if role is _ClassValueRole else index.column()\n\n        try:\n            coldesc = self.columns[col]\n            instance = self._get_source_item(row, coldesc)\n        except IndexError:\n            self.layoutAboutToBeChanged.emit()\n            self.beginRemoveRows(self.parent(), row, max(self.rowCount(), row))\n            self.__rowCount = min(row, self.__rowCount)\n            self.endRemoveRows()\n            self.layoutChanged.emit()\n            return None\n\n        if role == _Qt_DisplayRole:\n            return coldesc.format(instance)\n        elif role in (_Qt_EditRole, _ValueRole) and isinstance(coldesc, TableModel.Column):\n            return Value(coldesc.var, instance)\n        elif role == _Qt_BackgroundRole:\n            return coldesc.background\n        elif role == _Qt_ForegroundRole:\n            # The background is light-ish, force dark text color\n            return coldesc.background and QColor(0, 0, 0, 200)\n        elif role == _ClassValueRole \\\n                and isinstance(coldesc, TableModel.Column) \\\n                and len(self.domain.class_vars) == 1:\n            return Value(coldesc.var, instance)\n        elif role == _VariableRole and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == _DomainRole:\n            return coldesc.role\n        elif role == _VariableStatsRole:\n            return self._stats_for_column(col)\n        else:\n            return None\n\n    def setData(self, index, value, role):\n        row = self.mapFromSourceRows(index.row())\n        if role == Qt.EditRole:\n            try:\n                self.source[row, index.column()] = value\n            except (TypeError, IndexError):\n                return False\n            else:\n                self.dataChanged.emit(index, index)\n                return True\n        else:\n            return False\n\n    def parent(self, index=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.parent`.\"\"\"\n        return QModelIndex()\n\n    def rowCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.rowCount`.\"\"\"\n        return 0 if parent.isValid() else self.__rowCount\n\n    def columnCount(self, parent=QModelIndex()):\n        \"\"\"Reimplemented from `QAbstractTableModel.columnCount`.\"\"\"\n        return 0 if parent.isValid() else self.__columnCount\n\n    def headerData(self, section, orientation, role):\n        \"\"\"Reimplemented from `QAbstractTableModel.headerData`.\"\"\"\n        if orientation == Qt.Vertical:\n            if role == Qt.DisplayRole:\n                return int(self.mapToSourceRows(section) + 1)\n            return None\n\n        coldesc = self.columns[section]\n        if role == Qt.DisplayRole:\n            if isinstance(coldesc, TableModel.Basket):\n                return \"{...}\"\n            else:\n                return coldesc.var.name\n        elif role == Qt.ToolTipRole:\n            return self._tooltip(coldesc)\n        elif role == TableModel.VariableRole \\\n                and isinstance(coldesc, TableModel.Column):\n            return coldesc.var\n        elif role == TableModel.VariableStatsRole:\n            return self._stats_for_column(section)\n        elif role == TableModel.DomainRole:\n            return coldesc.role\n        else:\n            return None\n\n    def _tooltip(self, coldesc):\n        \"\"\"\n        Return an header tool tip text for an `column` descriptor.\n        \"\"\"\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        labels = self._labels\n        variable = coldesc.var\n        pairs = [(escape(key), escape(str(variable.attributes[key])))\n                 for key in labels if key in variable.attributes]\n        tip = \"<b>%s</b>\" % escape(variable.name)\n        tip = \"<br/>\".join([tip] + [\"%s = %s\" % pair for pair in pairs])\n        return tip\n\n    def _stats_for_column(self, column):\n        \"\"\"\n        Return BasicStats for `column` index.\n        \"\"\"\n        coldesc = self.columns[column]\n        if isinstance(coldesc, TableModel.Basket):\n            return None\n\n        if self.__stats is None:\n            self.__stats = datacaching.getCached(\n                self.source, basic_stats.DomainBasicStats,\n                (self.source, True)\n            )\n\n        return self.__stats[coldesc.var]\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:** Incomplete Display of Sparse Metas Results in Truncated Meta Information

**Description:**
When working with tables that include sparse metas, the meta information displayed is incomplete. Instead of showing the full meta data, such as `"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2"`, only a partial string like `"sepal_length=1"` is displayed.

**Example Code:**
```python
from Orange.data import Table
from Orange.widgets.utils.itemmodels import TableModel
from AnyQt.QtCore import Qt

# Create a table with sparse metas
table = Table.from_numpy(
    Domain(class_vars=table.domain.class_vars, metas=table.domain.attributes),
    csr_matrix(table.Y),
    metas=table.X
)
model = TableModel(table)
data, index = model.data, model.index

# Attempt to retrieve and display meta information
display_meta = data(index(0, 3), Qt.DisplayRole)
print(display_meta)  # Outputs: "sepal_length=1" instead of the full string
```

**Expected Behavior:**
All meta information should be fully displayed without any truncation when using sparse metas. For example, the output should be `"sepal_length=1.5, sepal_width=5.3, petal_length=4.1, petal_width=2"`.

**Actual Behavior:**
The meta information is partially displayed, resulting in incomplete data such as `"sepal_length=1"`, which hinders the ability to view full meta details.

[/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/utils/itemmodels.py
from numbers import Number, Integral
from math import isnan, isinf

import operator
from collections import namedtuple, defaultdict
from collections.abc import Sequence
from contextlib import contextmanager
from functools import reduce, partial, wraps
from itertools import chain
from warnings import warn
from xml.sax.saxutils import escape

from AnyQt.QtCore import (
    Qt, QObject, QAbstractListModel, QModelIndex,
    QItemSelectionModel, QItemSelection)
from AnyQt.QtCore import pyqtSignal as Signal
from AnyQt.QtGui import QColor, QBrush
from AnyQt.QtWidgets import (
    QWidget, QBoxLayout, QToolButton, QAbstractButton, QAction
)

import numpy

from orangewidget.utils.itemmodels import (
    PyListModel, AbstractSortTableModel as _AbstractSortTableModel
)

from Orange.widgets.utils.colorpalettes import ContinuousPalettes, ContinuousPalette
from Orange.data import Value, Variable, Storage, DiscreteVariable, ContinuousVariable
from Orange.data.domain import filter_visible
from Orange.widgets import gui
from Orange.widgets.utils import datacaching
from Orange.statistics import basic_stats
from Orange.util import deprecated

__all__ = [
    "PyListModel", "VariableListModel", "PyListModelTooltip", "DomainModel",
    "AbstractSortTableModel", "PyTableModel", "TableModel",
    "ModelActionsWidget", "ListSingleSelectionModel"
]

@contextmanager
def signal_blocking(obj):
    blocked = obj.signalsBlocked()
    obj.blockSignals(True)
    try:
        yield
    finally:
        obj.blockSignals(blocked)


def _as_contiguous_range(the_slice, length):
    start, stop, step = the_slice.indices(length)
    if step == -1:
        # Equivalent range with positive step
        start, stop, step = stop + 1, start + 1, 1
    elif not (step == 1 or step is None):
        raise IndexError("Non-contiguous range.")
    return start, stop, step


class AbstractSortTableModel(_AbstractSortTableModel):
    # these were defined on TableModel below. When the AbstractSortTableModel
    # was extracted and made a base of TableModel these deprecations were
    # misplaced, they belong in TableModel.
    @deprecated('Orange.widgets.utils.itemmodels.AbstractSortTableModel.mapFromSourceRows')
    def mapFromTableRows(self, rows):
        return self.mapFromSourceRows(rows)

    @deprecated('Orange.widgets.utils.itemmodels.AbstractSortTableModel.mapToSourceRows')
    def mapToTableRows(self, rows):
        return self.mapToSourceRows(rows)


class PyTableModel(AbstractSortTableModel):
    """ A model for displaying python tables (sequences of sequences) in
    QTableView objects.

    Parameters
    ----------
    sequence : list
        The initial list to wrap.
    parent : QObject
        Parent QObject.
    editable: bool or sequence
        If True, all items are flagged editable. If sequence, the True-ish
        fields mark their respective columns editable.

    Notes
    -----
    The model rounds numbers to human readable precision, e.g.:
    1.23e-04, 1.234, 1234.5, 12345, 1.234e06.

    To set additional item roles, use setData().
    """

    @staticmethod
    def _RoleData():
        return defaultdict(lambda: defaultdict(dict))

    # All methods are either necessary overrides of super methods, or
    # methods likened to the Python list's. Hence, docstrings aren't.
    # pylint: disable=missing-docstring
    def __init__(self, sequence=None, parent=None, editable=False):
        super().__init__(parent)
        self._rows = self._cols = 0
        self._headers = {}
        self._editable = editable
        self._table = None
        self._roleData = {}
        if sequence is None:
            sequence = []
        self.wrap(sequence)

    def rowCount(self, parent=QModelIndex()):
        return 0 if parent.isValid() else self._rows

    def columnCount(self, parent=QModelIndex()):
        return 0 if parent.isValid() else self._cols

    def flags(self, index):
        flags = super().flags(index)
        if not self._editable or not index.isValid():
            return flags
        if isinstance(self._editable, Sequence):
            return flags | Qt.ItemIsEditable if self._editable[index.column()] else flags
        return flags | Qt.ItemIsEditable

    def setData(self, index, value, role):
        row = self.mapFromSourceRows(index.row())
        if role == Qt.EditRole:
            self[row][index.column()] = value
            self.dataChanged.emit(index, index)
        else:
            self._roleData[row][index.column()][role] = value
        return True

    def data(self, index, role=Qt.DisplayRole):
        if not index.isValid():
            return

        row, column = self.mapToSourceRows(index.row()), index.column()

        role_value = self._roleData.get(row, {}).get(column, {}).get(role)
        if role_value is not None:
            return role_value

        try:
            value = self[row][column]
        except IndexError:
            return
        if role == Qt.EditRole:
            return value
        if role == Qt.DecorationRole and isinstance(value, Variable):
            return gui.attributeIconDict[value]
        if role == Qt.DisplayRole:
            if (isinstance(value, Number) and
                    not (isnan(value) or isinf(value) or isinstance(value, Integral))):
                absval = abs(value)
                strlen = len(str(int(absval)))
                value = '{:.{}{}}'.format(value,
                                          2 if absval < .001 else
                                          3 if strlen < 2 else
                                          1 if strlen < 5 else
                                          0 if strlen < 6 else
                                          3,
                                          'f' if (absval == 0 or
                                                  absval >= .001 and
                                                  strlen < 6)
                                          else 'e')
            return str(value)
        if role == Qt.TextAlignmentRole and isinstance(value, Number):
            return Qt.AlignRight | Qt.AlignVCenter
        if role == Qt.ToolTipRole:
            return str(value)

    def sortColumnData(self, column):
        return [row[column] for row in self._table]

    def setHorizontalHeaderLabels(self, labels):
        """
        Parameters
        ----------
        labels : list of str or list of Variable
        """
        self._headers[Qt.Horizontal] = tuple(labels)

    def setVerticalHeaderLabels(self, labels):
        """
        Parameters
        ----------
        labels : list of str or list of Variable
        """
        self._headers[Qt.Vertical] = tuple(labels)

    def headerData(self, section, orientation, role=Qt.DisplayRole):
        headers = self._headers.get(orientation)

        if headers and section < len(headers):
            section = self.mapToSourceRows(section) if orientation == Qt.Vertical else section
            value = headers[section]

            if role == Qt.ToolTipRole:
                role = Qt.DisplayRole

            if role == Qt.DisplayRole:
                return value.name if isinstance(value, Variable) else value

            if role == Qt.DecorationRole:
                if isinstance(value, Variable):
                    return gui.attributeIconDict[value]

        # Use QAbstractItemModel default for non-existent header/sections
        return super().headerData(section, orientation, role)

    def removeRows(self, row, count, parent=QModelIndex()):
        if not parent.isValid():
            del self[row:row + count]
            for rowidx in range(row, row + count):
                self._roleData.pop(rowidx, None)
            self._rows = self._table_dim()[0]
            return True
        return False

    def removeColumns(self, column, count, parent=QModelIndex()):
        self.beginRemoveColumns(parent, column, column + count - 1)
        for row in self._table:
            del row[column:column + count]
        for cols in self._roleData.values():
            for col in range(column, column + count):
                cols.pop(col, None)
        del self._headers.get(Qt.Horizontal, [])[column:column + count]
        self._cols = self._table_dim()[1]
        self.endRemoveColumns()
        return True

    def _table_dim(self):
        return len(self._table), max(map(len, self), default=0)

    def insertRows(self, row, count, parent=QModelIndex()):
        self.beginInsertRows(parent, row, row + count - 1)
        self._table[row:row] = [[''] * self.columnCount() for _ in range(count)]
        self._rows = self._table_dim()[0]
        self.endInsertRows()
        return True

    def insertColumns(self, column, count, parent=QModelIndex()):
        self.beginInsertColumns(parent, column, column + count - 1)
        for row in self._table:
            row[column:column] = [''] * count
        self._cols = self._table_dim()[1]
        self.endInsertColumns()
        return True

    def __len__(self):
        return len(self._table)

    def __bool__(self):
        return len(self) != 0

    def __iter__(self):
        return iter(self._table)

    def __getitem__(self, item):
        return self._table[item]

    def __delitem__(self, i):
        if isinstance(i, slice):
            start, stop, _ = _as_contiguous_range(i, len(self))
            stop -= 1
        else:
            start = stop = i = i if i >= 0 else len(self) + i
        if stop < start:
            return
        self._check_sort_order()
        self.beginRemoveRows(QModelIndex(), start, stop)
        del self._table[i]
        rows = self._table_dim()[0]
        self._rows = rows
        self.endRemoveRows()
        self._update_column_count()

    def __setitem__(self, i, value):
        self._check_sort_order()
        if isinstance(i, slice):
            start, stop, _ = _as_contiguous_range(i, len(self))
            self.removeRows(start, stop - start)
            if len(value) == 0:
                return
            self.beginInsertRows(QModelIndex(), start, start + len(value) - 1)
            self._table[start:start] = value
            self._rows = self._table_dim()[0]
            self.endInsertRows()
            self._update_column_count()
        else:
            self._table[i] = value
            self.dataChanged.emit(self.index(i, 0),
                                  self.index(i, self.columnCount() - 1))

    def _update_column_count(self):
        cols_before = self._cols
        cols_after = self._table_dim()[1]
        if cols_before < cols_after:
            self.beginInsertColumns(QModelIndex(), cols_before, cols_after - 1)
            self._cols = cols_after
            self.endInsertColumns()
        elif cols_before > cols_after:
            self.beginRemoveColumns(QModelIndex(), cols_after, cols_before - 1)
            self._cols = cols_after
            self.endRemoveColumns()

    def _check_sort_order(self):
        if self.mapToSourceRows(Ellipsis) is not Ellipsis:
            warn("Can't modify PyTableModel when it's sorted",
                 RuntimeWarning, stacklevel=3)
            raise RuntimeError("Can't modify PyTableModel when it's sorted")

    def wrap(self, table):
        self.beginResetModel()
        self._table = table
        self._roleData = self._RoleData()
        self._rows, self._cols = self._table_dim()
        self.resetSorting()
        self.endResetModel()

    def tolist(self):
        return self._table

    def clear(self):
        self.beginResetModel()
        self._table.clear()
        self.resetSorting()
        self._roleData.clear()
        self._rows, self._cols = self._table_dim()
        self.endResetModel()

    def append(self, row):
        self.extend([row])

    def _insertColumns(self, rows):
        n_max = max(map(len, rows))
        if self.columnCount() < n_max:
            self.insertColumns(self.columnCount(), n_max - self.columnCount())

    def extend(self, rows):
        i, rows = len(self), list(rows)
        self.insertRows(i, len(rows))
        self._insertColumns(rows)
        self[i:] = rows

    def insert(self, i, row):
        self.insertRows(i, 1)
        self._insertColumns((row,))
        self[i] = row

    def remove(self, val):
        del self[self._table.index(val)]


class PyListModelTooltip(PyListModel):
    def __init__(self, iterable=None, tooltips=(), **kwargs):
        super().__init__(iterable, **kwargs)
        if not isinstance(tooltips, Sequence):
            # may be a generator; if not, fail
            tooltips = list(tooltips)
        self.tooltips = tooltips

    def data(self, index, role=Qt.DisplayRole):
        if role == Qt.ToolTipRole:
            if index.row() >= len(self.tooltips):
                return None
            return self.tooltips[index.row()]
        else:
            return super().data(index, role)


class VariableListModel(PyListModel):
    MIME_TYPE = "application/x-Orange-VariableList"

    def __init__(self, *args, placeholder=None, **kwargs):
        super().__init__(*args, **kwargs)
        self.placeholder = placeholder

    def data(self, index, role=Qt.DisplayRole):
        if self._is_index_valid(index):
            var = self[index.row()]
            if var is None and role == Qt.DisplayRole:
                return self.placeholder or "None"
            if not isinstance(var, Variable):
                return super().data(index, role)
            elif role == Qt.DisplayRole:
                return var.name
            elif role == Qt.DecorationRole:
                return gui.attributeIconDict[var]
            elif role == Qt.ToolTipRole:
                return self.variable_tooltip(var)
            elif role == gui.TableVariable:
                return var
            else:
                return PyListModel.data(self, index, role)

    def variable_tooltip(self, var):
        if var.is_discrete:
            return self.discrete_variable_tooltip(var)
        elif var.is_time:
            return self.time_variable_toltip(var)
        elif var.is_continuous:
            return self.continuous_variable_toltip(var)
        elif var.is_string:
            return self.string_variable_tooltip(var)

    def variable_labels_tooltip(self, var):
        text = ""
        if var.attributes:
            items = [(safe_text(key), safe_text(value))
                     for key, value in var.attributes.items()]
            labels = list(map("%s = %s".__mod__, items))
            text += "<br/>Variable Labels:<br/>"
            text += "<br/>".join(labels)
        return text

    def discrete_variable_tooltip(self, var):
        text = "<b>%s</b><br/>Categorical with %i values: " %\
               (safe_text(var.name), len(var.values))
        text += ", ".join("%r" % safe_text(v) for v in var.values)
        text += self.variable_labels_tooltip(var)
        return text

    def time_variable_toltip(self, var):
        text = "<b>%s</b><br/>Time" % safe_text(var.name)
        text += self.variable_labels_tooltip(var)
        return text

    def continuous_variable_toltip(self, var):
        text = "<b>%s</b><br/>Numeric" % safe_text(var.name)
        text += self.variable_labels_tooltip(var)
        return text

    def string_variable_tooltip(self, var):
        text = "<b>%s</b><br/>Text" % safe_text(var.name)
        text += self.variable_labels_tooltip(var)
        return text


class DomainModel(VariableListModel):
    ATTRIBUTES, CLASSES, METAS = 1, 2, 4
    MIXED = ATTRIBUTES | CLASSES | METAS
    SEPARATED = (CLASSES, PyListModel.Separator,
                 METAS, PyListModel.Separator,
                 ATTRIBUTES)
    PRIMITIVE = (DiscreteVariable, ContinuousVariable)

    def __init__(self, order=SEPARATED, separators=True, placeholder=None,
                 valid_types=None, alphabetical=False, skip_hidden_vars=True, **kwargs):
        """

        Parameters
        ----------
        order: tuple or int
            Order of attributes, metas, classes, separators and other options
        separators: bool
            If False, remove separators from `order`.
        placeholder: str
            The text that is shown when no variable is selected
        valid_types: tuple
            (Sub)types of `Variable` that are included in the model
        alphabetical: bool
            If true, variables are sorted alphabetically.
        skip_hidden_vars: bool
            If true, variables marked as "hidden" are skipped.
        """
        super().__init__(placeholder=placeholder, **kwargs)
        if isinstance(order, int):
            order = (order,)
        if placeholder is not None and None not in order:
            # Add None for the placeholder if it's not already there
            # Include separator if the current order uses them
            order = (None,) + \
                    (self.Separator, ) * (self.Separator in order) + \
                    order
        if not separators:
            order = [e for e in order if e is not self.Separator]
        self.order = order
        self.valid_types = valid_types
        self.alphabetical = alphabetical
        self.skip_hidden_vars = skip_hidden_vars
        self._within_set_domain = False
        self.set_domain(None)

    def set_domain(self, domain):
        self.beginResetModel()
        content = []
        # The logic related to separators is a bit complicated: it ensures that
        # even when a section is empty we don't have two separators in a row
        # or a separator at the end
        add_separator = False
        for section in self.order:
            if section is self.Separator:
                add_separator = True
                continue
            if isinstance(section, int):
                if domain is None:
                    continue
                to_add = list(chain(
                    *(vars for i, vars in enumerate(
                        (domain.attributes, domain.class_vars, domain.metas))
                      if (1 << i) & section)))
                if self.skip_hidden_vars:
                    to_add = list(filter_visible(to_add))
                if self.valid_types is not None:
                    to_add = [var for var in to_add
                              if isinstance(var, self.valid_types)]
                if self.alphabetical:
                    to_add = sorted(to_add, key=lambda x: x.name)
            elif isinstance(section, list):
                to_add = section
            else:
                to_add = [section]
            if to_add:
                if add_separator and content:
                    content.append(self.Separator)
                    add_separator = False
                content += to_add
        try:
            self._within_set_domain = True
            self[:] = content
        finally:
            self._within_set_domain = False
        self.endResetModel()

    def prevent_modification(method):  # pylint: disable=no-self-argument
        @wraps(method)
        # pylint: disable=protected-access
        def e(self, *args, **kwargs):
            if self._within_set_domain:
                method(self, *args, **kwargs)
            else:
                raise TypeError(
                    "{} can be modified only by calling 'set_domain'".
                    format(type(self).__name__))
        return e

    @prevent_modification
    def extend(self, iterable):
        return super().extend(iterable)

    @prevent_modification
    def append(self, item):
        return super().append(item)

    @prevent_modification
    def insert(self, i, val):
        return super().insert(i, val)

    @prevent_modification
    def remove(self, val):
        return super().remove(val)

    @prevent_modification
    def pop(self, i):
        return super().pop(i)

    @prevent_modification
    def clear(self):
        return super().clear()

    @prevent_modification
    def __delitem__(self, s):
        return super().__delitem__(s)

    @prevent_modification
    def __setitem__(self, s, value):
        return super().__setitem__(s, value)

    @prevent_modification
    def reverse(self):
        return super().reverse()

    @prevent_modification
    def sort(self, *args, **kwargs):
        return super().sort(*args, **kwargs)

    def setData(self, index, value, role=Qt.EditRole):
        # reimplemented
        if role == Qt.EditRole:
            return False
        else:
            return super().setData(index, value, role)

    def setItemData(self, index, data):
        # reimplemented
        if Qt.EditRole in data:
            return False
        else:
            return super().setItemData(index, data)

    def insertRows(self, row, count, parent=QModelIndex()):
        # reimplemented
        return False

    def removeRows(self, row, count, parent=QModelIndex()):
        # reimplemented
        return False

_html_replace = [("<", "&lt;"), (">", "&gt;")]


def safe_text(text):
    for old, new in _html_replace:
        text = str(text).replace(old, new)
    return text


class ContinuousPalettesModel(QAbstractListModel):
    """
    Model for combo boxes
    """
    KeyRole = Qt.UserRole + 1
    def __init__(self, parent=None, categories=None, icon_width=64):
        super().__init__(parent)
        self.icon_width = icon_width

        palettes = list(ContinuousPalettes.values())
        if categories is None:
            # Use dict, not set, to keep order of categories
            categories = dict.fromkeys(palette.category for palette in palettes)

        self.items = []
        for category in categories:
            self.items.append(category)
            self.items += [palette for palette in palettes
                           if palette.category == category]
        if len(categories) == 1:
            del self.items[0]

    def rowCount(self, parent):
        return 0 if parent.isValid() else len(self.items)

    @staticmethod
    def columnCount(parent):
        return 0 if parent.isValid() else 1

    def data(self, index, role):
        item = self.items[index.row()]
        if isinstance(item, str):
            if role in [Qt.EditRole, Qt.DisplayRole]:
                return item
        else:
            if role in [Qt.EditRole, Qt.DisplayRole]:
                return item.friendly_name
            if role == Qt.DecorationRole:
                return item.color_strip(self.icon_width, 16)
            if role == Qt.UserRole:
                return item
            if role == self.KeyRole:
                return item.name
        return None

    def flags(self, index):
        item = self.items[index.row()]
        if isinstance(item, ContinuousPalette):
            return Qt.ItemIsEnabled | Qt.ItemIsSelectable
        else:
            return Qt.NoItemFlags

    def indexOf(self, x):
        if isinstance(x, str):
            for i, item in enumerate(self.items):
                if not isinstance(item, str) \
                        and x in (item.name, item.friendly_name):
                    return i
        elif isinstance(x, ContinuousPalette):
            return self.items.index(x)
        return None


class ListSingleSelectionModel(QItemSelectionModel):
    """ Item selection model for list item models with single selection.

    Defines signal:
        - selectedIndexChanged(QModelIndex)

    """
    selectedIndexChanged = Signal(QModelIndex)

    def __init__(self, model, parent=None):
        QItemSelectionModel.__init__(self, model, parent)
        self.selectionChanged.connect(self.onSelectionChanged)

    def onSelectionChanged(self, new, _):
        index = list(new.indexes())
        if index:
            index = index.pop()
        else:
            index = QModelIndex()

        self.selectedIndexChanged.emit(index)

    def selectedRow(self):
        """ Return QModelIndex of the selected row or invalid if no selection.
        """
        rows = self.selectedRows()
        if rows:
            return rows[0]
        else:
            return QModelIndex()

    def select(self, index, flags=QItemSelectionModel.ClearAndSelect):
        if isinstance(index, int):
            index = self.model().index(index)
        return QItemSelectionModel.select(self, index, flags)


def select_row(view, row):
    """
    Select a `row` in an item view.
    """
    selmodel = view.selectionModel()
    selmodel.select(view.model().index(row, 0),
                    QItemSelectionModel.ClearAndSelect |
                    QItemSelectionModel.Rows)


def select_rows(view, row_indices, command=QItemSelectionModel.ClearAndSelect):
    """
    Select several rows in view.

    :param QAbstractItemView view:
    :param row_indices: Integer indices of rows to select.
    :param command: QItemSelectionModel.SelectionFlags
    """
    selmodel = view.selectionModel()
    model = view.model()
    selection = QItemSelection()
    for row in row_indices:
        index = model.index(row, 0)
        selection.select(index, index)
    selmodel.select(selection, command | QItemSelectionModel.Rows)


class ModelActionsWidget(QWidget):
    def __init__(self, actions=None, parent=None,
                 direction=QBoxLayout.LeftToRight):
        QWidget.__init__(self, parent)
        self.actions = []
        self.buttons = []
        layout = QBoxLayout(direction)
        layout.setContentsMargins(0, 0, 0, 0)
        self.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)
        if actions is not None:
            for action in actions:
                self.addAction(action)
        self.setLayout(layout)

    def actionButton(self, action):
        if isinstance(action, QAction):
            button = QToolButton(self)
            button.setDefaultAction(action)
            return button
        elif isinstance(action, QAbstractButton):
            return action

    def insertAction(self, ind, action, *args):
        button = self.actionButton(action)
        self.layout().insertWidget(ind, button, *args)
        self.buttons.insert(ind, button)
        self.actions.insert(ind, action)
        return button

    def addAction(self, action, *args):
        return self.insertAction(-1, action, *args)


class TableModel(AbstractSortTableModel):
    """
    An adapter for using Orange.data.Table within Qt's Item View Framework.

    :param Orange.data.Table sourcedata: Source data table.
    :param QObject parent:
    """
    #: Orange.data.Value for the index.
    ValueRole = gui.TableValueRole  # next(gui.OrangeUserRole)
    #: Orange.data.Value of the row's class.
    ClassValueRole = gui.TableClassValueRole  # next(gui.OrangeUserRole)
    #: Orange.data.Variable of the column.
    VariableRole = gui.TableVariable  # next(gui.OrangeUserRole)
    #: Basic statistics of the column
    VariableStatsRole = next(gui.OrangeUserRole)
    #: The column's role (position) in the domain.
    #: One of Attribute, ClassVar or Meta
    DomainRole = next(gui.OrangeUserRole)

    #: Column domain roles
    ClassVar, Meta, Attribute = range(3)

    #: Default background color for domain roles
    ColorForRole = {
        ClassVar: QColor(160, 160, 160),
        Meta: QColor(220, 220, 200),
        Attribute: None,
    }

    #: Standard column descriptor
    Column = namedtuple(
        "Column", ["var", "role", "background", "format"])
    #: Basket column descriptor (i.e. sparse X/Y/metas/ compressed into
    #: a single column).
    Basket = namedtuple(
        "Basket", ["vars", "role", "background", "density", "format"])

    # The class uses the same names (X_density etc) as Table
    # pylint: disable=invalid-name
    def __init__(self, sourcedata, parent=None):
        super().__init__(parent)
        self.source = sourcedata
        self.domain = domain = sourcedata.domain

        self.X_density = sourcedata.X_density()
        self.Y_density = sourcedata.Y_density()
        self.M_density = sourcedata.metas_density()

        brush_for_role = {
            role: QBrush(c) if c is not None else None
            for role, c in self.ColorForRole.items()
        }

        def format_sparse(vars, row):
            row = row.tocsr()
            return ", ".join("{}={}".format(vars[i].name, vars[i].str_val(v))
                             for i, v in zip(row.indices, row.data))

        def format_sparse_bool(vars, row):
            row = row.tocsr()
            return ", ".join(vars[i].name for i in row.indices)

        def format_dense(var, val):
            return var.str_val(val)

        def make_basket_formatter(vars, density):
            formatter = (format_sparse if density == Storage.SPARSE
                         else format_sparse_bool)
            return partial(formatter, vars)

        def make_basket(vars, density, role):
            return TableModel.Basket(
                vars, TableModel.Attribute, brush_for_role[role], density,
                make_basket_formatter(vars, density)
            )

        def make_column(var, role):
            return TableModel.Column(
                var, role, brush_for_role[role],
                partial(format_dense, var)
            )

        columns = []

        if self.Y_density != Storage.DENSE and domain.class_vars:
            coldesc = make_basket(domain.class_vars, self.Y_density,
                                  TableModel.ClassVar)
            columns.append(coldesc)
        else:
            columns += [make_column(var, TableModel.ClassVar)
                        for var in domain.class_vars]

        if self.M_density != Storage.DENSE and domain.metas:
            coldesc = make_basket(domain.metas, self.M_density,
                                  TableModel.Meta)
            columns.append(coldesc)
        else:
            columns += [make_column(var, TableModel.Meta)
                        for var in domain.metas]

        if self.X_density != Storage.DENSE and domain.attributes:
            coldesc = make_basket(domain.attributes, self.X_density,
                                  TableModel.Attribute)
            columns.append(coldesc)
        else:
            columns += [make_column(var, TableModel.Attribute)
                        for var in domain.attributes]

        #: list of all domain variables (class_vars + metas + attrs)
        self.vars = domain.class_vars + domain.metas + domain.attributes
        self.columns = columns

        #: A list of all unique attribute labels (in all variables)
        self._labels = sorted(
            reduce(operator.ior,
                   [set(var.attributes) for var in self.vars],
                   set()))

        # column basic statistics (VariableStatsRole), computed when
        # first needed.
        self.__stats = None
        self.__rowCount = sourcedata.approx_len()
        self.__columnCount = len(self.columns)

        if self.__rowCount > (2 ** 31 - 1):
            raise ValueError("len(sourcedata) > 2 ** 31 - 1")

    def _get_source_item(self, row, coldesc):
        if isinstance(coldesc, self.Basket):
            # `self.source[row:row + 1]` returns Table
            # `self.source[row]` returns RowInstance
            if coldesc.role is self.ClassVar:
                return self.source[row:row + 1].Y
            if coldesc.role is self.Meta:
                return self.source[row:row + 1].metas
            if coldesc.role is self.Attribute:
                return self.source[row:row + 1].X
        return self.source[row, coldesc.var]

    def sortColumnData(self, column):
        return self._columnSortKeyData(column, TableModel.ValueRole)

    @deprecated('Orange.widgets.utils.itemmodels.TableModel.sortColumnData')
    def columnSortKeyData(self, column, role):
        return self._columnSortKeyData(column, role)

    def _columnSortKeyData(self, column, role):
        """
        Return a sequence of source table objects which can be used as
        `keys` for sorting.

        :param int column: Sort column.
        :param Qt.ItemRole role: Sort item role.

        """
        coldesc = self.columns[column]
        if isinstance(coldesc, TableModel.Column) \
                and role == TableModel.ValueRole:
            return self.source.get_column(coldesc.var)
        else:
            return numpy.asarray([self.index(i, column).data(role)
                                  for i in range(self.rowCount())])

    def data(self, index, role,
             # For optimizing out LOAD_GLOBAL byte code instructions in
             # the item role tests.
             _str=str,
             _Qt_DisplayRole=Qt.DisplayRole,
             _Qt_EditRole=Qt.EditRole,
             _Qt_BackgroundRole=Qt.BackgroundRole,
             _Qt_ForegroundRole=Qt.ForegroundRole,
             _ValueRole=ValueRole,
             _ClassValueRole=ClassValueRole,
             _VariableRole=VariableRole,
             _DomainRole=DomainRole,
             _VariableStatsRole=VariableStatsRole,
             # Some cached local precomputed values.
             # All of the above roles we respond to
             _recognizedRoles=frozenset([Qt.DisplayRole,
                                         Qt.EditRole,
                                         Qt.BackgroundRole,
                                         Qt.ForegroundRole,
                                         ValueRole,
                                         ClassValueRole,
                                         VariableRole,
                                         DomainRole,
                                         VariableStatsRole])):
        """
        Reimplemented from `QAbstractItemModel.data`
        """
        if role not in _recognizedRoles:
            return None

        row = index.row()
        if not 0 <= row <= self.__rowCount:
            return None

        row = self.mapToSourceRows(row)
        col = 0 if role is _ClassValueRole else index.column()

        try:
            coldesc = self.columns[col]
            instance = self._get_source_item(row, coldesc)
        except IndexError:
            self.layoutAboutToBeChanged.emit()
            self.beginRemoveRows(self.parent(), row, max(self.rowCount(), row))
            self.__rowCount = min(row, self.__rowCount)
            self.endRemoveRows()
            self.layoutChanged.emit()
            return None

        if role == _Qt_DisplayRole:
            return coldesc.format(instance)
        elif role in (_Qt_EditRole, _ValueRole) and isinstance(coldesc, TableModel.Column):
            return Value(coldesc.var, instance)
        elif role == _Qt_BackgroundRole:
            return coldesc.background
        elif role == _Qt_ForegroundRole:
            # The background is light-ish, force dark text color
            return coldesc.background and QColor(0, 0, 0, 200)
        elif role == _ClassValueRole \
                and isinstance(coldesc, TableModel.Column) \
                and len(self.domain.class_vars) == 1:
            return Value(coldesc.var, instance)
        elif role == _VariableRole and isinstance(coldesc, TableModel.Column):
            return coldesc.var
        elif role == _DomainRole:
            return coldesc.role
        elif role == _VariableStatsRole:
            return self._stats_for_column(col)
        else:
            return None

    def setData(self, index, value, role):
        row = self.mapFromSourceRows(index.row())
        if role == Qt.EditRole:
            try:
                self.source[row, index.column()] = value
            except (TypeError, IndexError):
                return False
            else:
                self.dataChanged.emit(index, index)
                return True
        else:
            return False

    def parent(self, index=QModelIndex()):
        """Reimplemented from `QAbstractTableModel.parent`."""
        return QModelIndex()

    def rowCount(self, parent=QModelIndex()):
        """Reimplemented from `QAbstractTableModel.rowCount`."""
        return 0 if parent.isValid() else self.__rowCount

    def columnCount(self, parent=QModelIndex()):
        """Reimplemented from `QAbstractTableModel.columnCount`."""
        return 0 if parent.isValid() else self.__columnCount

    def headerData(self, section, orientation, role):
        """Reimplemented from `QAbstractTableModel.headerData`."""
        if orientation == Qt.Vertical:
            if role == Qt.DisplayRole:
                return int(self.mapToSourceRows(section) + 1)
            return None

        coldesc = self.columns[section]
        if role == Qt.DisplayRole:
            if isinstance(coldesc, TableModel.Basket):
                return "{...}"
            else:
                return coldesc.var.name
        elif role == Qt.ToolTipRole:
            return self._tooltip(coldesc)
        elif role == TableModel.VariableRole \
                and isinstance(coldesc, TableModel.Column):
            return coldesc.var
        elif role == TableModel.VariableStatsRole:
            return self._stats_for_column(section)
        elif role == TableModel.DomainRole:
            return coldesc.role
        else:
            return None

    def _tooltip(self, coldesc):
        """
        Return an header tool tip text for an `column` descriptor.
        """
        if isinstance(coldesc, TableModel.Basket):
            return None

        labels = self._labels
        variable = coldesc.var
        pairs = [(escape(key), escape(str(variable.attributes[key])))
                 for key in labels if key in variable.attributes]
        tip = "<b>%s</b>" % escape(variable.name)
        tip = "<br/>".join([tip] + ["%s = %s" % pair for pair in pairs])
        return tip

    def _stats_for_column(self, column):
        """
        Return BasicStats for `column` index.
        """
        coldesc = self.columns[column]
        if isinstance(coldesc, TableModel.Basket):
            return None

        if self.__stats is None:
            self.__stats = datacaching.getCached(
                self.source, basic_stats.DomainBasicStats,
                (self.source, True)
            )

        return self.__stats[coldesc.var]

```
--- 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