{
    "file_diffs": [
        {
            "old_file_content": "from collections import namedtuple\nfrom contextlib import contextmanager\nfrom dataclasses import dataclass\nfrom functools import partial\nfrom typing import Any, Dict, List, Optional, Set\n\nimport pandas as pd\nfrom numpy import nan\nfrom AnyQt.QtCore import (\n    QAbstractTableModel,\n    QEvent,\n    QItemSelectionModel,\n    QModelIndex,\n    Qt,\n)\nfrom AnyQt.QtWidgets import (\n    QAbstractItemView,\n    QCheckBox,\n    QGridLayout,\n    QHeaderView,\n    QListView,\n    QTableView,\n)\nfrom orangewidget.settings import ContextSetting, Setting\nfrom orangewidget.utils.listview import ListViewSearch\nfrom orangewidget.utils.signals import Input, Output\nfrom orangewidget.widget import Msg\n\nfrom Orange.data import (\n    ContinuousVariable,\n    DiscreteVariable,\n    Domain,\n    StringVariable,\n    Table,\n    TimeVariable,\n    Variable,\n)\nfrom Orange.data.aggregate import OrangeTableGroupBy\nfrom Orange.util import wrap_callback\nfrom Orange.widgets import gui\nfrom Orange.widgets.data.oweditdomain import disconnected\nfrom Orange.widgets.settings import DomainContextHandler\nfrom Orange.widgets.utils.concurrent import ConcurrentWidgetMixin, TaskState\nfrom Orange.widgets.utils.itemmodels import DomainModel\nfrom Orange.widgets.widget import OWWidget\n\nAggregation = namedtuple(\"Aggregation\", [\"function\", \"types\"])\n\n\ndef concatenate(x):\n    \"\"\"\n    Concatenate values of series if value is not missing (nan or empty string\n    for StringVariable)\n    \"\"\"\n    return \" \".join(str(v) for v in x if not pd.isnull(v) and len(str(v)) > 0)\n\n\nAGGREGATIONS = {\n    \"Mean\": Aggregation(\"mean\", {ContinuousVariable, TimeVariable}),\n    \"Median\": Aggregation(\"median\", {ContinuousVariable, TimeVariable}),\n    \"Mode\": Aggregation(\n        lambda x: pd.Series.mode(x).get(0, nan), {ContinuousVariable, TimeVariable}\n    ),\n    \"Standard deviation\": Aggregation(\"std\", {ContinuousVariable, TimeVariable}),\n    \"Variance\": Aggregation(\"var\", {ContinuousVariable, TimeVariable}),\n    \"Sum\": Aggregation(\"sum\", {ContinuousVariable, TimeVariable}),\n    \"Concatenate\": Aggregation(\n        concatenate,\n        {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable},\n    ),\n    \"Min. value\": Aggregation(\"min\", {ContinuousVariable, TimeVariable}),\n    \"Max. value\": Aggregation(\"max\", {ContinuousVariable, TimeVariable}),\n    \"Span\": Aggregation(\n        lambda x: pd.Series.max(x) - pd.Series.min(x),\n        {ContinuousVariable, TimeVariable},\n    ),\n    \"First value\": Aggregation(\n        \"first\", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}\n    ),\n    \"Last value\": Aggregation(\n        \"last\", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}\n    ),\n    \"Random value\": Aggregation(\n        lambda x: x.sample(1, random_state=0),\n        {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable},\n    ),\n    \"Count defined\": Aggregation(\n        \"count\", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}\n    ),\n    \"Count\": Aggregation(\n        \"size\", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}\n    ),\n    \"Proportion defined\": Aggregation(\n        lambda x: x.count() / x.size,\n        {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable},\n    ),\n}\n# list of ordered aggregation names is required on several locations so we\n# prepare it in advance\nAGGREGATIONS_ORD = list(AGGREGATIONS)\n\n# use first aggregation suitable for each type as default\nDEFAULT_AGGREGATIONS = {\n    var: {next(name for name, agg in AGGREGATIONS.items() if var in agg.types)}\n    for var in (ContinuousVariable, TimeVariable, DiscreteVariable, StringVariable)\n}\n\n\n@dataclass\nclass Result:\n    group_by: OrangeTableGroupBy = None\n    result_table: Optional[Table] = None\n\n\ndef _run(\n    data: Table,\n    group_by_attrs: List[Variable],\n    aggregations: Dict[Variable, Set[str]],\n    result: Result,\n    state: TaskState,\n) -> Result:\n    def progress(part):\n        state.set_progress_value(part * 100)\n        if state.is_interruption_requested():\n            raise Exception\n\n    state.set_status(\"Aggregating\")\n    # group table rows\n    if result.group_by is None:\n        result.group_by = data.groupby(group_by_attrs)\n    state.set_partial_result(result)\n\n    aggregations = {\n        var: [\n            (agg, AGGREGATIONS[agg].function)\n            for agg in sorted(aggs, key=AGGREGATIONS_ORD.index)\n        ]\n        for var, aggs in aggregations.items()\n    }\n    result.result_table = result.group_by.aggregate(\n        aggregations, wrap_callback(progress, 0.2, 1)\n    )\n    return result\n\n\nclass TabColumn:\n    attribute = 0\n    aggregations = 1\n\n\nTABLE_COLUMN_NAMES = [\"Attributes\", \"Aggregations\"]\n\n\nclass VarTableModel(QAbstractTableModel):\n    def __init__(self, parent: \"OWGroupBy\", *args):\n        super().__init__(*args)\n        self.domain = None\n        self.parent = parent\n\n    def set_domain(self, domain: Domain) -> None:\n        \"\"\"\n        Reset the table view to new domain\n        \"\"\"\n        self.domain = domain\n        self.modelReset.emit()\n\n    def update_aggregation(self, attribute: str) -> None:\n        \"\"\"\n        Reset the aggregation values in the table for the attribute\n        \"\"\"\n        index = self.domain.index(attribute)\n        if index < 0:\n            # indices of metas are negative: first meta -1, second meta -2, ...\n            index = len(self.domain.variables) - 1 - index\n        index = self.index(index, 1)\n        self.dataChanged.emit(index, index)\n\n    def rowCount(self, parent=None) -> int:\n        return (\n            0\n            if self.domain is None or (parent is not None and parent.isValid())\n            else len(self.domain.variables) + len(self.domain.metas)\n        )\n\n    @staticmethod\n    def columnCount(parent=None) -> int:\n        return 0 if parent is not None and parent.isValid() else len(TABLE_COLUMN_NAMES)\n\n    def data(self, index, role=Qt.DisplayRole) -> Any:\n        row, col = index.row(), index.column()\n        val = (self.domain.variables + self.domain.metas)[row]\n        if role in (Qt.DisplayRole, Qt.EditRole):\n            if col == TabColumn.attribute:\n                return str(val)\n            else:  # col == TabColumn.aggregations\n                # plot first two aggregations comma separated and write n more\n                # for others\n                aggs = sorted(\n                    self.parent.aggregations.get(val, []), key=AGGREGATIONS_ORD.index\n                )\n                n_more = \"\" if len(aggs) <= 3 else f\" and {len(aggs) - 3} more\"\n                return \", \".join(aggs[:3]) + n_more\n        elif role == Qt.DecorationRole and col == TabColumn.attribute:\n            return gui.attributeIconDict[val]\n        return None\n\n    def headerData(self, i, orientation, role=Qt.DisplayRole) -> str:\n        if orientation == Qt.Horizontal and role == Qt.DisplayRole and i < 2:\n            return TABLE_COLUMN_NAMES[i]\n        return super().headerData(i, orientation, role)\n\n\nclass AggregateListViewSearch(ListViewSearch):\n    \"\"\"ListViewSearch that disables unselecting all items in the list\"\"\"\n\n    def selectionCommand(\n        self, index: QModelIndex, event: QEvent = None\n    ) -> QItemSelectionModel.SelectionFlags:\n        flags = super().selectionCommand(index, event)\n        selmodel = self.selectionModel()\n        if not index.isValid():  # Click on empty viewport; don't clear\n            return QItemSelectionModel.NoUpdate\n        if selmodel.isSelected(index):\n            currsel = selmodel.selectedIndexes()\n            if len(currsel) == 1 and index == currsel[0]:\n                # Is the last selected index; do not deselect it\n                return QItemSelectionModel.NoUpdate\n        if (\n            event is not None\n            and event.type() == QEvent.MouseMove\n            and flags & QItemSelectionModel.ToggleCurrent\n        ):\n            # Disable ctrl drag 'toggle'; can be made to deselect the last\n            # index, would need to keep track of the current selection\n            # (selectionModel does this but does not expose it)\n            flags &= ~QItemSelectionModel.Toggle\n            flags |= QItemSelectionModel.Select\n        return flags\n\n\nclass CheckBox(QCheckBox):\n    def __init__(self, text, parent):\n        super().__init__(text)\n        self.parent: OWGroupBy = parent\n\n    def nextCheckState(self) -> None:\n        \"\"\"\n        Custom behaviour for switching between steps. It is required since\n        sometimes user will select different types of attributes at the same\n        time. In this case we step between unchecked, partially checked and\n        checked or just between unchecked and checked - depending on situation\n        \"\"\"\n        if self.checkState() == Qt.Checked:\n            # if checked always uncheck\n            self.setCheckState(Qt.Unchecked)\n        else:\n            agg = self.text()\n            selected_attrs = self.parent.get_selected_attributes()\n            types = set(type(attr) for attr in selected_attrs)\n            can_be_applied_all = types <= AGGREGATIONS[agg].types\n\n            # true if aggregation applied to all attributes that can be\n            # aggregated with selected aggregation\n            applied_all = all(\n                type(attr) not in AGGREGATIONS[agg].types\n                or agg in self.parent.aggregations[attr]\n                for attr in selected_attrs\n            )\n            if self.checkState() == Qt.PartiallyChecked:\n                # if partially check: 1) check if agg can be applied to all\n                # 2) else uncheck if agg already applied to all\n                # 3) else leve partially checked to apply to all that can be aggregated\n                if can_be_applied_all:\n                    self.setCheckState(Qt.Checked)\n                elif applied_all:\n                    self.setCheckState(Qt.Unchecked)\n                else:\n                    self.setCheckState(Qt.PartiallyChecked)\n                    # since checkbox state stay same signal is not emitted\n                    # automatically but we need a callback call so we emit it\n                    self.stateChanged.emit(Qt.PartiallyChecked)\n            else:  # self.checkState() == Qt.Unchecked\n                # if unchecked: check if all can be checked else partially check\n                self.setCheckState(\n                    Qt.Checked if can_be_applied_all else Qt.PartiallyChecked\n                )\n\n\n@contextmanager\ndef block_signals(widget):\n    widget.blockSignals(True)\n    try:\n        yield\n    finally:\n        widget.blockSignals(False)\n\n\nclass OWGroupBy(OWWidget, ConcurrentWidgetMixin):\n    name = \"Group by\"\n    description = \"\"\n    category = \"Transform\"\n    icon = \"icons/GroupBy.svg\"\n    keywords = [\"aggregate\", \"group by\"]\n\n    class Inputs:\n        data = Input(\"Data\", Table, doc=\"Input data table\")\n\n    class Outputs:\n        data = Output(\"Data\", Table, doc=\"Aggregated data\")\n\n    class Error(OWWidget.Error):\n        unexpected_error = Msg(\"{}\")\n\n    settingsHandler = DomainContextHandler()\n\n    gb_attrs: List[Variable] = ContextSetting([])\n    aggregations: Dict[Variable, Set[str]] = ContextSetting({})\n    auto_commit: bool = Setting(True)\n\n    def __init__(self):\n        super().__init__()\n        ConcurrentWidgetMixin.__init__(self)\n\n        self.data = None\n        self.result = None\n\n        self.gb_attrs_model = DomainModel(\n            separators=False,\n        )\n        self.agg_table_model = VarTableModel(self)\n        self.agg_checkboxes = {}\n\n        self.__init_control_area()\n        self.__init_main_area()\n\n    def __init_control_area(self) -> None:\n        \"\"\"Init all controls in the control area\"\"\"\n        box = gui.vBox(self.controlArea, \"Group by\")\n        self.gb_attrs_view = AggregateListViewSearch(\n            selectionMode=QListView.ExtendedSelection\n        )\n        self.gb_attrs_view.setModel(self.gb_attrs_model)\n        self.gb_attrs_view.selectionModel().selectionChanged.connect(self.__gb_changed)\n        box.layout().addWidget(self.gb_attrs_view)\n\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    def __init_main_area(self) -> None:\n        \"\"\"Init all controls in the main area\"\"\"\n        # aggregation table\n        self.agg_table_view = tableview = QTableView()\n        tableview.setModel(self.agg_table_model)\n        tableview.setSelectionBehavior(QAbstractItemView.SelectRows)\n        tableview.selectionModel().selectionChanged.connect(self.__rows_selected)\n        tableview.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)\n\n        vbox = gui.vBox(self.mainArea, \" \")\n        vbox.layout().addWidget(tableview)\n\n        # aggregations checkboxes\n        grid_layout = QGridLayout()\n        gui.widgetBox(self.mainArea, orientation=grid_layout, box=\"Aggregations\")\n\n        col = 0\n        row = 0\n        break_rows = (5, 5, 99)\n        for agg in AGGREGATIONS:\n            self.agg_checkboxes[agg] = cb = CheckBox(agg, self)\n            cb.setDisabled(True)\n            cb.stateChanged.connect(partial(self.__aggregation_changed, agg))\n            grid_layout.addWidget(cb, row, col)\n            row += 1\n            if row == break_rows[col]:\n                row = 0\n                col += 1\n\n    ############\n    # Callbacks\n\n    def __rows_selected(self) -> None:\n        \"\"\"Callback for table selection change; update checkboxes\"\"\"\n        selected_attrs = self.get_selected_attributes()\n\n        types = {type(attr) for attr in selected_attrs}\n        active_aggregations = [self.aggregations[attr] for attr in selected_attrs]\n        for agg, cb in self.agg_checkboxes.items():\n            cb.setDisabled(not types & AGGREGATIONS[agg].types)\n\n            activated = {agg in a for a in active_aggregations}\n            with block_signals(cb):\n                # check if aggregation active for all selected attributes,\n                # partially check if active for some else uncheck\n                cb.setCheckState(\n                    Qt.Checked\n                    if activated == {True}\n                    else (Qt.Unchecked if activated == {False} else Qt.PartiallyChecked)\n                )\n\n    def __gb_changed(self) -> None:\n        \"\"\"\n        Callback for Group-by attributes selection change; update attribute\n        and call commit\n        \"\"\"\n        rows = self.gb_attrs_view.selectionModel().selectedRows()\n        values = self.gb_attrs_view.model()[:]\n        self.gb_attrs = [values[row.row()] for row in sorted(rows)]\n        # everything cached in result should be recomputed on gb change\n        self.result = Result()\n        self.commit.deferred()\n\n    def __aggregation_changed(self, agg: str) -> None:\n        \"\"\"\n        Callback for aggregation change; update aggregations dictionary and call\n        commit\n        \"\"\"\n        selected_attrs = self.get_selected_attributes()\n        for attr in selected_attrs:\n            if self.agg_checkboxes[agg].isChecked() and self.__aggregation_compatible(\n                agg, attr\n            ):\n                self.aggregations[attr].add(agg)\n            else:\n                self.aggregations[attr].discard(agg)\n            self.agg_table_model.update_aggregation(attr)\n        self.commit.deferred()\n\n    @Inputs.data\n    def set_data(self, data: Table) -> None:\n        self.closeContext()\n        self.data = data\n\n        # reset states\n        self.cancel()\n        self.result = Result()\n        self.Outputs.data.send(None)\n        self.gb_attrs_model.set_domain(data.domain if data else None)\n        self.gb_attrs = data.domain[:1] if data else []\n        self.aggregations = (\n            {\n                attr: DEFAULT_AGGREGATIONS[type(attr)].copy()\n                for attr in data.domain.variables + data.domain.metas\n            }\n            if data\n            else {}\n        )\n\n        self.openContext(self.data)\n\n        # update selections in widgets and re-plot\n        self.agg_table_model.set_domain(data.domain if data else None)\n        self._set_gb_selection()\n\n        self.commit.now()\n\n    #########################\n    # Task connected methods\n\n    @gui.deferred\n    def commit(self) -> None:\n        self.Error.clear()\n        self.Warning.clear()\n        if self.data:\n            self.start(_run, self.data, self.gb_attrs, self.aggregations, self.result)\n\n    def on_done(self, result: Result) -> None:\n        self.result = result\n        self.Outputs.data.send(result.result_table)\n\n    def on_partial_result(self, result: Result) -> None:\n        # store result in case the task is canceled and on_done is not called\n        self.result = result\n\n    def on_exception(self, ex: Exception):\n        self.Error.unexpected_error(str(ex))\n\n    ###################\n    # Helper methods\n\n    def get_selected_attributes(self):\n        \"\"\"Get select attributes in the table\"\"\"\n        selection_model = self.agg_table_view.selectionModel()\n        sel_rows = selection_model.selectedRows()\n        vars_ = self.data.domain.variables + self.data.domain.metas\n        return [vars_[index.row()] for index in sel_rows]\n\n    def _set_gb_selection(self) -> None:\n        \"\"\"Set selection in groupby list according to self.gb_attrs\"\"\"\n        sm = self.gb_attrs_view.selectionModel()\n        values = self.gb_attrs_model[:]\n        with disconnected(sm.selectionChanged, self.__gb_changed):\n            for val in self.gb_attrs:\n                index = values.index(val)\n                model_index = self.gb_attrs_model.index(index, 0)\n                sm.select(model_index, QItemSelectionModel.Select)\n\n    @staticmethod\n    def __aggregation_compatible(agg, attr):\n        \"\"\"Check a compatibility of aggregation with the variable\"\"\"\n        return type(attr) in AGGREGATIONS[agg].types\n\n\nif __name__ == \"__main__\":\n    # pylint: disable=ungrouped-imports\n    from orangewidget.utils.widgetpreview import WidgetPreview\n\n    WidgetPreview(OWGroupBy).run(Table(\"iris\"))\n",
            "new_file_content": "from collections import namedtuple\nfrom contextlib import contextmanager\nfrom dataclasses import dataclass\nfrom functools import partial\nfrom typing import Any, Dict, List, Optional, Set\n\nimport pandas as pd\nfrom numpy import nan\nfrom AnyQt.QtCore import (\n    QAbstractTableModel,\n    QEvent,\n    QItemSelectionModel,\n    QModelIndex,\n    Qt,\n)\nfrom AnyQt.QtWidgets import (\n    QAbstractItemView,\n    QCheckBox,\n    QGridLayout,\n    QHeaderView,\n    QListView,\n    QTableView,\n)\nfrom orangewidget.settings import ContextSetting, Setting\nfrom orangewidget.utils.listview import ListViewSearch\nfrom orangewidget.utils.signals import Input, Output\nfrom orangewidget.widget import Msg\n\nfrom Orange.data import (\n    ContinuousVariable,\n    DiscreteVariable,\n    Domain,\n    StringVariable,\n    Table,\n    TimeVariable,\n    Variable,\n)\nfrom Orange.data.aggregate import OrangeTableGroupBy\nfrom Orange.util import wrap_callback\nfrom Orange.widgets import gui\nfrom Orange.widgets.data.oweditdomain import disconnected\nfrom Orange.widgets.settings import DomainContextHandler\nfrom Orange.widgets.utils.concurrent import ConcurrentWidgetMixin, TaskState\nfrom Orange.widgets.utils.itemmodels import DomainModel\nfrom Orange.widgets.widget import OWWidget\n\nAggregation = namedtuple(\"Aggregation\", [\"function\", \"types\"])\n\n\ndef concatenate(x):\n    \"\"\"\n    Concatenate values of series if value is not missing (nan or empty string\n    for StringVariable)\n    \"\"\"\n    return \" \".join(str(v) for v in x if not pd.isnull(v) and len(str(v)) > 0)\n\n\nAGGREGATIONS = {\n    \"Mean\": Aggregation(\"mean\", {ContinuousVariable, TimeVariable}),\n    \"Median\": Aggregation(\"median\", {ContinuousVariable, TimeVariable}),\n    \"Mode\": Aggregation(\n        lambda x: pd.Series.mode(x).get(0, nan), {ContinuousVariable, TimeVariable}\n    ),\n    \"Standard deviation\": Aggregation(\"std\", {ContinuousVariable, TimeVariable}),\n    \"Variance\": Aggregation(\"var\", {ContinuousVariable, TimeVariable}),\n    \"Sum\": Aggregation(\"sum\", {ContinuousVariable, TimeVariable}),\n    \"Concatenate\": Aggregation(\n        concatenate,\n        {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable},\n    ),\n    \"Min. value\": Aggregation(\"min\", {ContinuousVariable, TimeVariable}),\n    \"Max. value\": Aggregation(\"max\", {ContinuousVariable, TimeVariable}),\n    \"Span\": Aggregation(\n        lambda x: pd.Series.max(x) - pd.Series.min(x),\n        {ContinuousVariable, TimeVariable},\n    ),\n    \"First value\": Aggregation(\n        \"first\", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}\n    ),\n    \"Last value\": Aggregation(\n        \"last\", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}\n    ),\n    \"Random value\": Aggregation(\n        lambda x: x.sample(1, random_state=0),\n        {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable},\n    ),\n    \"Count defined\": Aggregation(\n        \"count\", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}\n    ),\n    \"Count\": Aggregation(\n        \"size\", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}\n    ),\n    \"Proportion defined\": Aggregation(\n        lambda x: x.count() / x.size,\n        {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable},\n    ),\n}\n# list of ordered aggregation names is required on several locations so we\n# prepare it in advance\nAGGREGATIONS_ORD = list(AGGREGATIONS)\n\n# use first aggregation suitable for each type as default\nDEFAULT_AGGREGATIONS = {\n    var: {next(name for name, agg in AGGREGATIONS.items() if var in agg.types)}\n    for var in (ContinuousVariable, TimeVariable, DiscreteVariable, StringVariable)\n}\n\n\n@dataclass\nclass Result:\n    group_by: OrangeTableGroupBy = None\n    result_table: Optional[Table] = None\n\n\ndef _run(\n    data: Table,\n    group_by_attrs: List[Variable],\n    aggregations: Dict[Variable, Set[str]],\n    result: Result,\n    state: TaskState,\n) -> Result:\n    def progress(part):\n        state.set_progress_value(part * 100)\n        if state.is_interruption_requested():\n            raise Exception\n\n    state.set_status(\"Aggregating\")\n    # group table rows\n    if result.group_by is None:\n        result.group_by = data.groupby(group_by_attrs)\n    state.set_partial_result(result)\n\n    aggregations = {\n        var: [\n            (agg, AGGREGATIONS[agg].function)\n            for agg in sorted(aggs, key=AGGREGATIONS_ORD.index)\n        ]\n        for var, aggs in aggregations.items()\n    }\n    result.result_table = result.group_by.aggregate(\n        aggregations, wrap_callback(progress, 0.2, 1)\n    )\n    return result\n\n\nclass TabColumn:\n    attribute = 0\n    aggregations = 1\n\n\nTABLE_COLUMN_NAMES = [\"Attributes\", \"Aggregations\"]\n\n\nclass VarTableModel(QAbstractTableModel):\n    def __init__(self, parent: \"OWGroupBy\", *args):\n        super().__init__(*args)\n        self.domain = None\n        self.parent = parent\n\n    def set_domain(self, domain: Domain) -> None:\n        \"\"\"\n        Reset the table view to new domain\n        \"\"\"\n        self.domain = domain\n        self.modelReset.emit()\n\n    def update_aggregation(self, attribute: str) -> None:\n        \"\"\"\n        Reset the aggregation values in the table for the attribute\n        \"\"\"\n        index = self.domain.index(attribute)\n        if index < 0:\n            # indices of metas are negative: first meta -1, second meta -2, ...\n            index = len(self.domain.variables) - 1 - index\n        index = self.index(index, 1)\n        self.dataChanged.emit(index, index)\n\n    def rowCount(self, parent=None) -> int:\n        return (\n            0\n            if self.domain is None or (parent is not None and parent.isValid())\n            else len(self.domain.variables) + len(self.domain.metas)\n        )\n\n    @staticmethod\n    def columnCount(parent=None) -> int:\n        return 0 if parent is not None and parent.isValid() else len(TABLE_COLUMN_NAMES)\n\n    def data(self, index, role=Qt.DisplayRole) -> Any:\n        row, col = index.row(), index.column()\n        val = (self.domain.variables + self.domain.metas)[row]\n        if role in (Qt.DisplayRole, Qt.EditRole):\n            if col == TabColumn.attribute:\n                return str(val)\n            else:  # col == TabColumn.aggregations\n                # plot first two aggregations comma separated and write n more\n                # for others\n                aggs = sorted(\n                    self.parent.aggregations.get(val, []), key=AGGREGATIONS_ORD.index\n                )\n                n_more = \"\" if len(aggs) <= 3 else f\" and {len(aggs) - 3} more\"\n                return \", \".join(aggs[:3]) + n_more\n        elif role == Qt.DecorationRole and col == TabColumn.attribute:\n            return gui.attributeIconDict[val]\n        return None\n\n    def headerData(self, i, orientation, role=Qt.DisplayRole) -> str:\n        if orientation == Qt.Horizontal and role == Qt.DisplayRole and i < 2:\n            return TABLE_COLUMN_NAMES[i]\n        return super().headerData(i, orientation, role)\n\n\nclass AggregateListViewSearch(ListViewSearch):\n    \"\"\"ListViewSearch that disables unselecting all items in the list\"\"\"\n\n    def selectionCommand(\n        self, index: QModelIndex, event: QEvent = None\n    ) -> QItemSelectionModel.SelectionFlags:\n        flags = super().selectionCommand(index, event)\n        selmodel = self.selectionModel()\n        if not index.isValid():  # Click on empty viewport; don't clear\n            return QItemSelectionModel.NoUpdate\n        if selmodel.isSelected(index):\n            currsel = selmodel.selectedIndexes()\n            if len(currsel) == 1 and index == currsel[0]:\n                # Is the last selected index; do not deselect it\n                return QItemSelectionModel.NoUpdate\n        if (\n            event is not None\n            and event.type() == QEvent.MouseMove\n            and flags & QItemSelectionModel.ToggleCurrent\n        ):\n            # Disable ctrl drag 'toggle'; can be made to deselect the last\n            # index, would need to keep track of the current selection\n            # (selectionModel does this but does not expose it)\n            flags &= ~QItemSelectionModel.Toggle\n            flags |= QItemSelectionModel.Select\n        return flags\n\n\nclass CheckBox(QCheckBox):\n    def __init__(self, text, parent):\n        super().__init__(text)\n        self.parent: OWGroupBy = parent\n\n    def nextCheckState(self) -> None:\n        \"\"\"\n        Custom behaviour for switching between steps. It is required since\n        sometimes user will select different types of attributes at the same\n        time. In this case we step between unchecked, partially checked and\n        checked or just between unchecked and checked - depending on situation\n        \"\"\"\n        if self.checkState() == Qt.Checked:\n            # if checked always uncheck\n            self.setCheckState(Qt.Unchecked)\n        else:\n            agg = self.text()\n            selected_attrs = self.parent.get_selected_attributes()\n            types = set(type(attr) for attr in selected_attrs)\n            can_be_applied_all = types <= AGGREGATIONS[agg].types\n\n            # true if aggregation applied to all attributes that can be\n            # aggregated with selected aggregation\n            applied_all = all(\n                type(attr) not in AGGREGATIONS[agg].types\n                or agg in self.parent.aggregations[attr]\n                for attr in selected_attrs\n            )\n            if self.checkState() == Qt.PartiallyChecked:\n                # if partially check: 1) check if agg can be applied to all\n                # 2) else uncheck if agg already applied to all\n                # 3) else leve partially checked to apply to all that can be aggregated\n                if can_be_applied_all:\n                    self.setCheckState(Qt.Checked)\n                elif applied_all:\n                    self.setCheckState(Qt.Unchecked)\n                else:\n                    self.setCheckState(Qt.PartiallyChecked)\n                    # since checkbox state stay same signal is not emitted\n                    # automatically but we need a callback call so we emit it\n                    self.stateChanged.emit(Qt.PartiallyChecked)\n            else:  # self.checkState() == Qt.Unchecked\n                # if unchecked: check if all can be checked else partially check\n                self.setCheckState(\n                    Qt.Checked if can_be_applied_all else Qt.PartiallyChecked\n                )\n\n\n@contextmanager\ndef block_signals(widget):\n    widget.blockSignals(True)\n    try:\n        yield\n    finally:\n        widget.blockSignals(False)\n\n\nclass OWGroupBy(OWWidget, ConcurrentWidgetMixin):\n    name = \"Group by\"\n    description = \"\"\n    category = \"Transform\"\n    icon = \"icons/GroupBy.svg\"\n    keywords = [\"aggregate\", \"group by\"]\n\n    class Inputs:\n        data = Input(\"Data\", Table, doc=\"Input data table\")\n\n    class Outputs:\n        data = Output(\"Data\", Table, doc=\"Aggregated data\")\n\n    class Error(OWWidget.Error):\n        unexpected_error = Msg(\"{}\")\n\n    settingsHandler = DomainContextHandler()\n\n    gb_attrs: List[Variable] = ContextSetting([])\n    aggregations: Dict[Variable, Set[str]] = ContextSetting({})\n    auto_commit: bool = Setting(True)\n\n    def __init__(self):\n        super().__init__()\n        ConcurrentWidgetMixin.__init__(self)\n\n        self.data = None\n        self.result = None\n\n        self.gb_attrs_model = DomainModel(\n            separators=False,\n        )\n        self.agg_table_model = VarTableModel(self)\n        self.agg_checkboxes = {}\n\n        self.__init_control_area()\n        self.__init_main_area()\n\n    def __init_control_area(self) -> None:\n        \"\"\"Init all controls in the control area\"\"\"\n        box = gui.vBox(self.controlArea, \"Group by\")\n        self.gb_attrs_view = AggregateListViewSearch(\n            selectionMode=QListView.ExtendedSelection\n        )\n        self.gb_attrs_view.setModel(self.gb_attrs_model)\n        self.gb_attrs_view.selectionModel().selectionChanged.connect(self.__gb_changed)\n        box.layout().addWidget(self.gb_attrs_view)\n\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    def __init_main_area(self) -> None:\n        \"\"\"Init all controls in the main area\"\"\"\n        # aggregation table\n        self.agg_table_view = tableview = QTableView()\n        tableview.setModel(self.agg_table_model)\n        tableview.setSelectionBehavior(QAbstractItemView.SelectRows)\n        tableview.selectionModel().selectionChanged.connect(self.__rows_selected)\n        tableview.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)\n\n        vbox = gui.vBox(self.mainArea, \" \")\n        vbox.layout().addWidget(tableview)\n\n        # aggregations checkboxes\n        grid_layout = QGridLayout()\n        gui.widgetBox(self.mainArea, orientation=grid_layout, box=\"Aggregations\")\n\n        col = 0\n        row = 0\n        break_rows = (5, 5, 99)\n        for agg in AGGREGATIONS:\n            self.agg_checkboxes[agg] = cb = CheckBox(agg, self)\n            cb.setDisabled(True)\n            cb.stateChanged.connect(partial(self.__aggregation_changed, agg))\n            grid_layout.addWidget(cb, row, col)\n            row += 1\n            if row == break_rows[col]:\n                row = 0\n                col += 1\n\n    ############\n    # Callbacks\n\n    def __rows_selected(self) -> None:\n        \"\"\"Callback for table selection change; update checkboxes\"\"\"\n        selected_attrs = self.get_selected_attributes()\n\n        types = {type(attr) for attr in selected_attrs}\n        active_aggregations = [self.aggregations[attr] for attr in selected_attrs]\n        for agg, cb in self.agg_checkboxes.items():\n            cb.setDisabled(not types & AGGREGATIONS[agg].types)\n\n            activated = {agg in a for a in active_aggregations}\n            with block_signals(cb):\n                # check if aggregation active for all selected attributes,\n                # partially check if active for some else uncheck\n                cb.setCheckState(\n                    Qt.Checked\n                    if activated == {True}\n                    else (Qt.Unchecked if activated == {False} else Qt.PartiallyChecked)\n                )\n\n    def __gb_changed(self) -> None:\n        \"\"\"\n        Callback for Group-by attributes selection change; update attribute\n        and call commit\n        \"\"\"\n        rows = self.gb_attrs_view.selectionModel().selectedRows()\n        values = self.gb_attrs_view.model()[:]\n        self.gb_attrs = [values[row.row()] for row in sorted(rows)]\n        # everything cached in result should be recomputed on gb change\n        self.result = Result()\n        self.commit.deferred()\n\n    def __aggregation_changed(self, agg: str) -> None:\n        \"\"\"\n        Callback for aggregation change; update aggregations dictionary and call\n        commit\n        \"\"\"\n        selected_attrs = self.get_selected_attributes()\n        for attr in selected_attrs:\n            if self.agg_checkboxes[agg].isChecked() and self.__aggregation_compatible(\n                agg, attr\n            ):\n                self.aggregations[attr].add(agg)\n            else:\n                self.aggregations[attr].discard(agg)\n            self.agg_table_model.update_aggregation(attr)\n        self.commit.deferred()\n\n    @Inputs.data\n    def set_data(self, data: Table) -> None:\n        self.closeContext()\n        self.data = data\n\n        # reset states\n        self.cancel()\n        self.result = Result()\n        self.Outputs.data.send(None)\n        self.gb_attrs_model.set_domain(data.domain if data else None)\n        self.gb_attrs = data.domain[:1] if data else []\n        self.aggregations = (\n            {\n                attr: DEFAULT_AGGREGATIONS[type(attr)].copy()\n                for attr in data.domain.variables + data.domain.metas\n            }\n            if data\n            else {}\n        )\n        default_aggregations = self.aggregations.copy()\n\n        self.openContext(self.data)\n\n        # restore aggregations\n        self.aggregations.update({k: v for k, v in default_aggregations.items()\n                                  if k not in self.aggregations})\n\n        # update selections in widgets and re-plot\n        self.agg_table_model.set_domain(data.domain if data else None)\n        self._set_gb_selection()\n\n        self.commit.now()\n\n    #########################\n    # Task connected methods\n\n    @gui.deferred\n    def commit(self) -> None:\n        self.Error.clear()\n        self.Warning.clear()\n        if self.data:\n            self.start(_run, self.data, self.gb_attrs, self.aggregations, self.result)\n\n    def on_done(self, result: Result) -> None:\n        self.result = result\n        self.Outputs.data.send(result.result_table)\n\n    def on_partial_result(self, result: Result) -> None:\n        # store result in case the task is canceled and on_done is not called\n        self.result = result\n\n    def on_exception(self, ex: Exception):\n        self.Error.unexpected_error(str(ex))\n\n    ###################\n    # Helper methods\n\n    def get_selected_attributes(self):\n        \"\"\"Get select attributes in the table\"\"\"\n        selection_model = self.agg_table_view.selectionModel()\n        sel_rows = selection_model.selectedRows()\n        vars_ = self.data.domain.variables + self.data.domain.metas\n        return [vars_[index.row()] for index in sel_rows]\n\n    def _set_gb_selection(self) -> None:\n        \"\"\"Set selection in groupby list according to self.gb_attrs\"\"\"\n        sm = self.gb_attrs_view.selectionModel()\n        values = self.gb_attrs_model[:]\n        with disconnected(sm.selectionChanged, self.__gb_changed):\n            for val in self.gb_attrs:\n                index = values.index(val)\n                model_index = self.gb_attrs_model.index(index, 0)\n                sm.select(model_index, QItemSelectionModel.Select)\n\n    @staticmethod\n    def __aggregation_compatible(agg, attr):\n        \"\"\"Check a compatibility of aggregation with the variable\"\"\"\n        return type(attr) in AGGREGATIONS[agg].types\n\n\nif __name__ == \"__main__\":\n    # pylint: disable=ungrouped-imports\n    from orangewidget.utils.widgetpreview import WidgetPreview\n\n    WidgetPreview(OWGroupBy).run(Table(\"iris\"))\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/data/owgroupby.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "07821aec2",
                "new_commit_hash": "ad160b55f",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/data/owgroupby.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/data/owgroupby.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 443,
                            "length": 9
                        },
                        "new_range": {
                            "start": 443,
                            "length": 14
                        },
                        "section": "class OWGroupBy(OWWidget, ConcurrentWidgetMixin):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "            if data",
                                "type": "context"
                            },
                            {
                                "content": "            else {}",
                                "type": "context"
                            },
                            {
                                "content": "        )",
                                "type": "context"
                            },
                            {
                                "content": "        default_aggregations = self.aggregations.copy()",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        self.openContext(self.data)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        # restore aggregations",
                                "type": "added"
                            },
                            {
                                "content": "        self.aggregations.update({k: v for k, v in default_aggregations.items()",
                                "type": "added"
                            },
                            {
                                "content": "                                  if k not in self.aggregations})",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        # update selections in widgets and re-plot",
                                "type": "context"
                            },
                            {
                                "content": "        self.agg_table_model.set_domain(data.domain if data else None)",
                                "type": "context"
                            },
                            {
                                "content": "        self._set_gb_selection()",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/owgroupby.py",
                            "type": "method",
                            "name": "OWGroupBy.set_data",
                            "content": "class OWGroupBy(OWWidget, ConcurrentWidgetMixin):\n    name = \"Group by\"\n    description = \"\"\n    category = \"Transform\"\n    icon = \"icons/GroupBy.svg\"\n    keywords = [\"aggregate\", \"group by\"]\n\n    class Inputs:\n        data = Input(\"Data\", Table, doc=\"Input data table\")\n\n    class Outputs:\n        data = Output(\"Data\", Table, doc=\"Aggregated data\")\n\n    class Error(OWWidget.Error):\n        unexpected_error = Msg(\"{}\")\n\n    settingsHandler = DomainContextHandler()\n\n    gb_attrs: List[Variable] = ContextSetting([])\n    aggregations: Dict[Variable, Set[str]] = ContextSetting({})\n    auto_commit: bool = Setting(True)\n\n    def __init__(self):\n        super().__init__()\n        ConcurrentWidgetMixin.__init__(self)\n\n        self.data = None\n        self.result = None\n\n        self.gb_attrs_model = DomainModel(\n            separators=False,\n        )\n        self.agg_table_model = VarTableModel(self)\n        self.agg_checkboxes = {}\n\n        self.__init_control_area()\n        self.__init_main_area()\n\n    def __init_control_area(self) -> None:\n        \"\"\"Init all controls in the control area\"\"\"\n        box = gui.vBox(self.controlArea, \"Group by\")\n        self.gb_attrs_view = AggregateListViewSearch(\n            selectionMode=QListView.ExtendedSelection\n        )\n        self.gb_attrs_view.setModel(self.gb_attrs_model)\n        self.gb_attrs_view.selectionModel().selectionChanged.connect(self.__gb_changed)\n        box.layout().addWidget(self.gb_attrs_view)\n\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    def __init_main_area(self) -> None:\n        \"\"\"Init all controls in the main area\"\"\"\n        # aggregation table\n        self.agg_table_view = tableview = QTableView()\n        tableview.setModel(self.agg_table_model)\n        tableview.setSelectionBehavior(QAbstractItemView.SelectRows)\n        tableview.selectionModel().selectionChanged.connect(self.__rows_selected)\n        tableview.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)\n\n        vbox = gui.vBox(self.mainArea, \" \")\n        vbox.layout().addWidget(tableview)\n\n        # aggregations checkboxes\n        grid_layout = QGridLayout()\n        gui.widgetBox(self.mainArea, orientation=grid_layout, box=\"Aggregations\")\n\n        col = 0\n        row = 0\n        break_rows = (5, 5, 99)\n        for agg in AGGREGATIONS:\n            self.agg_checkboxes[agg] = cb = CheckBox(agg, self)\n            cb.setDisabled(True)\n            cb.stateChanged.connect(partial(self.__aggregation_changed, agg))\n            grid_layout.addWidget(cb, row, col)\n            row += 1\n            if row == break_rows[col]:\n                row = 0\n                col += 1\n\n    ############\n    # Callbacks\n\n    def __rows_selected(self) -> None:\n        \"\"\"Callback for table selection change; update checkboxes\"\"\"\n        selected_attrs = self.get_selected_attributes()\n\n        types = {type(attr) for attr in selected_attrs}\n        active_aggregations = [self.aggregations[attr] for attr in selected_attrs]\n        for agg, cb in self.agg_checkboxes.items():\n            cb.setDisabled(not types & AGGREGATIONS[agg].types)\n\n            activated = {agg in a for a in active_aggregations}\n            with block_signals(cb):\n                # check if aggregation active for all selected attributes,\n                # partially check if active for some else uncheck\n                cb.setCheckState(\n                    Qt.Checked\n                    if activated == {True}\n                    else (Qt.Unchecked if activated == {False} else Qt.PartiallyChecked)\n                )\n\n    def __gb_changed(self) -> None:\n        \"\"\"\n        Callback for Group-by attributes selection change; update attribute\n        and call commit\n        \"\"\"\n        rows = self.gb_attrs_view.selectionModel().selectedRows()\n        values = self.gb_attrs_view.model()[:]\n        self.gb_attrs = [values[row.row()] for row in sorted(rows)]\n        # everything cached in result should be recomputed on gb change\n        self.result = Result()\n        self.commit.deferred()\n\n    def __aggregation_changed(self, agg: str) -> None:\n        \"\"\"\n        Callback for aggregation change; update aggregations dictionary and call\n        commit\n        \"\"\"\n        selected_attrs = self.get_selected_attributes()\n        for attr in selected_attrs:\n            if self.agg_checkboxes[agg].isChecked() and self.__aggregation_compatible(\n                agg, attr\n            ):\n                self.aggregations[attr].add(agg)\n            else:\n                self.aggregations[attr].discard(agg)\n            self.agg_table_model.update_aggregation(attr)\n        self.commit.deferred()\n\n    @Inputs.data\n    def set_data(self, data: Table) -> None:\n        self.closeContext()\n        self.data = data\n\n        # reset states\n        self.cancel()\n        self.result = Result()\n        self.Outputs.data.send(None)\n        self.gb_attrs_model.set_domain(data.domain if data else None)\n        self.gb_attrs = data.domain[:1] if data else []\n        self.aggregations = (\n            {\n                attr: DEFAULT_AGGREGATIONS[type(attr)].copy()\n                for attr in data.domain.variables + data.domain.metas\n            }\n            if data\n            else {}\n        )\n        default_aggregations = self.aggregations.copy()\n\n        self.openContext(self.data)\n\n        # restore aggregations\n        self.aggregations.update({k: v for k, v in default_aggregations.items()\n                                  if k not in self.aggregations})\n\n        # update selections in widgets and re-plot\n        self.agg_table_model.set_domain(data.domain if data else None)\n        self._set_gb_selection()\n\n        self.commit.now()\n\n    #########################\n    # Task connected methods\n\n    @gui.deferred\n    def commit(self) -> None:\n        self.Error.clear()\n        self.Warning.clear()\n        if self.data:\n            self.start(_run, self.data, self.gb_attrs, self.aggregations, self.result)\n\n    def on_done(self, result: Result) -> None:\n        self.result = result\n        self.Outputs.data.send(result.result_table)\n\n    def on_partial_result(self, result: Result) -> None:\n        # store result in case the task is canceled and on_done is not called\n        self.result = result\n\n    def on_exception(self, ex: Exception):\n        self.Error.unexpected_error(str(ex))\n\n    ###################\n    # Helper methods\n\n    def get_selected_attributes(self):\n        \"\"\"Get select attributes in the table\"\"\"\n        selection_model = self.agg_table_view.selectionModel()\n        sel_rows = selection_model.selectedRows()\n        vars_ = self.data.domain.variables + self.data.domain.metas\n        return [vars_[index.row()] for index in sel_rows]\n\n    def _set_gb_selection(self) -> None:\n        \"\"\"Set selection in groupby list according to self.gb_attrs\"\"\"\n        sm = self.gb_attrs_view.selectionModel()\n        values = self.gb_attrs_model[:]\n        with disconnected(sm.selectionChanged, self.__gb_changed):\n            for val in self.gb_attrs:\n                index = values.index(val)\n                model_index = self.gb_attrs_model.index(index, 0)\n                sm.select(model_index, QItemSelectionModel.Select)\n\n    @staticmethod\n    def __aggregation_compatible(agg, attr):\n        \"\"\"Check a compatibility of aggregation with the variable\"\"\"\n        return type(attr) in AGGREGATIONS[agg].types",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 428,
                            "end_lineno": 458,
                            "parent": {
                                "file_name": "Orange/widgets/data/owgroupby.py",
                                "type": "class",
                                "name": "OWGroupBy",
                                "content": "class OWGroupBy(OWWidget, ConcurrentWidgetMixin):\n    name = \"Group by\"\n    description = \"\"\n    category = \"Transform\"\n    icon = \"icons/GroupBy.svg\"\n    keywords = [\"aggregate\", \"group by\"]\n\n    class Inputs:\n        data = Input(\"Data\", Table, doc=\"Input data table\")\n\n    class Outputs:\n        data = Output(\"Data\", Table, doc=\"Aggregated data\")\n\n    class Error(OWWidget.Error):\n        unexpected_error = Msg(\"{}\")\n\n    settingsHandler = DomainContextHandler()\n\n    gb_attrs: List[Variable] = ContextSetting([])\n    aggregations: Dict[Variable, Set[str]] = ContextSetting({})\n    auto_commit: bool = Setting(True)\n\n    def __init__(self):\n        super().__init__()\n        ConcurrentWidgetMixin.__init__(self)\n\n        self.data = None\n        self.result = None\n\n        self.gb_attrs_model = DomainModel(\n            separators=False,\n        )\n        self.agg_table_model = VarTableModel(self)\n        self.agg_checkboxes = {}\n\n        self.__init_control_area()\n        self.__init_main_area()\n\n    def __init_control_area(self) -> None:\n        \"\"\"Init all controls in the control area\"\"\"\n        box = gui.vBox(self.controlArea, \"Group by\")\n        self.gb_attrs_view = AggregateListViewSearch(\n            selectionMode=QListView.ExtendedSelection\n        )\n        self.gb_attrs_view.setModel(self.gb_attrs_model)\n        self.gb_attrs_view.selectionModel().selectionChanged.connect(self.__gb_changed)\n        box.layout().addWidget(self.gb_attrs_view)\n\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    def __init_main_area(self) -> None:\n        \"\"\"Init all controls in the main area\"\"\"\n        # aggregation table\n        self.agg_table_view = tableview = QTableView()\n        tableview.setModel(self.agg_table_model)\n        tableview.setSelectionBehavior(QAbstractItemView.SelectRows)\n        tableview.selectionModel().selectionChanged.connect(self.__rows_selected)\n        tableview.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)\n\n        vbox = gui.vBox(self.mainArea, \" \")\n        vbox.layout().addWidget(tableview)\n\n        # aggregations checkboxes\n        grid_layout = QGridLayout()\n        gui.widgetBox(self.mainArea, orientation=grid_layout, box=\"Aggregations\")\n\n        col = 0\n        row = 0\n        break_rows = (5, 5, 99)\n        for agg in AGGREGATIONS:\n            self.agg_checkboxes[agg] = cb = CheckBox(agg, self)\n            cb.setDisabled(True)\n            cb.stateChanged.connect(partial(self.__aggregation_changed, agg))\n            grid_layout.addWidget(cb, row, col)\n            row += 1\n            if row == break_rows[col]:\n                row = 0\n                col += 1\n\n    ############\n    # Callbacks\n\n    def __rows_selected(self) -> None:\n        \"\"\"Callback for table selection change; update checkboxes\"\"\"\n        selected_attrs = self.get_selected_attributes()\n\n        types = {type(attr) for attr in selected_attrs}\n        active_aggregations = [self.aggregations[attr] for attr in selected_attrs]\n        for agg, cb in self.agg_checkboxes.items():\n            cb.setDisabled(not types & AGGREGATIONS[agg].types)\n\n            activated = {agg in a for a in active_aggregations}\n            with block_signals(cb):\n                # check if aggregation active for all selected attributes,\n                # partially check if active for some else uncheck\n                cb.setCheckState(\n                    Qt.Checked\n                    if activated == {True}\n                    else (Qt.Unchecked if activated == {False} else Qt.PartiallyChecked)\n                )\n\n    def __gb_changed(self) -> None:\n        \"\"\"\n        Callback for Group-by attributes selection change; update attribute\n        and call commit\n        \"\"\"\n        rows = self.gb_attrs_view.selectionModel().selectedRows()\n        values = self.gb_attrs_view.model()[:]\n        self.gb_attrs = [values[row.row()] for row in sorted(rows)]\n        # everything cached in result should be recomputed on gb change\n        self.result = Result()\n        self.commit.deferred()\n\n    def __aggregation_changed(self, agg: str) -> None:\n        \"\"\"\n        Callback for aggregation change; update aggregations dictionary and call\n        commit\n        \"\"\"\n        selected_attrs = self.get_selected_attributes()\n        for attr in selected_attrs:\n            if self.agg_checkboxes[agg].isChecked() and self.__aggregation_compatible(\n                agg, attr\n            ):\n                self.aggregations[attr].add(agg)\n            else:\n                self.aggregations[attr].discard(agg)\n            self.agg_table_model.update_aggregation(attr)\n        self.commit.deferred()\n\n    @Inputs.data\n    def set_data(self, data: Table) -> None:\n        self.closeContext()\n        self.data = data\n\n        # reset states\n        self.cancel()\n        self.result = Result()\n        self.Outputs.data.send(None)\n        self.gb_attrs_model.set_domain(data.domain if data else None)\n        self.gb_attrs = data.domain[:1] if data else []\n        self.aggregations = (\n            {\n                attr: DEFAULT_AGGREGATIONS[type(attr)].copy()\n                for attr in data.domain.variables + data.domain.metas\n            }\n            if data\n            else {}\n        )\n        default_aggregations = self.aggregations.copy()\n\n        self.openContext(self.data)\n\n        # restore aggregations\n        self.aggregations.update({k: v for k, v in default_aggregations.items()\n                                  if k not in self.aggregations})\n\n        # update selections in widgets and re-plot\n        self.agg_table_model.set_domain(data.domain if data else None)\n        self._set_gb_selection()\n\n        self.commit.now()\n\n    #########################\n    # Task connected methods\n\n    @gui.deferred\n    def commit(self) -> None:\n        self.Error.clear()\n        self.Warning.clear()\n        if self.data:\n            self.start(_run, self.data, self.gb_attrs, self.aggregations, self.result)\n\n    def on_done(self, result: Result) -> None:\n        self.result = result\n        self.Outputs.data.send(result.result_table)\n\n    def on_partial_result(self, result: Result) -> None:\n        # store result in case the task is canceled and on_done is not called\n        self.result = result\n\n    def on_exception(self, ex: Exception):\n        self.Error.unexpected_error(str(ex))\n\n    ###################\n    # Helper methods\n\n    def get_selected_attributes(self):\n        \"\"\"Get select attributes in the table\"\"\"\n        selection_model = self.agg_table_view.selectionModel()\n        sel_rows = selection_model.selectedRows()\n        vars_ = self.data.domain.variables + self.data.domain.metas\n        return [vars_[index.row()] for index in sel_rows]\n\n    def _set_gb_selection(self) -> None:\n        \"\"\"Set selection in groupby list according to self.gb_attrs\"\"\"\n        sm = self.gb_attrs_view.selectionModel()\n        values = self.gb_attrs_model[:]\n        with disconnected(sm.selectionChanged, self.__gb_changed):\n            for val in self.gb_attrs:\n                index = values.index(val)\n                model_index = self.gb_attrs_model.index(index, 0)\n                sm.select(model_index, QItemSelectionModel.Select)\n\n    @staticmethod\n    def __aggregation_compatible(agg, attr):\n        \"\"\"Check a compatibility of aggregation with the variable\"\"\"\n        return type(attr) in AGGREGATIONS[agg].types",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 298,
                                "end_lineno": 504,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/data/owgroupby.py",
                            "type": "class",
                            "name": "OWGroupBy",
                            "content": "class OWGroupBy(OWWidget, ConcurrentWidgetMixin):\n    name = \"Group by\"\n    description = \"\"\n    category = \"Transform\"\n    icon = \"icons/GroupBy.svg\"\n    keywords = [\"aggregate\", \"group by\"]\n\n    class Inputs:\n        data = Input(\"Data\", Table, doc=\"Input data table\")\n\n    class Outputs:\n        data = Output(\"Data\", Table, doc=\"Aggregated data\")\n\n    class Error(OWWidget.Error):\n        unexpected_error = Msg(\"{}\")\n\n    settingsHandler = DomainContextHandler()\n\n    gb_attrs: List[Variable] = ContextSetting([])\n    aggregations: Dict[Variable, Set[str]] = ContextSetting({})\n    auto_commit: bool = Setting(True)\n\n    def __init__(self):\n        super().__init__()\n        ConcurrentWidgetMixin.__init__(self)\n\n        self.data = None\n        self.result = None\n\n        self.gb_attrs_model = DomainModel(\n            separators=False,\n        )\n        self.agg_table_model = VarTableModel(self)\n        self.agg_checkboxes = {}\n\n        self.__init_control_area()\n        self.__init_main_area()\n\n    def __init_control_area(self) -> None:\n        \"\"\"Init all controls in the control area\"\"\"\n        box = gui.vBox(self.controlArea, \"Group by\")\n        self.gb_attrs_view = AggregateListViewSearch(\n            selectionMode=QListView.ExtendedSelection\n        )\n        self.gb_attrs_view.setModel(self.gb_attrs_model)\n        self.gb_attrs_view.selectionModel().selectionChanged.connect(self.__gb_changed)\n        box.layout().addWidget(self.gb_attrs_view)\n\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    def __init_main_area(self) -> None:\n        \"\"\"Init all controls in the main area\"\"\"\n        # aggregation table\n        self.agg_table_view = tableview = QTableView()\n        tableview.setModel(self.agg_table_model)\n        tableview.setSelectionBehavior(QAbstractItemView.SelectRows)\n        tableview.selectionModel().selectionChanged.connect(self.__rows_selected)\n        tableview.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)\n\n        vbox = gui.vBox(self.mainArea, \" \")\n        vbox.layout().addWidget(tableview)\n\n        # aggregations checkboxes\n        grid_layout = QGridLayout()\n        gui.widgetBox(self.mainArea, orientation=grid_layout, box=\"Aggregations\")\n\n        col = 0\n        row = 0\n        break_rows = (5, 5, 99)\n        for agg in AGGREGATIONS:\n            self.agg_checkboxes[agg] = cb = CheckBox(agg, self)\n            cb.setDisabled(True)\n            cb.stateChanged.connect(partial(self.__aggregation_changed, agg))\n            grid_layout.addWidget(cb, row, col)\n            row += 1\n            if row == break_rows[col]:\n                row = 0\n                col += 1\n\n    ############\n    # Callbacks\n\n    def __rows_selected(self) -> None:\n        \"\"\"Callback for table selection change; update checkboxes\"\"\"\n        selected_attrs = self.get_selected_attributes()\n\n        types = {type(attr) for attr in selected_attrs}\n        active_aggregations = [self.aggregations[attr] for attr in selected_attrs]\n        for agg, cb in self.agg_checkboxes.items():\n            cb.setDisabled(not types & AGGREGATIONS[agg].types)\n\n            activated = {agg in a for a in active_aggregations}\n            with block_signals(cb):\n                # check if aggregation active for all selected attributes,\n                # partially check if active for some else uncheck\n                cb.setCheckState(\n                    Qt.Checked\n                    if activated == {True}\n                    else (Qt.Unchecked if activated == {False} else Qt.PartiallyChecked)\n                )\n\n    def __gb_changed(self) -> None:\n        \"\"\"\n        Callback for Group-by attributes selection change; update attribute\n        and call commit\n        \"\"\"\n        rows = self.gb_attrs_view.selectionModel().selectedRows()\n        values = self.gb_attrs_view.model()[:]\n        self.gb_attrs = [values[row.row()] for row in sorted(rows)]\n        # everything cached in result should be recomputed on gb change\n        self.result = Result()\n        self.commit.deferred()\n\n    def __aggregation_changed(self, agg: str) -> None:\n        \"\"\"\n        Callback for aggregation change; update aggregations dictionary and call\n        commit\n        \"\"\"\n        selected_attrs = self.get_selected_attributes()\n        for attr in selected_attrs:\n            if self.agg_checkboxes[agg].isChecked() and self.__aggregation_compatible(\n                agg, attr\n            ):\n                self.aggregations[attr].add(agg)\n            else:\n                self.aggregations[attr].discard(agg)\n            self.agg_table_model.update_aggregation(attr)\n        self.commit.deferred()\n\n    @Inputs.data\n    def set_data(self, data: Table) -> None:\n        self.closeContext()\n        self.data = data\n\n        # reset states\n        self.cancel()\n        self.result = Result()\n        self.Outputs.data.send(None)\n        self.gb_attrs_model.set_domain(data.domain if data else None)\n        self.gb_attrs = data.domain[:1] if data else []\n        self.aggregations = (\n            {\n                attr: DEFAULT_AGGREGATIONS[type(attr)].copy()\n                for attr in data.domain.variables + data.domain.metas\n            }\n            if data\n            else {}\n        )\n        default_aggregations = self.aggregations.copy()\n\n        self.openContext(self.data)\n\n        # restore aggregations\n        self.aggregations.update({k: v for k, v in default_aggregations.items()\n                                  if k not in self.aggregations})\n\n        # update selections in widgets and re-plot\n        self.agg_table_model.set_domain(data.domain if data else None)\n        self._set_gb_selection()\n\n        self.commit.now()\n\n    #########################\n    # Task connected methods\n\n    @gui.deferred\n    def commit(self) -> None:\n        self.Error.clear()\n        self.Warning.clear()\n        if self.data:\n            self.start(_run, self.data, self.gb_attrs, self.aggregations, self.result)\n\n    def on_done(self, result: Result) -> None:\n        self.result = result\n        self.Outputs.data.send(result.result_table)\n\n    def on_partial_result(self, result: Result) -> None:\n        # store result in case the task is canceled and on_done is not called\n        self.result = result\n\n    def on_exception(self, ex: Exception):\n        self.Error.unexpected_error(str(ex))\n\n    ###################\n    # Helper methods\n\n    def get_selected_attributes(self):\n        \"\"\"Get select attributes in the table\"\"\"\n        selection_model = self.agg_table_view.selectionModel()\n        sel_rows = selection_model.selectedRows()\n        vars_ = self.data.domain.variables + self.data.domain.metas\n        return [vars_[index.row()] for index in sel_rows]\n\n    def _set_gb_selection(self) -> None:\n        \"\"\"Set selection in groupby list according to self.gb_attrs\"\"\"\n        sm = self.gb_attrs_view.selectionModel()\n        values = self.gb_attrs_model[:]\n        with disconnected(sm.selectionChanged, self.__gb_changed):\n            for val in self.gb_attrs:\n                index = values.index(val)\n                model_index = self.gb_attrs_model.index(index, 0)\n                sm.select(model_index, QItemSelectionModel.Select)\n\n    @staticmethod\n    def __aggregation_compatible(agg, attr):\n        \"\"\"Check a compatibility of aggregation with the variable\"\"\"\n        return type(attr) in AGGREGATIONS[agg].types",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 298,
                            "end_lineno": 504,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "import os\nimport unittest\nfrom typing import List\nfrom unittest.mock import Mock, patch\n\nimport numpy as np\nimport pandas as pd\nfrom AnyQt import QtCore\nfrom AnyQt.QtCore import QItemSelectionModel, Qt\nfrom AnyQt.QtWidgets import QListView\n\nfrom Orange.data import (\n    Table,\n    table_to_frame,\n    Domain,\n    ContinuousVariable,\n)\nfrom Orange.data.tests.test_aggregate import create_sample_data\nfrom Orange.widgets.data.owgroupby import OWGroupBy\nfrom Orange.widgets.tests.base import WidgetTest\n\n\nclass TestOWGropBy(WidgetTest):\n    def setUp(self) -> None:\n        self.widget = self.create_widget(OWGroupBy)\n        self.iris = Table(\"iris\")\n\n        self.data = create_sample_data()\n\n    def test_none_data(self):\n        self.send_signal(self.widget.Inputs.data, None)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 0)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 0)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    def test_data(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 5)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 5)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    @staticmethod\n    def _set_selection(view: QListView, indices: List[int]):\n        view.clearSelection()\n        sm = view.selectionModel()\n        model = view.model()\n        for ind in indices:\n            sm.select(model.index(ind), QItemSelectionModel.Select)\n\n    def test_groupby_attr_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 3)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 57)\n\n    def assert_enabled_cbs(self, enabled_true):\n        enabled_actual = set(\n            name for name, cb in self.widget.agg_checkboxes.items() if cb.isEnabled()\n        )\n        self.assertSetEqual(enabled_true, enabled_actual)\n\n    @staticmethod\n    def select_table_rows(table, rows):\n        table.clearSelection()\n        indexes = [table.model().index(r, 0) for r in rows]\n        mode = QtCore.QItemSelectionModel.Select | QtCore.QItemSelectionModel.Rows\n        for i in indexes:\n            table.selectionModel().select(i, mode)\n\n    def test_attr_table_row_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        model = self.widget.agg_table_model\n        table = self.widget.agg_table_view\n\n        self.assertListEqual(\n            [\"a\", \"b\", \"cvar\", \"dvar\", \"svar\"],\n            [model.data(model.index(i, 0)) for i in range(model.rowCount())],\n        )\n\n        self.select_table_rows(table, [0])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [0, 1])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3])  # discrete variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2, 3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n\n    def assert_aggregations_equal(self, expected_text):\n        model = self.widget.agg_table_model\n        agg_text = [model.data(model.index(i, 1)) for i in range(model.rowCount())]\n        self.assertListEqual(expected_text, agg_text)\n\n    def test_aggregations_change(self):\n        table = self.widget.agg_table_view\n        d = self.data.domain\n\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        # median is partially checked and will become checked\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Median\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Median, Mode\",\n                \"Mean, Median, Mode\",\n                \"Mean\",\n                \"Concatenate\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 3])\n        # median is unchecked and will change to partially checked\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Count\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Count\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # test the most complicated scenario: numeric with mode, numeric without\n        # mode and discrete\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean, Mode\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1, 3])\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        # must stay partially checked since one Continuous can still have mode\n        # as a aggregation and discrete cannot have it\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # since now all that can have Mode have it as an aggregation it can be\n        # unchecked on the next click\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assertEqual(Qt.Unchecked, self.widget.agg_checkboxes[\"Mode\"].checkState())\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.widget.agg_checkboxes[\"Count defined\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count defined and 1 more\",\n                \"Mean, Mode, Count defined\",\n                \"Mean\",\n                \"Concatenate, Count defined, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\", \"Count defined\"},\n                d[\"b\"]: {\"Mean\", \"Mode\", \"Count defined\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Count defined\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    def test_aggregation(self):\n        \"\"\"Test aggregation results\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        np.testing.assert_array_almost_equal(\n            output.X, [[1, 2.143, 0.317], [2, 2, 2]], decimal=3\n        )\n        np.testing.assert_array_equal(\n            output.metas,\n            np.array(\n                [\n                    [\n                        \"val1 val2 val2 val1 val2 val1\",\n                        \"sval1 sval2 sval2 sval1 sval2 sval1\",\n                        1.0,\n                    ],\n                    [\n                        \"val2 val1 val2 val1 val2 val1\",\n                        \"sval2 sval1 sval2 sval1 sval2 sval1\",\n                        2.0,\n                    ],\n                ],\n                dtype=object,\n            ),\n        )\n\n        # select all aggregations for all features except a and b\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.select_table_rows(self.widget.agg_table_view, [2, 3, 4])\n        # select all aggregations\n        for cb in self.widget.agg_checkboxes.values():\n            cb.click()\n            while not cb.isChecked():\n                cb.click()\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 1])\n        # unselect all aggregations for attr a and b\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"cvar - Mean\",\n            \"cvar - Median\",\n            \"cvar - Mode\",\n            \"cvar - Standard deviation\",\n            \"cvar - Variance\",\n            \"cvar - Sum\",\n            \"cvar - Min. value\",\n            \"cvar - Max. value\",\n            \"cvar - Span\",\n            \"cvar - First value\",\n            \"cvar - Last value\",\n            \"cvar - Count defined\",\n            \"cvar - Count\",\n            \"cvar - Proportion defined\",\n            \"dvar - First value\",\n            \"dvar - Last value\",\n            \"dvar - Count defined\",\n            \"dvar - Count\",\n            \"dvar - Proportion defined\",\n            \"svar - First value\",\n            \"svar - Last value\",\n            \"svar - Count defined\",\n            \"svar - Count\",\n            \"svar - Proportion defined\",\n            \"cvar - Concatenate\",\n            \"dvar - Concatenate\",\n            \"svar - Concatenate\",\n            \"a\",  # groupby variables are last two in metas\n            \"b\",\n        ]\n\n        # fmt: off\n        expected_df = pd.DataFrame([\n            [.15, .15, .1, .07, .005, .3, .1, .2, .1, 0.1, 0.2, 2, 2, 1,\n             \"val1\", \"val2\", 2, 2, 1,\n             \"sval1\", \"sval2\", 2, 2, 1,\n             \"0.1 0.2\", \"val1 val2\", \"sval1 sval2\",\n             1, 1],\n            [.3, .3, .3, np.nan, np.nan, .3, .3, .3, 0, .3, .3, 1, 2, 0.5,\n             \"val2\", \"val2\", 1, 2, 0.5,\n             \"\", \"sval2\", 2, 2, 1,\n             \"0.3\", \"val2\", \"sval2\",\n             1, 2],\n            [.433, .4, .3, 0.153, 0.023, 1.3, .3, .6, .3, .3, .6, 3, 3, 1,\n             \"val1\", \"val1\", 3, 3, 1,\n             \"sval1\", \"sval1\", 3, 3, 1,\n             \"0.3 0.4 0.6\", \"val1 val2 val1\", \"sval1 sval2 sval1\",\n             1, 3],\n            [1.5, 1.5, 1, 0.707, 0.5, 3, 1, 2, 1, 1, 2, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"1.0 2.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 1],\n            [-0.5, -0.5, -4, 4.95, 24.5, -1, -4, 3, 7, 3, -4, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"3.0 -4.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 2],\n            [5, 5, 5, 0, 0, 10, 5, 5, 0, 5, 5, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"5.0 5.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 3]\n            ], columns=expected_columns\n        )\n        # fmt: on\n\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        # remove random since it is not possible to test\n        output_df = output_df.loc[:, ~output_df.columns.str.endswith(\"Random value\")]\n\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n            atol=1e-3,\n        )\n\n    def test_metas_results(self):\n        \"\"\"Test if variable that is in meta in input table remains in metas\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIn(self.data.domain[\"svar\"], output.domain.metas)\n\n    def test_context(self):\n        d = self.data.domain\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 2])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # send new data and previous data to check if context restored correctly\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    @patch(\n        \"Orange.data.aggregate.OrangeTableGroupBy.aggregate\",\n        Mock(side_effect=ValueError(\"Test unexpected err\")),\n    )\n    def test_unexpected_error(self):\n        \"\"\"Test if exception in aggregation shown correctly\"\"\"\n\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.wait_until_finished()\n\n        self.assertTrue(self.widget.Error.unexpected_error.is_shown())\n        self.assertEqual(\n            str(self.widget.Error.unexpected_error),\n            \"Test unexpected err\",\n        )\n\n    def test_time_variable(self):\n        cur_dir = os.path.dirname(os.path.realpath(__file__))\n        test10_path = os.path.join(\n            cur_dir, \"..\", \"..\", \"..\", \"tests\", \"datasets\", \"test10.tab\"\n        )\n        data = Table.from_file(test10_path)\n\n        # time variable as a group by variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [1])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(3, len(output))\n\n        # time variable as a grouped variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [5])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(2, len(output))\n\n    def test_only_nan_in_group(self):\n        data = Table(\n            Domain([ContinuousVariable(\"A\"), ContinuousVariable(\"B\")]),\n            np.array([[1, np.nan], [2, 1], [1, np.nan], [2, 1]]),\n        )\n        self.send_signal(self.widget.Inputs.data, data)\n\n        # select feature A as group-by\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        # select all aggregations for feature B\n        self.select_table_rows(self.widget.agg_table_view, [1])\n        for cb in self.widget.agg_checkboxes.values():\n            while not cb.isChecked():\n                cb.click()\n\n        # unselect all aggregations for attr A\n        self.select_table_rows(self.widget.agg_table_view, [0])\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"B - Mean\",\n            \"B - Median\",\n            \"B - Mode\",\n            \"B - Standard deviation\",\n            \"B - Variance\",\n            \"B - Sum\",\n            \"B - Min. value\",\n            \"B - Max. value\",\n            \"B - Span\",\n            \"B - First value\",\n            \"B - Last value\",\n            \"B - Random value\",\n            \"B - Count defined\",\n            \"B - Count\",\n            \"B - Proportion defined\",\n            \"B - Concatenate\",\n            \"A\",\n        ]\n        n = np.nan\n        expected_df = pd.DataFrame(\n            [\n                [n, n, n, n, n, 0, n, n, n, n, n, n, 0, 2, 0, \"\", 1],\n                [1, 1, 1, 0, 0, 2, 1, 1, 0, 1, 1, 1, 2, 2, 1, \"1.0 1.0\", 2],\n            ],\n            columns=expected_columns,\n        )\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n        )\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "new_file_content": "import os\nimport unittest\nfrom typing import List\nfrom unittest.mock import Mock, patch\n\nimport numpy as np\nimport pandas as pd\nfrom AnyQt import QtCore\nfrom AnyQt.QtCore import QItemSelectionModel, Qt\nfrom AnyQt.QtWidgets import QListView\n\nfrom Orange.data import (\n    Table,\n    table_to_frame,\n    Domain,\n    ContinuousVariable,\n)\nfrom Orange.data.tests.test_aggregate import create_sample_data\nfrom Orange.widgets.data.owgroupby import OWGroupBy\nfrom Orange.widgets.tests.base import WidgetTest\n\n\nclass TestOWGroupBy(WidgetTest):\n    def setUp(self) -> None:\n        self.widget = self.create_widget(OWGroupBy)\n        self.iris = Table(\"iris\")\n\n        self.data = create_sample_data()\n\n    def test_none_data(self):\n        self.send_signal(self.widget.Inputs.data, None)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 0)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 0)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    def test_data(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 5)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 5)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    def test_data_domain_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.iris[:, -2:])\n        self.assert_aggregations_equal([\"Mean\", \"Concatenate\"])\n\n        self.send_signal(self.widget.Inputs.data, self.iris[:, -3:])\n        self.assert_aggregations_equal([\"Mean\", \"Mean\", \"Concatenate\"])\n        self.select_table_rows(self.widget.agg_table_view, [0])\n\n    @staticmethod\n    def _set_selection(view: QListView, indices: List[int]):\n        view.clearSelection()\n        sm = view.selectionModel()\n        model = view.model()\n        for ind in indices:\n            sm.select(model.index(ind), QItemSelectionModel.Select)\n\n    def test_groupby_attr_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 3)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 57)\n\n    def assert_enabled_cbs(self, enabled_true):\n        enabled_actual = set(\n            name for name, cb in self.widget.agg_checkboxes.items() if cb.isEnabled()\n        )\n        self.assertSetEqual(enabled_true, enabled_actual)\n\n    @staticmethod\n    def select_table_rows(table, rows):\n        table.clearSelection()\n        indexes = [table.model().index(r, 0) for r in rows]\n        mode = QtCore.QItemSelectionModel.Select | QtCore.QItemSelectionModel.Rows\n        for i in indexes:\n            table.selectionModel().select(i, mode)\n\n    def test_attr_table_row_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        model = self.widget.agg_table_model\n        table = self.widget.agg_table_view\n\n        self.assertListEqual(\n            [\"a\", \"b\", \"cvar\", \"dvar\", \"svar\"],\n            [model.data(model.index(i, 0)) for i in range(model.rowCount())],\n        )\n\n        self.select_table_rows(table, [0])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [0, 1])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3])  # discrete variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2, 3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n\n    def assert_aggregations_equal(self, expected_text):\n        model = self.widget.agg_table_model\n        agg_text = [model.data(model.index(i, 1)) for i in range(model.rowCount())]\n        self.assertListEqual(expected_text, agg_text)\n\n    def test_aggregations_change(self):\n        table = self.widget.agg_table_view\n        d = self.data.domain\n\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        # median is partially checked and will become checked\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Median\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Median, Mode\",\n                \"Mean, Median, Mode\",\n                \"Mean\",\n                \"Concatenate\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 3])\n        # median is unchecked and will change to partially checked\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Count\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Count\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # test the most complicated scenario: numeric with mode, numeric without\n        # mode and discrete\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean, Mode\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1, 3])\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        # must stay partially checked since one Continuous can still have mode\n        # as a aggregation and discrete cannot have it\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # since now all that can have Mode have it as an aggregation it can be\n        # unchecked on the next click\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assertEqual(Qt.Unchecked, self.widget.agg_checkboxes[\"Mode\"].checkState())\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.widget.agg_checkboxes[\"Count defined\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count defined and 1 more\",\n                \"Mean, Mode, Count defined\",\n                \"Mean\",\n                \"Concatenate, Count defined, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\", \"Count defined\"},\n                d[\"b\"]: {\"Mean\", \"Mode\", \"Count defined\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Count defined\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    def test_aggregation(self):\n        \"\"\"Test aggregation results\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        np.testing.assert_array_almost_equal(\n            output.X, [[1, 2.143, 0.317], [2, 2, 2]], decimal=3\n        )\n        np.testing.assert_array_equal(\n            output.metas,\n            np.array(\n                [\n                    [\n                        \"val1 val2 val2 val1 val2 val1\",\n                        \"sval1 sval2 sval2 sval1 sval2 sval1\",\n                        1.0,\n                    ],\n                    [\n                        \"val2 val1 val2 val1 val2 val1\",\n                        \"sval2 sval1 sval2 sval1 sval2 sval1\",\n                        2.0,\n                    ],\n                ],\n                dtype=object,\n            ),\n        )\n\n        # select all aggregations for all features except a and b\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.select_table_rows(self.widget.agg_table_view, [2, 3, 4])\n        # select all aggregations\n        for cb in self.widget.agg_checkboxes.values():\n            cb.click()\n            while not cb.isChecked():\n                cb.click()\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 1])\n        # unselect all aggregations for attr a and b\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"cvar - Mean\",\n            \"cvar - Median\",\n            \"cvar - Mode\",\n            \"cvar - Standard deviation\",\n            \"cvar - Variance\",\n            \"cvar - Sum\",\n            \"cvar - Min. value\",\n            \"cvar - Max. value\",\n            \"cvar - Span\",\n            \"cvar - First value\",\n            \"cvar - Last value\",\n            \"cvar - Count defined\",\n            \"cvar - Count\",\n            \"cvar - Proportion defined\",\n            \"dvar - First value\",\n            \"dvar - Last value\",\n            \"dvar - Count defined\",\n            \"dvar - Count\",\n            \"dvar - Proportion defined\",\n            \"svar - First value\",\n            \"svar - Last value\",\n            \"svar - Count defined\",\n            \"svar - Count\",\n            \"svar - Proportion defined\",\n            \"cvar - Concatenate\",\n            \"dvar - Concatenate\",\n            \"svar - Concatenate\",\n            \"a\",  # groupby variables are last two in metas\n            \"b\",\n        ]\n\n        # fmt: off\n        expected_df = pd.DataFrame([\n            [.15, .15, .1, .07, .005, .3, .1, .2, .1, 0.1, 0.2, 2, 2, 1,\n             \"val1\", \"val2\", 2, 2, 1,\n             \"sval1\", \"sval2\", 2, 2, 1,\n             \"0.1 0.2\", \"val1 val2\", \"sval1 sval2\",\n             1, 1],\n            [.3, .3, .3, np.nan, np.nan, .3, .3, .3, 0, .3, .3, 1, 2, 0.5,\n             \"val2\", \"val2\", 1, 2, 0.5,\n             \"\", \"sval2\", 2, 2, 1,\n             \"0.3\", \"val2\", \"sval2\",\n             1, 2],\n            [.433, .4, .3, 0.153, 0.023, 1.3, .3, .6, .3, .3, .6, 3, 3, 1,\n             \"val1\", \"val1\", 3, 3, 1,\n             \"sval1\", \"sval1\", 3, 3, 1,\n             \"0.3 0.4 0.6\", \"val1 val2 val1\", \"sval1 sval2 sval1\",\n             1, 3],\n            [1.5, 1.5, 1, 0.707, 0.5, 3, 1, 2, 1, 1, 2, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"1.0 2.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 1],\n            [-0.5, -0.5, -4, 4.95, 24.5, -1, -4, 3, 7, 3, -4, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"3.0 -4.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 2],\n            [5, 5, 5, 0, 0, 10, 5, 5, 0, 5, 5, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"5.0 5.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 3]\n            ], columns=expected_columns\n        )\n        # fmt: on\n\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        # remove random since it is not possible to test\n        output_df = output_df.loc[:, ~output_df.columns.str.endswith(\"Random value\")]\n\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n            atol=1e-3,\n        )\n\n    def test_metas_results(self):\n        \"\"\"Test if variable that is in meta in input table remains in metas\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIn(self.data.domain[\"svar\"], output.domain.metas)\n\n    def test_context(self):\n        d = self.data.domain\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 2])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # send new data and previous data to check if context restored correctly\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    @patch(\n        \"Orange.data.aggregate.OrangeTableGroupBy.aggregate\",\n        Mock(side_effect=ValueError(\"Test unexpected err\")),\n    )\n    def test_unexpected_error(self):\n        \"\"\"Test if exception in aggregation shown correctly\"\"\"\n\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.wait_until_finished()\n\n        self.assertTrue(self.widget.Error.unexpected_error.is_shown())\n        self.assertEqual(\n            str(self.widget.Error.unexpected_error),\n            \"Test unexpected err\",\n        )\n\n    def test_time_variable(self):\n        cur_dir = os.path.dirname(os.path.realpath(__file__))\n        test10_path = os.path.join(\n            cur_dir, \"..\", \"..\", \"..\", \"tests\", \"datasets\", \"test10.tab\"\n        )\n        data = Table.from_file(test10_path)\n\n        # time variable as a group by variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [1])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(3, len(output))\n\n        # time variable as a grouped variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [5])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(2, len(output))\n\n    def test_only_nan_in_group(self):\n        data = Table(\n            Domain([ContinuousVariable(\"A\"), ContinuousVariable(\"B\")]),\n            np.array([[1, np.nan], [2, 1], [1, np.nan], [2, 1]]),\n        )\n        self.send_signal(self.widget.Inputs.data, data)\n\n        # select feature A as group-by\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        # select all aggregations for feature B\n        self.select_table_rows(self.widget.agg_table_view, [1])\n        for cb in self.widget.agg_checkboxes.values():\n            while not cb.isChecked():\n                cb.click()\n\n        # unselect all aggregations for attr A\n        self.select_table_rows(self.widget.agg_table_view, [0])\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"B - Mean\",\n            \"B - Median\",\n            \"B - Mode\",\n            \"B - Standard deviation\",\n            \"B - Variance\",\n            \"B - Sum\",\n            \"B - Min. value\",\n            \"B - Max. value\",\n            \"B - Span\",\n            \"B - First value\",\n            \"B - Last value\",\n            \"B - Random value\",\n            \"B - Count defined\",\n            \"B - Count\",\n            \"B - Proportion defined\",\n            \"B - Concatenate\",\n            \"A\",\n        ]\n        n = np.nan\n        expected_df = pd.DataFrame(\n            [\n                [n, n, n, n, n, 0, n, n, n, n, n, n, 0, 2, 0, \"\", 1],\n                [1, 1, 1, 0, 0, 2, 1, 1, 0, 1, 1, 1, 2, 2, 1, \"1.0 1.0\", 2],\n            ],\n            columns=expected_columns,\n        )\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n        )\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/data/tests/test_owgroupby.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "4356622ac",
                "new_commit_hash": "b2c6c2c6d",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/data/tests/test_owgroupby.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/data/tests/test_owgroupby.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 20,
                            "length": 7
                        },
                        "new_range": {
                            "start": 20,
                            "length": 7
                        },
                        "section": "from Orange.widgets.data.owgroupby import OWGroupBy"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "from Orange.widgets.tests.base import WidgetTest",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "class TestOWGropBy(WidgetTest):",
                                "type": "deleted"
                            },
                            {
                                "content": "class TestOWGroupBy(WidgetTest):",
                                "type": "added"
                            },
                            {
                                "content": "    def setUp(self) -> None:",
                                "type": "context"
                            },
                            {
                                "content": "        self.widget = self.create_widget(OWGroupBy)",
                                "type": "context"
                            },
                            {
                                "content": "        self.iris = Table(\"iris\")",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owgroupby.py",
                            "type": "class",
                            "name": "TestOWGroupBy",
                            "content": "class TestOWGroupBy(WidgetTest):\n    def setUp(self) -> None:\n        self.widget = self.create_widget(OWGroupBy)\n        self.iris = Table(\"iris\")\n\n        self.data = create_sample_data()\n\n    def test_none_data(self):\n        self.send_signal(self.widget.Inputs.data, None)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 0)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 0)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    def test_data(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 5)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 5)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    def test_data_domain_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.iris[:, -2:])\n        self.assert_aggregations_equal([\"Mean\", \"Concatenate\"])\n\n        self.send_signal(self.widget.Inputs.data, self.iris[:, -3:])\n        self.assert_aggregations_equal([\"Mean\", \"Mean\", \"Concatenate\"])\n        self.select_table_rows(self.widget.agg_table_view, [0])\n\n    @staticmethod\n    def _set_selection(view: QListView, indices: List[int]):\n        view.clearSelection()\n        sm = view.selectionModel()\n        model = view.model()\n        for ind in indices:\n            sm.select(model.index(ind), QItemSelectionModel.Select)\n\n    def test_groupby_attr_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 3)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 57)\n\n    def assert_enabled_cbs(self, enabled_true):\n        enabled_actual = set(\n            name for name, cb in self.widget.agg_checkboxes.items() if cb.isEnabled()\n        )\n        self.assertSetEqual(enabled_true, enabled_actual)\n\n    @staticmethod\n    def select_table_rows(table, rows):\n        table.clearSelection()\n        indexes = [table.model().index(r, 0) for r in rows]\n        mode = QtCore.QItemSelectionModel.Select | QtCore.QItemSelectionModel.Rows\n        for i in indexes:\n            table.selectionModel().select(i, mode)\n\n    def test_attr_table_row_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        model = self.widget.agg_table_model\n        table = self.widget.agg_table_view\n\n        self.assertListEqual(\n            [\"a\", \"b\", \"cvar\", \"dvar\", \"svar\"],\n            [model.data(model.index(i, 0)) for i in range(model.rowCount())],\n        )\n\n        self.select_table_rows(table, [0])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [0, 1])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3])  # discrete variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2, 3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n\n    def assert_aggregations_equal(self, expected_text):\n        model = self.widget.agg_table_model\n        agg_text = [model.data(model.index(i, 1)) for i in range(model.rowCount())]\n        self.assertListEqual(expected_text, agg_text)\n\n    def test_aggregations_change(self):\n        table = self.widget.agg_table_view\n        d = self.data.domain\n\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        # median is partially checked and will become checked\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Median\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Median, Mode\",\n                \"Mean, Median, Mode\",\n                \"Mean\",\n                \"Concatenate\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 3])\n        # median is unchecked and will change to partially checked\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Count\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Count\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # test the most complicated scenario: numeric with mode, numeric without\n        # mode and discrete\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean, Mode\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1, 3])\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        # must stay partially checked since one Continuous can still have mode\n        # as a aggregation and discrete cannot have it\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # since now all that can have Mode have it as an aggregation it can be\n        # unchecked on the next click\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assertEqual(Qt.Unchecked, self.widget.agg_checkboxes[\"Mode\"].checkState())\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.widget.agg_checkboxes[\"Count defined\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count defined and 1 more\",\n                \"Mean, Mode, Count defined\",\n                \"Mean\",\n                \"Concatenate, Count defined, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\", \"Count defined\"},\n                d[\"b\"]: {\"Mean\", \"Mode\", \"Count defined\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Count defined\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    def test_aggregation(self):\n        \"\"\"Test aggregation results\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        np.testing.assert_array_almost_equal(\n            output.X, [[1, 2.143, 0.317], [2, 2, 2]], decimal=3\n        )\n        np.testing.assert_array_equal(\n            output.metas,\n            np.array(\n                [\n                    [\n                        \"val1 val2 val2 val1 val2 val1\",\n                        \"sval1 sval2 sval2 sval1 sval2 sval1\",\n                        1.0,\n                    ],\n                    [\n                        \"val2 val1 val2 val1 val2 val1\",\n                        \"sval2 sval1 sval2 sval1 sval2 sval1\",\n                        2.0,\n                    ],\n                ],\n                dtype=object,\n            ),\n        )\n\n        # select all aggregations for all features except a and b\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.select_table_rows(self.widget.agg_table_view, [2, 3, 4])\n        # select all aggregations\n        for cb in self.widget.agg_checkboxes.values():\n            cb.click()\n            while not cb.isChecked():\n                cb.click()\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 1])\n        # unselect all aggregations for attr a and b\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"cvar - Mean\",\n            \"cvar - Median\",\n            \"cvar - Mode\",\n            \"cvar - Standard deviation\",\n            \"cvar - Variance\",\n            \"cvar - Sum\",\n            \"cvar - Min. value\",\n            \"cvar - Max. value\",\n            \"cvar - Span\",\n            \"cvar - First value\",\n            \"cvar - Last value\",\n            \"cvar - Count defined\",\n            \"cvar - Count\",\n            \"cvar - Proportion defined\",\n            \"dvar - First value\",\n            \"dvar - Last value\",\n            \"dvar - Count defined\",\n            \"dvar - Count\",\n            \"dvar - Proportion defined\",\n            \"svar - First value\",\n            \"svar - Last value\",\n            \"svar - Count defined\",\n            \"svar - Count\",\n            \"svar - Proportion defined\",\n            \"cvar - Concatenate\",\n            \"dvar - Concatenate\",\n            \"svar - Concatenate\",\n            \"a\",  # groupby variables are last two in metas\n            \"b\",\n        ]\n\n        # fmt: off\n        expected_df = pd.DataFrame([\n            [.15, .15, .1, .07, .005, .3, .1, .2, .1, 0.1, 0.2, 2, 2, 1,\n             \"val1\", \"val2\", 2, 2, 1,\n             \"sval1\", \"sval2\", 2, 2, 1,\n             \"0.1 0.2\", \"val1 val2\", \"sval1 sval2\",\n             1, 1],\n            [.3, .3, .3, np.nan, np.nan, .3, .3, .3, 0, .3, .3, 1, 2, 0.5,\n             \"val2\", \"val2\", 1, 2, 0.5,\n             \"\", \"sval2\", 2, 2, 1,\n             \"0.3\", \"val2\", \"sval2\",\n             1, 2],\n            [.433, .4, .3, 0.153, 0.023, 1.3, .3, .6, .3, .3, .6, 3, 3, 1,\n             \"val1\", \"val1\", 3, 3, 1,\n             \"sval1\", \"sval1\", 3, 3, 1,\n             \"0.3 0.4 0.6\", \"val1 val2 val1\", \"sval1 sval2 sval1\",\n             1, 3],\n            [1.5, 1.5, 1, 0.707, 0.5, 3, 1, 2, 1, 1, 2, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"1.0 2.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 1],\n            [-0.5, -0.5, -4, 4.95, 24.5, -1, -4, 3, 7, 3, -4, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"3.0 -4.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 2],\n            [5, 5, 5, 0, 0, 10, 5, 5, 0, 5, 5, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"5.0 5.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 3]\n            ], columns=expected_columns\n        )\n        # fmt: on\n\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        # remove random since it is not possible to test\n        output_df = output_df.loc[:, ~output_df.columns.str.endswith(\"Random value\")]\n\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n            atol=1e-3,\n        )\n\n    def test_metas_results(self):\n        \"\"\"Test if variable that is in meta in input table remains in metas\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIn(self.data.domain[\"svar\"], output.domain.metas)\n\n    def test_context(self):\n        d = self.data.domain\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 2])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # send new data and previous data to check if context restored correctly\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    @patch(\n        \"Orange.data.aggregate.OrangeTableGroupBy.aggregate\",\n        Mock(side_effect=ValueError(\"Test unexpected err\")),\n    )\n    def test_unexpected_error(self):\n        \"\"\"Test if exception in aggregation shown correctly\"\"\"\n\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.wait_until_finished()\n\n        self.assertTrue(self.widget.Error.unexpected_error.is_shown())\n        self.assertEqual(\n            str(self.widget.Error.unexpected_error),\n            \"Test unexpected err\",\n        )\n\n    def test_time_variable(self):\n        cur_dir = os.path.dirname(os.path.realpath(__file__))\n        test10_path = os.path.join(\n            cur_dir, \"..\", \"..\", \"..\", \"tests\", \"datasets\", \"test10.tab\"\n        )\n        data = Table.from_file(test10_path)\n\n        # time variable as a group by variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [1])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(3, len(output))\n\n        # time variable as a grouped variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [5])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(2, len(output))\n\n    def test_only_nan_in_group(self):\n        data = Table(\n            Domain([ContinuousVariable(\"A\"), ContinuousVariable(\"B\")]),\n            np.array([[1, np.nan], [2, 1], [1, np.nan], [2, 1]]),\n        )\n        self.send_signal(self.widget.Inputs.data, data)\n\n        # select feature A as group-by\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        # select all aggregations for feature B\n        self.select_table_rows(self.widget.agg_table_view, [1])\n        for cb in self.widget.agg_checkboxes.values():\n            while not cb.isChecked():\n                cb.click()\n\n        # unselect all aggregations for attr A\n        self.select_table_rows(self.widget.agg_table_view, [0])\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"B - Mean\",\n            \"B - Median\",\n            \"B - Mode\",\n            \"B - Standard deviation\",\n            \"B - Variance\",\n            \"B - Sum\",\n            \"B - Min. value\",\n            \"B - Max. value\",\n            \"B - Span\",\n            \"B - First value\",\n            \"B - Last value\",\n            \"B - Random value\",\n            \"B - Count defined\",\n            \"B - Count\",\n            \"B - Proportion defined\",\n            \"B - Concatenate\",\n            \"A\",\n        ]\n        n = np.nan\n        expected_df = pd.DataFrame(\n            [\n                [n, n, n, n, n, 0, n, n, n, n, n, n, 0, 2, 0, \"\", 1],\n                [1, 1, 1, 0, 0, 2, 1, 1, 0, 1, 1, 1, 2, 2, 1, \"1.0 1.0\", 2],\n            ],\n            columns=expected_columns,\n        )\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n        )",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 23,
                            "end_lineno": 759,
                            "parent": null
                        }
                    ],
                    "deleted_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owgroupby.py",
                            "type": "class",
                            "name": "TestOWGropBy",
                            "content": "class TestOWGropBy(WidgetTest):\n    def setUp(self) -> None:\n        self.widget = self.create_widget(OWGroupBy)\n        self.iris = Table(\"iris\")\n\n        self.data = create_sample_data()\n\n    def test_none_data(self):\n        self.send_signal(self.widget.Inputs.data, None)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 0)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 0)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    def test_data(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 5)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 5)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    @staticmethod\n    def _set_selection(view: QListView, indices: List[int]):\n        view.clearSelection()\n        sm = view.selectionModel()\n        model = view.model()\n        for ind in indices:\n            sm.select(model.index(ind), QItemSelectionModel.Select)\n\n    def test_groupby_attr_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 3)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 57)\n\n    def assert_enabled_cbs(self, enabled_true):\n        enabled_actual = set(\n            name for name, cb in self.widget.agg_checkboxes.items() if cb.isEnabled()\n        )\n        self.assertSetEqual(enabled_true, enabled_actual)\n\n    @staticmethod\n    def select_table_rows(table, rows):\n        table.clearSelection()\n        indexes = [table.model().index(r, 0) for r in rows]\n        mode = QtCore.QItemSelectionModel.Select | QtCore.QItemSelectionModel.Rows\n        for i in indexes:\n            table.selectionModel().select(i, mode)\n\n    def test_attr_table_row_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        model = self.widget.agg_table_model\n        table = self.widget.agg_table_view\n\n        self.assertListEqual(\n            [\"a\", \"b\", \"cvar\", \"dvar\", \"svar\"],\n            [model.data(model.index(i, 0)) for i in range(model.rowCount())],\n        )\n\n        self.select_table_rows(table, [0])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [0, 1])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3])  # discrete variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2, 3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n\n    def assert_aggregations_equal(self, expected_text):\n        model = self.widget.agg_table_model\n        agg_text = [model.data(model.index(i, 1)) for i in range(model.rowCount())]\n        self.assertListEqual(expected_text, agg_text)\n\n    def test_aggregations_change(self):\n        table = self.widget.agg_table_view\n        d = self.data.domain\n\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        # median is partially checked and will become checked\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Median\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Median, Mode\",\n                \"Mean, Median, Mode\",\n                \"Mean\",\n                \"Concatenate\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 3])\n        # median is unchecked and will change to partially checked\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Count\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Count\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # test the most complicated scenario: numeric with mode, numeric without\n        # mode and discrete\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean, Mode\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1, 3])\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        # must stay partially checked since one Continuous can still have mode\n        # as a aggregation and discrete cannot have it\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # since now all that can have Mode have it as an aggregation it can be\n        # unchecked on the next click\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assertEqual(Qt.Unchecked, self.widget.agg_checkboxes[\"Mode\"].checkState())\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.widget.agg_checkboxes[\"Count defined\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count defined and 1 more\",\n                \"Mean, Mode, Count defined\",\n                \"Mean\",\n                \"Concatenate, Count defined, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\", \"Count defined\"},\n                d[\"b\"]: {\"Mean\", \"Mode\", \"Count defined\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Count defined\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    def test_aggregation(self):\n        \"\"\"Test aggregation results\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        np.testing.assert_array_almost_equal(\n            output.X, [[1, 2.143, 0.317], [2, 2, 2]], decimal=3\n        )\n        np.testing.assert_array_equal(\n            output.metas,\n            np.array(\n                [\n                    [\n                        \"val1 val2 val2 val1 val2 val1\",\n                        \"sval1 sval2 sval2 sval1 sval2 sval1\",\n                        1.0,\n                    ],\n                    [\n                        \"val2 val1 val2 val1 val2 val1\",\n                        \"sval2 sval1 sval2 sval1 sval2 sval1\",\n                        2.0,\n                    ],\n                ],\n                dtype=object,\n            ),\n        )\n\n        # select all aggregations for all features except a and b\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.select_table_rows(self.widget.agg_table_view, [2, 3, 4])\n        # select all aggregations\n        for cb in self.widget.agg_checkboxes.values():\n            cb.click()\n            while not cb.isChecked():\n                cb.click()\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 1])\n        # unselect all aggregations for attr a and b\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"cvar - Mean\",\n            \"cvar - Median\",\n            \"cvar - Mode\",\n            \"cvar - Standard deviation\",\n            \"cvar - Variance\",\n            \"cvar - Sum\",\n            \"cvar - Min. value\",\n            \"cvar - Max. value\",\n            \"cvar - Span\",\n            \"cvar - First value\",\n            \"cvar - Last value\",\n            \"cvar - Count defined\",\n            \"cvar - Count\",\n            \"cvar - Proportion defined\",\n            \"dvar - First value\",\n            \"dvar - Last value\",\n            \"dvar - Count defined\",\n            \"dvar - Count\",\n            \"dvar - Proportion defined\",\n            \"svar - First value\",\n            \"svar - Last value\",\n            \"svar - Count defined\",\n            \"svar - Count\",\n            \"svar - Proportion defined\",\n            \"cvar - Concatenate\",\n            \"dvar - Concatenate\",\n            \"svar - Concatenate\",\n            \"a\",  # groupby variables are last two in metas\n            \"b\",\n        ]\n\n        # fmt: off\n        expected_df = pd.DataFrame([\n            [.15, .15, .1, .07, .005, .3, .1, .2, .1, 0.1, 0.2, 2, 2, 1,\n             \"val1\", \"val2\", 2, 2, 1,\n             \"sval1\", \"sval2\", 2, 2, 1,\n             \"0.1 0.2\", \"val1 val2\", \"sval1 sval2\",\n             1, 1],\n            [.3, .3, .3, np.nan, np.nan, .3, .3, .3, 0, .3, .3, 1, 2, 0.5,\n             \"val2\", \"val2\", 1, 2, 0.5,\n             \"\", \"sval2\", 2, 2, 1,\n             \"0.3\", \"val2\", \"sval2\",\n             1, 2],\n            [.433, .4, .3, 0.153, 0.023, 1.3, .3, .6, .3, .3, .6, 3, 3, 1,\n             \"val1\", \"val1\", 3, 3, 1,\n             \"sval1\", \"sval1\", 3, 3, 1,\n             \"0.3 0.4 0.6\", \"val1 val2 val1\", \"sval1 sval2 sval1\",\n             1, 3],\n            [1.5, 1.5, 1, 0.707, 0.5, 3, 1, 2, 1, 1, 2, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"1.0 2.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 1],\n            [-0.5, -0.5, -4, 4.95, 24.5, -1, -4, 3, 7, 3, -4, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"3.0 -4.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 2],\n            [5, 5, 5, 0, 0, 10, 5, 5, 0, 5, 5, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"5.0 5.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 3]\n            ], columns=expected_columns\n        )\n        # fmt: on\n\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        # remove random since it is not possible to test\n        output_df = output_df.loc[:, ~output_df.columns.str.endswith(\"Random value\")]\n\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n            atol=1e-3,\n        )\n\n    def test_metas_results(self):\n        \"\"\"Test if variable that is in meta in input table remains in metas\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIn(self.data.domain[\"svar\"], output.domain.metas)\n\n    def test_context(self):\n        d = self.data.domain\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 2])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # send new data and previous data to check if context restored correctly\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    @patch(\n        \"Orange.data.aggregate.OrangeTableGroupBy.aggregate\",\n        Mock(side_effect=ValueError(\"Test unexpected err\")),\n    )\n    def test_unexpected_error(self):\n        \"\"\"Test if exception in aggregation shown correctly\"\"\"\n\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.wait_until_finished()\n\n        self.assertTrue(self.widget.Error.unexpected_error.is_shown())\n        self.assertEqual(\n            str(self.widget.Error.unexpected_error),\n            \"Test unexpected err\",\n        )\n\n    def test_time_variable(self):\n        cur_dir = os.path.dirname(os.path.realpath(__file__))\n        test10_path = os.path.join(\n            cur_dir, \"..\", \"..\", \"..\", \"tests\", \"datasets\", \"test10.tab\"\n        )\n        data = Table.from_file(test10_path)\n\n        # time variable as a group by variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [1])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(3, len(output))\n\n        # time variable as a grouped variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [5])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(2, len(output))\n\n    def test_only_nan_in_group(self):\n        data = Table(\n            Domain([ContinuousVariable(\"A\"), ContinuousVariable(\"B\")]),\n            np.array([[1, np.nan], [2, 1], [1, np.nan], [2, 1]]),\n        )\n        self.send_signal(self.widget.Inputs.data, data)\n\n        # select feature A as group-by\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        # select all aggregations for feature B\n        self.select_table_rows(self.widget.agg_table_view, [1])\n        for cb in self.widget.agg_checkboxes.values():\n            while not cb.isChecked():\n                cb.click()\n\n        # unselect all aggregations for attr A\n        self.select_table_rows(self.widget.agg_table_view, [0])\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"B - Mean\",\n            \"B - Median\",\n            \"B - Mode\",\n            \"B - Standard deviation\",\n            \"B - Variance\",\n            \"B - Sum\",\n            \"B - Min. value\",\n            \"B - Max. value\",\n            \"B - Span\",\n            \"B - First value\",\n            \"B - Last value\",\n            \"B - Random value\",\n            \"B - Count defined\",\n            \"B - Count\",\n            \"B - Proportion defined\",\n            \"B - Concatenate\",\n            \"A\",\n        ]\n        n = np.nan\n        expected_df = pd.DataFrame(\n            [\n                [n, n, n, n, n, 0, n, n, n, n, n, n, 0, 2, 0, \"\", 1],\n                [1, 1, 1, 0, 0, 2, 1, 1, 0, 1, 1, 1, 2, 2, 1, \"1.0 1.0\", 2],\n            ],\n            columns=expected_columns,\n        )\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n        )",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 23,
                            "end_lineno": 751,
                            "parent": null
                        }
                    ]
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 46,
                            "length": 6
                        },
                        "new_range": {
                            "start": 46,
                            "length": 14
                        },
                        "section": "class TestOWGropBy(WidgetTest):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.send_signal(self.widget.Inputs.data, None)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertIsNone(self.get_output(self.widget.Outputs.data))",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_data_domain_changed(self):",
                                "type": "added"
                            },
                            {
                                "content": "        self.send_signal(self.widget.Inputs.data, self.iris[:, -2:])",
                                "type": "added"
                            },
                            {
                                "content": "        self.assert_aggregations_equal([\"Mean\", \"Concatenate\"])",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        self.send_signal(self.widget.Inputs.data, self.iris[:, -3:])",
                                "type": "added"
                            },
                            {
                                "content": "        self.assert_aggregations_equal([\"Mean\", \"Mean\", \"Concatenate\"])",
                                "type": "added"
                            },
                            {
                                "content": "        self.select_table_rows(self.widget.agg_table_view, [0])",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    @staticmethod",
                                "type": "context"
                            },
                            {
                                "content": "    def _set_selection(view: QListView, indices: List[int]):",
                                "type": "context"
                            },
                            {
                                "content": "        view.clearSelection()",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owgroupby.py",
                            "type": "class",
                            "name": "TestOWGroupBy",
                            "content": "class TestOWGroupBy(WidgetTest):\n    def setUp(self) -> None:\n        self.widget = self.create_widget(OWGroupBy)\n        self.iris = Table(\"iris\")\n\n        self.data = create_sample_data()\n\n    def test_none_data(self):\n        self.send_signal(self.widget.Inputs.data, None)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 0)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 0)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    def test_data(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 5)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 5)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    def test_data_domain_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.iris[:, -2:])\n        self.assert_aggregations_equal([\"Mean\", \"Concatenate\"])\n\n        self.send_signal(self.widget.Inputs.data, self.iris[:, -3:])\n        self.assert_aggregations_equal([\"Mean\", \"Mean\", \"Concatenate\"])\n        self.select_table_rows(self.widget.agg_table_view, [0])\n\n    @staticmethod\n    def _set_selection(view: QListView, indices: List[int]):\n        view.clearSelection()\n        sm = view.selectionModel()\n        model = view.model()\n        for ind in indices:\n            sm.select(model.index(ind), QItemSelectionModel.Select)\n\n    def test_groupby_attr_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 3)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 57)\n\n    def assert_enabled_cbs(self, enabled_true):\n        enabled_actual = set(\n            name for name, cb in self.widget.agg_checkboxes.items() if cb.isEnabled()\n        )\n        self.assertSetEqual(enabled_true, enabled_actual)\n\n    @staticmethod\n    def select_table_rows(table, rows):\n        table.clearSelection()\n        indexes = [table.model().index(r, 0) for r in rows]\n        mode = QtCore.QItemSelectionModel.Select | QtCore.QItemSelectionModel.Rows\n        for i in indexes:\n            table.selectionModel().select(i, mode)\n\n    def test_attr_table_row_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        model = self.widget.agg_table_model\n        table = self.widget.agg_table_view\n\n        self.assertListEqual(\n            [\"a\", \"b\", \"cvar\", \"dvar\", \"svar\"],\n            [model.data(model.index(i, 0)) for i in range(model.rowCount())],\n        )\n\n        self.select_table_rows(table, [0])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [0, 1])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3])  # discrete variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2, 3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n\n    def assert_aggregations_equal(self, expected_text):\n        model = self.widget.agg_table_model\n        agg_text = [model.data(model.index(i, 1)) for i in range(model.rowCount())]\n        self.assertListEqual(expected_text, agg_text)\n\n    def test_aggregations_change(self):\n        table = self.widget.agg_table_view\n        d = self.data.domain\n\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        # median is partially checked and will become checked\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Median\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Median, Mode\",\n                \"Mean, Median, Mode\",\n                \"Mean\",\n                \"Concatenate\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 3])\n        # median is unchecked and will change to partially checked\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Count\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Count\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # test the most complicated scenario: numeric with mode, numeric without\n        # mode and discrete\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean, Mode\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1, 3])\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        # must stay partially checked since one Continuous can still have mode\n        # as a aggregation and discrete cannot have it\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # since now all that can have Mode have it as an aggregation it can be\n        # unchecked on the next click\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assertEqual(Qt.Unchecked, self.widget.agg_checkboxes[\"Mode\"].checkState())\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.widget.agg_checkboxes[\"Count defined\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count defined and 1 more\",\n                \"Mean, Mode, Count defined\",\n                \"Mean\",\n                \"Concatenate, Count defined, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\", \"Count defined\"},\n                d[\"b\"]: {\"Mean\", \"Mode\", \"Count defined\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Count defined\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    def test_aggregation(self):\n        \"\"\"Test aggregation results\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        np.testing.assert_array_almost_equal(\n            output.X, [[1, 2.143, 0.317], [2, 2, 2]], decimal=3\n        )\n        np.testing.assert_array_equal(\n            output.metas,\n            np.array(\n                [\n                    [\n                        \"val1 val2 val2 val1 val2 val1\",\n                        \"sval1 sval2 sval2 sval1 sval2 sval1\",\n                        1.0,\n                    ],\n                    [\n                        \"val2 val1 val2 val1 val2 val1\",\n                        \"sval2 sval1 sval2 sval1 sval2 sval1\",\n                        2.0,\n                    ],\n                ],\n                dtype=object,\n            ),\n        )\n\n        # select all aggregations for all features except a and b\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.select_table_rows(self.widget.agg_table_view, [2, 3, 4])\n        # select all aggregations\n        for cb in self.widget.agg_checkboxes.values():\n            cb.click()\n            while not cb.isChecked():\n                cb.click()\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 1])\n        # unselect all aggregations for attr a and b\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"cvar - Mean\",\n            \"cvar - Median\",\n            \"cvar - Mode\",\n            \"cvar - Standard deviation\",\n            \"cvar - Variance\",\n            \"cvar - Sum\",\n            \"cvar - Min. value\",\n            \"cvar - Max. value\",\n            \"cvar - Span\",\n            \"cvar - First value\",\n            \"cvar - Last value\",\n            \"cvar - Count defined\",\n            \"cvar - Count\",\n            \"cvar - Proportion defined\",\n            \"dvar - First value\",\n            \"dvar - Last value\",\n            \"dvar - Count defined\",\n            \"dvar - Count\",\n            \"dvar - Proportion defined\",\n            \"svar - First value\",\n            \"svar - Last value\",\n            \"svar - Count defined\",\n            \"svar - Count\",\n            \"svar - Proportion defined\",\n            \"cvar - Concatenate\",\n            \"dvar - Concatenate\",\n            \"svar - Concatenate\",\n            \"a\",  # groupby variables are last two in metas\n            \"b\",\n        ]\n\n        # fmt: off\n        expected_df = pd.DataFrame([\n            [.15, .15, .1, .07, .005, .3, .1, .2, .1, 0.1, 0.2, 2, 2, 1,\n             \"val1\", \"val2\", 2, 2, 1,\n             \"sval1\", \"sval2\", 2, 2, 1,\n             \"0.1 0.2\", \"val1 val2\", \"sval1 sval2\",\n             1, 1],\n            [.3, .3, .3, np.nan, np.nan, .3, .3, .3, 0, .3, .3, 1, 2, 0.5,\n             \"val2\", \"val2\", 1, 2, 0.5,\n             \"\", \"sval2\", 2, 2, 1,\n             \"0.3\", \"val2\", \"sval2\",\n             1, 2],\n            [.433, .4, .3, 0.153, 0.023, 1.3, .3, .6, .3, .3, .6, 3, 3, 1,\n             \"val1\", \"val1\", 3, 3, 1,\n             \"sval1\", \"sval1\", 3, 3, 1,\n             \"0.3 0.4 0.6\", \"val1 val2 val1\", \"sval1 sval2 sval1\",\n             1, 3],\n            [1.5, 1.5, 1, 0.707, 0.5, 3, 1, 2, 1, 1, 2, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"1.0 2.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 1],\n            [-0.5, -0.5, -4, 4.95, 24.5, -1, -4, 3, 7, 3, -4, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"3.0 -4.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 2],\n            [5, 5, 5, 0, 0, 10, 5, 5, 0, 5, 5, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"5.0 5.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 3]\n            ], columns=expected_columns\n        )\n        # fmt: on\n\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        # remove random since it is not possible to test\n        output_df = output_df.loc[:, ~output_df.columns.str.endswith(\"Random value\")]\n\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n            atol=1e-3,\n        )\n\n    def test_metas_results(self):\n        \"\"\"Test if variable that is in meta in input table remains in metas\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIn(self.data.domain[\"svar\"], output.domain.metas)\n\n    def test_context(self):\n        d = self.data.domain\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 2])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # send new data and previous data to check if context restored correctly\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    @patch(\n        \"Orange.data.aggregate.OrangeTableGroupBy.aggregate\",\n        Mock(side_effect=ValueError(\"Test unexpected err\")),\n    )\n    def test_unexpected_error(self):\n        \"\"\"Test if exception in aggregation shown correctly\"\"\"\n\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.wait_until_finished()\n\n        self.assertTrue(self.widget.Error.unexpected_error.is_shown())\n        self.assertEqual(\n            str(self.widget.Error.unexpected_error),\n            \"Test unexpected err\",\n        )\n\n    def test_time_variable(self):\n        cur_dir = os.path.dirname(os.path.realpath(__file__))\n        test10_path = os.path.join(\n            cur_dir, \"..\", \"..\", \"..\", \"tests\", \"datasets\", \"test10.tab\"\n        )\n        data = Table.from_file(test10_path)\n\n        # time variable as a group by variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [1])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(3, len(output))\n\n        # time variable as a grouped variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [5])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(2, len(output))\n\n    def test_only_nan_in_group(self):\n        data = Table(\n            Domain([ContinuousVariable(\"A\"), ContinuousVariable(\"B\")]),\n            np.array([[1, np.nan], [2, 1], [1, np.nan], [2, 1]]),\n        )\n        self.send_signal(self.widget.Inputs.data, data)\n\n        # select feature A as group-by\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        # select all aggregations for feature B\n        self.select_table_rows(self.widget.agg_table_view, [1])\n        for cb in self.widget.agg_checkboxes.values():\n            while not cb.isChecked():\n                cb.click()\n\n        # unselect all aggregations for attr A\n        self.select_table_rows(self.widget.agg_table_view, [0])\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"B - Mean\",\n            \"B - Median\",\n            \"B - Mode\",\n            \"B - Standard deviation\",\n            \"B - Variance\",\n            \"B - Sum\",\n            \"B - Min. value\",\n            \"B - Max. value\",\n            \"B - Span\",\n            \"B - First value\",\n            \"B - Last value\",\n            \"B - Random value\",\n            \"B - Count defined\",\n            \"B - Count\",\n            \"B - Proportion defined\",\n            \"B - Concatenate\",\n            \"A\",\n        ]\n        n = np.nan\n        expected_df = pd.DataFrame(\n            [\n                [n, n, n, n, n, 0, n, n, n, n, n, n, 0, 2, 0, \"\", 1],\n                [1, 1, 1, 0, 0, 2, 1, 1, 0, 1, 1, 1, 2, 2, 1, \"1.0 1.0\", 2],\n            ],\n            columns=expected_columns,\n        )\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n        )",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 23,
                            "end_lineno": 759,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/widgets/data/tests/test_owgroupby.py",
                            "type": "method",
                            "name": "TestOWGroupBy.test_data_domain_changed",
                            "content": "class TestOWGroupBy(WidgetTest):\n    def setUp(self) -> None:\n        self.widget = self.create_widget(OWGroupBy)\n        self.iris = Table(\"iris\")\n\n        self.data = create_sample_data()\n\n    def test_none_data(self):\n        self.send_signal(self.widget.Inputs.data, None)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 0)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 0)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    def test_data(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 5)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 5)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    def test_data_domain_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.iris[:, -2:])\n        self.assert_aggregations_equal([\"Mean\", \"Concatenate\"])\n\n        self.send_signal(self.widget.Inputs.data, self.iris[:, -3:])\n        self.assert_aggregations_equal([\"Mean\", \"Mean\", \"Concatenate\"])\n        self.select_table_rows(self.widget.agg_table_view, [0])\n\n    @staticmethod\n    def _set_selection(view: QListView, indices: List[int]):\n        view.clearSelection()\n        sm = view.selectionModel()\n        model = view.model()\n        for ind in indices:\n            sm.select(model.index(ind), QItemSelectionModel.Select)\n\n    def test_groupby_attr_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 3)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 57)\n\n    def assert_enabled_cbs(self, enabled_true):\n        enabled_actual = set(\n            name for name, cb in self.widget.agg_checkboxes.items() if cb.isEnabled()\n        )\n        self.assertSetEqual(enabled_true, enabled_actual)\n\n    @staticmethod\n    def select_table_rows(table, rows):\n        table.clearSelection()\n        indexes = [table.model().index(r, 0) for r in rows]\n        mode = QtCore.QItemSelectionModel.Select | QtCore.QItemSelectionModel.Rows\n        for i in indexes:\n            table.selectionModel().select(i, mode)\n\n    def test_attr_table_row_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        model = self.widget.agg_table_model\n        table = self.widget.agg_table_view\n\n        self.assertListEqual(\n            [\"a\", \"b\", \"cvar\", \"dvar\", \"svar\"],\n            [model.data(model.index(i, 0)) for i in range(model.rowCount())],\n        )\n\n        self.select_table_rows(table, [0])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [0, 1])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3])  # discrete variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2, 3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n\n    def assert_aggregations_equal(self, expected_text):\n        model = self.widget.agg_table_model\n        agg_text = [model.data(model.index(i, 1)) for i in range(model.rowCount())]\n        self.assertListEqual(expected_text, agg_text)\n\n    def test_aggregations_change(self):\n        table = self.widget.agg_table_view\n        d = self.data.domain\n\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        # median is partially checked and will become checked\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Median\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Median, Mode\",\n                \"Mean, Median, Mode\",\n                \"Mean\",\n                \"Concatenate\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 3])\n        # median is unchecked and will change to partially checked\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Count\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Count\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # test the most complicated scenario: numeric with mode, numeric without\n        # mode and discrete\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean, Mode\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1, 3])\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        # must stay partially checked since one Continuous can still have mode\n        # as a aggregation and discrete cannot have it\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # since now all that can have Mode have it as an aggregation it can be\n        # unchecked on the next click\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assertEqual(Qt.Unchecked, self.widget.agg_checkboxes[\"Mode\"].checkState())\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.widget.agg_checkboxes[\"Count defined\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count defined and 1 more\",\n                \"Mean, Mode, Count defined\",\n                \"Mean\",\n                \"Concatenate, Count defined, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\", \"Count defined\"},\n                d[\"b\"]: {\"Mean\", \"Mode\", \"Count defined\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Count defined\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    def test_aggregation(self):\n        \"\"\"Test aggregation results\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        np.testing.assert_array_almost_equal(\n            output.X, [[1, 2.143, 0.317], [2, 2, 2]], decimal=3\n        )\n        np.testing.assert_array_equal(\n            output.metas,\n            np.array(\n                [\n                    [\n                        \"val1 val2 val2 val1 val2 val1\",\n                        \"sval1 sval2 sval2 sval1 sval2 sval1\",\n                        1.0,\n                    ],\n                    [\n                        \"val2 val1 val2 val1 val2 val1\",\n                        \"sval2 sval1 sval2 sval1 sval2 sval1\",\n                        2.0,\n                    ],\n                ],\n                dtype=object,\n            ),\n        )\n\n        # select all aggregations for all features except a and b\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.select_table_rows(self.widget.agg_table_view, [2, 3, 4])\n        # select all aggregations\n        for cb in self.widget.agg_checkboxes.values():\n            cb.click()\n            while not cb.isChecked():\n                cb.click()\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 1])\n        # unselect all aggregations for attr a and b\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"cvar - Mean\",\n            \"cvar - Median\",\n            \"cvar - Mode\",\n            \"cvar - Standard deviation\",\n            \"cvar - Variance\",\n            \"cvar - Sum\",\n            \"cvar - Min. value\",\n            \"cvar - Max. value\",\n            \"cvar - Span\",\n            \"cvar - First value\",\n            \"cvar - Last value\",\n            \"cvar - Count defined\",\n            \"cvar - Count\",\n            \"cvar - Proportion defined\",\n            \"dvar - First value\",\n            \"dvar - Last value\",\n            \"dvar - Count defined\",\n            \"dvar - Count\",\n            \"dvar - Proportion defined\",\n            \"svar - First value\",\n            \"svar - Last value\",\n            \"svar - Count defined\",\n            \"svar - Count\",\n            \"svar - Proportion defined\",\n            \"cvar - Concatenate\",\n            \"dvar - Concatenate\",\n            \"svar - Concatenate\",\n            \"a\",  # groupby variables are last two in metas\n            \"b\",\n        ]\n\n        # fmt: off\n        expected_df = pd.DataFrame([\n            [.15, .15, .1, .07, .005, .3, .1, .2, .1, 0.1, 0.2, 2, 2, 1,\n             \"val1\", \"val2\", 2, 2, 1,\n             \"sval1\", \"sval2\", 2, 2, 1,\n             \"0.1 0.2\", \"val1 val2\", \"sval1 sval2\",\n             1, 1],\n            [.3, .3, .3, np.nan, np.nan, .3, .3, .3, 0, .3, .3, 1, 2, 0.5,\n             \"val2\", \"val2\", 1, 2, 0.5,\n             \"\", \"sval2\", 2, 2, 1,\n             \"0.3\", \"val2\", \"sval2\",\n             1, 2],\n            [.433, .4, .3, 0.153, 0.023, 1.3, .3, .6, .3, .3, .6, 3, 3, 1,\n             \"val1\", \"val1\", 3, 3, 1,\n             \"sval1\", \"sval1\", 3, 3, 1,\n             \"0.3 0.4 0.6\", \"val1 val2 val1\", \"sval1 sval2 sval1\",\n             1, 3],\n            [1.5, 1.5, 1, 0.707, 0.5, 3, 1, 2, 1, 1, 2, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"1.0 2.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 1],\n            [-0.5, -0.5, -4, 4.95, 24.5, -1, -4, 3, 7, 3, -4, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"3.0 -4.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 2],\n            [5, 5, 5, 0, 0, 10, 5, 5, 0, 5, 5, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"5.0 5.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 3]\n            ], columns=expected_columns\n        )\n        # fmt: on\n\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        # remove random since it is not possible to test\n        output_df = output_df.loc[:, ~output_df.columns.str.endswith(\"Random value\")]\n\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n            atol=1e-3,\n        )\n\n    def test_metas_results(self):\n        \"\"\"Test if variable that is in meta in input table remains in metas\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIn(self.data.domain[\"svar\"], output.domain.metas)\n\n    def test_context(self):\n        d = self.data.domain\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 2])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # send new data and previous data to check if context restored correctly\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    @patch(\n        \"Orange.data.aggregate.OrangeTableGroupBy.aggregate\",\n        Mock(side_effect=ValueError(\"Test unexpected err\")),\n    )\n    def test_unexpected_error(self):\n        \"\"\"Test if exception in aggregation shown correctly\"\"\"\n\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.wait_until_finished()\n\n        self.assertTrue(self.widget.Error.unexpected_error.is_shown())\n        self.assertEqual(\n            str(self.widget.Error.unexpected_error),\n            \"Test unexpected err\",\n        )\n\n    def test_time_variable(self):\n        cur_dir = os.path.dirname(os.path.realpath(__file__))\n        test10_path = os.path.join(\n            cur_dir, \"..\", \"..\", \"..\", \"tests\", \"datasets\", \"test10.tab\"\n        )\n        data = Table.from_file(test10_path)\n\n        # time variable as a group by variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [1])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(3, len(output))\n\n        # time variable as a grouped variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [5])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(2, len(output))\n\n    def test_only_nan_in_group(self):\n        data = Table(\n            Domain([ContinuousVariable(\"A\"), ContinuousVariable(\"B\")]),\n            np.array([[1, np.nan], [2, 1], [1, np.nan], [2, 1]]),\n        )\n        self.send_signal(self.widget.Inputs.data, data)\n\n        # select feature A as group-by\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        # select all aggregations for feature B\n        self.select_table_rows(self.widget.agg_table_view, [1])\n        for cb in self.widget.agg_checkboxes.values():\n            while not cb.isChecked():\n                cb.click()\n\n        # unselect all aggregations for attr A\n        self.select_table_rows(self.widget.agg_table_view, [0])\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"B - Mean\",\n            \"B - Median\",\n            \"B - Mode\",\n            \"B - Standard deviation\",\n            \"B - Variance\",\n            \"B - Sum\",\n            \"B - Min. value\",\n            \"B - Max. value\",\n            \"B - Span\",\n            \"B - First value\",\n            \"B - Last value\",\n            \"B - Random value\",\n            \"B - Count defined\",\n            \"B - Count\",\n            \"B - Proportion defined\",\n            \"B - Concatenate\",\n            \"A\",\n        ]\n        n = np.nan\n        expected_df = pd.DataFrame(\n            [\n                [n, n, n, n, n, 0, n, n, n, n, n, n, 0, 2, 0, \"\", 1],\n                [1, 1, 1, 0, 0, 2, 1, 1, 0, 1, 1, 1, 2, 2, 1, \"1.0 1.0\", 2],\n            ],\n            columns=expected_columns,\n        )\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n        )",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 49,
                            "end_lineno": 55,
                            "parent": {
                                "file_name": "Orange/widgets/data/tests/test_owgroupby.py",
                                "type": "class",
                                "name": "TestOWGroupBy",
                                "content": "class TestOWGroupBy(WidgetTest):\n    def setUp(self) -> None:\n        self.widget = self.create_widget(OWGroupBy)\n        self.iris = Table(\"iris\")\n\n        self.data = create_sample_data()\n\n    def test_none_data(self):\n        self.send_signal(self.widget.Inputs.data, None)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 0)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 0)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    def test_data(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 5)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 5)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    def test_data_domain_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.iris[:, -2:])\n        self.assert_aggregations_equal([\"Mean\", \"Concatenate\"])\n\n        self.send_signal(self.widget.Inputs.data, self.iris[:, -3:])\n        self.assert_aggregations_equal([\"Mean\", \"Mean\", \"Concatenate\"])\n        self.select_table_rows(self.widget.agg_table_view, [0])\n\n    @staticmethod\n    def _set_selection(view: QListView, indices: List[int]):\n        view.clearSelection()\n        sm = view.selectionModel()\n        model = view.model()\n        for ind in indices:\n            sm.select(model.index(ind), QItemSelectionModel.Select)\n\n    def test_groupby_attr_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 3)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 57)\n\n    def assert_enabled_cbs(self, enabled_true):\n        enabled_actual = set(\n            name for name, cb in self.widget.agg_checkboxes.items() if cb.isEnabled()\n        )\n        self.assertSetEqual(enabled_true, enabled_actual)\n\n    @staticmethod\n    def select_table_rows(table, rows):\n        table.clearSelection()\n        indexes = [table.model().index(r, 0) for r in rows]\n        mode = QtCore.QItemSelectionModel.Select | QtCore.QItemSelectionModel.Rows\n        for i in indexes:\n            table.selectionModel().select(i, mode)\n\n    def test_attr_table_row_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        model = self.widget.agg_table_model\n        table = self.widget.agg_table_view\n\n        self.assertListEqual(\n            [\"a\", \"b\", \"cvar\", \"dvar\", \"svar\"],\n            [model.data(model.index(i, 0)) for i in range(model.rowCount())],\n        )\n\n        self.select_table_rows(table, [0])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [0, 1])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3])  # discrete variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2, 3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n\n    def assert_aggregations_equal(self, expected_text):\n        model = self.widget.agg_table_model\n        agg_text = [model.data(model.index(i, 1)) for i in range(model.rowCount())]\n        self.assertListEqual(expected_text, agg_text)\n\n    def test_aggregations_change(self):\n        table = self.widget.agg_table_view\n        d = self.data.domain\n\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        # median is partially checked and will become checked\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Median\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Median, Mode\",\n                \"Mean, Median, Mode\",\n                \"Mean\",\n                \"Concatenate\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 3])\n        # median is unchecked and will change to partially checked\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Count\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Count\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # test the most complicated scenario: numeric with mode, numeric without\n        # mode and discrete\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean, Mode\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1, 3])\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        # must stay partially checked since one Continuous can still have mode\n        # as a aggregation and discrete cannot have it\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # since now all that can have Mode have it as an aggregation it can be\n        # unchecked on the next click\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assertEqual(Qt.Unchecked, self.widget.agg_checkboxes[\"Mode\"].checkState())\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.widget.agg_checkboxes[\"Count defined\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count defined and 1 more\",\n                \"Mean, Mode, Count defined\",\n                \"Mean\",\n                \"Concatenate, Count defined, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\", \"Count defined\"},\n                d[\"b\"]: {\"Mean\", \"Mode\", \"Count defined\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Count defined\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    def test_aggregation(self):\n        \"\"\"Test aggregation results\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        np.testing.assert_array_almost_equal(\n            output.X, [[1, 2.143, 0.317], [2, 2, 2]], decimal=3\n        )\n        np.testing.assert_array_equal(\n            output.metas,\n            np.array(\n                [\n                    [\n                        \"val1 val2 val2 val1 val2 val1\",\n                        \"sval1 sval2 sval2 sval1 sval2 sval1\",\n                        1.0,\n                    ],\n                    [\n                        \"val2 val1 val2 val1 val2 val1\",\n                        \"sval2 sval1 sval2 sval1 sval2 sval1\",\n                        2.0,\n                    ],\n                ],\n                dtype=object,\n            ),\n        )\n\n        # select all aggregations for all features except a and b\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.select_table_rows(self.widget.agg_table_view, [2, 3, 4])\n        # select all aggregations\n        for cb in self.widget.agg_checkboxes.values():\n            cb.click()\n            while not cb.isChecked():\n                cb.click()\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 1])\n        # unselect all aggregations for attr a and b\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"cvar - Mean\",\n            \"cvar - Median\",\n            \"cvar - Mode\",\n            \"cvar - Standard deviation\",\n            \"cvar - Variance\",\n            \"cvar - Sum\",\n            \"cvar - Min. value\",\n            \"cvar - Max. value\",\n            \"cvar - Span\",\n            \"cvar - First value\",\n            \"cvar - Last value\",\n            \"cvar - Count defined\",\n            \"cvar - Count\",\n            \"cvar - Proportion defined\",\n            \"dvar - First value\",\n            \"dvar - Last value\",\n            \"dvar - Count defined\",\n            \"dvar - Count\",\n            \"dvar - Proportion defined\",\n            \"svar - First value\",\n            \"svar - Last value\",\n            \"svar - Count defined\",\n            \"svar - Count\",\n            \"svar - Proportion defined\",\n            \"cvar - Concatenate\",\n            \"dvar - Concatenate\",\n            \"svar - Concatenate\",\n            \"a\",  # groupby variables are last two in metas\n            \"b\",\n        ]\n\n        # fmt: off\n        expected_df = pd.DataFrame([\n            [.15, .15, .1, .07, .005, .3, .1, .2, .1, 0.1, 0.2, 2, 2, 1,\n             \"val1\", \"val2\", 2, 2, 1,\n             \"sval1\", \"sval2\", 2, 2, 1,\n             \"0.1 0.2\", \"val1 val2\", \"sval1 sval2\",\n             1, 1],\n            [.3, .3, .3, np.nan, np.nan, .3, .3, .3, 0, .3, .3, 1, 2, 0.5,\n             \"val2\", \"val2\", 1, 2, 0.5,\n             \"\", \"sval2\", 2, 2, 1,\n             \"0.3\", \"val2\", \"sval2\",\n             1, 2],\n            [.433, .4, .3, 0.153, 0.023, 1.3, .3, .6, .3, .3, .6, 3, 3, 1,\n             \"val1\", \"val1\", 3, 3, 1,\n             \"sval1\", \"sval1\", 3, 3, 1,\n             \"0.3 0.4 0.6\", \"val1 val2 val1\", \"sval1 sval2 sval1\",\n             1, 3],\n            [1.5, 1.5, 1, 0.707, 0.5, 3, 1, 2, 1, 1, 2, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"1.0 2.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 1],\n            [-0.5, -0.5, -4, 4.95, 24.5, -1, -4, 3, 7, 3, -4, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"3.0 -4.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 2],\n            [5, 5, 5, 0, 0, 10, 5, 5, 0, 5, 5, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"5.0 5.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 3]\n            ], columns=expected_columns\n        )\n        # fmt: on\n\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        # remove random since it is not possible to test\n        output_df = output_df.loc[:, ~output_df.columns.str.endswith(\"Random value\")]\n\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n            atol=1e-3,\n        )\n\n    def test_metas_results(self):\n        \"\"\"Test if variable that is in meta in input table remains in metas\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIn(self.data.domain[\"svar\"], output.domain.metas)\n\n    def test_context(self):\n        d = self.data.domain\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 2])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # send new data and previous data to check if context restored correctly\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    @patch(\n        \"Orange.data.aggregate.OrangeTableGroupBy.aggregate\",\n        Mock(side_effect=ValueError(\"Test unexpected err\")),\n    )\n    def test_unexpected_error(self):\n        \"\"\"Test if exception in aggregation shown correctly\"\"\"\n\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.wait_until_finished()\n\n        self.assertTrue(self.widget.Error.unexpected_error.is_shown())\n        self.assertEqual(\n            str(self.widget.Error.unexpected_error),\n            \"Test unexpected err\",\n        )\n\n    def test_time_variable(self):\n        cur_dir = os.path.dirname(os.path.realpath(__file__))\n        test10_path = os.path.join(\n            cur_dir, \"..\", \"..\", \"..\", \"tests\", \"datasets\", \"test10.tab\"\n        )\n        data = Table.from_file(test10_path)\n\n        # time variable as a group by variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [1])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(3, len(output))\n\n        # time variable as a grouped variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [5])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(2, len(output))\n\n    def test_only_nan_in_group(self):\n        data = Table(\n            Domain([ContinuousVariable(\"A\"), ContinuousVariable(\"B\")]),\n            np.array([[1, np.nan], [2, 1], [1, np.nan], [2, 1]]),\n        )\n        self.send_signal(self.widget.Inputs.data, data)\n\n        # select feature A as group-by\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        # select all aggregations for feature B\n        self.select_table_rows(self.widget.agg_table_view, [1])\n        for cb in self.widget.agg_checkboxes.values():\n            while not cb.isChecked():\n                cb.click()\n\n        # unselect all aggregations for attr A\n        self.select_table_rows(self.widget.agg_table_view, [0])\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"B - Mean\",\n            \"B - Median\",\n            \"B - Mode\",\n            \"B - Standard deviation\",\n            \"B - Variance\",\n            \"B - Sum\",\n            \"B - Min. value\",\n            \"B - Max. value\",\n            \"B - Span\",\n            \"B - First value\",\n            \"B - Last value\",\n            \"B - Random value\",\n            \"B - Count defined\",\n            \"B - Count\",\n            \"B - Proportion defined\",\n            \"B - Concatenate\",\n            \"A\",\n        ]\n        n = np.nan\n        expected_df = pd.DataFrame(\n            [\n                [n, n, n, n, n, 0, n, n, n, n, n, n, 0, 2, 0, \"\", 1],\n                [1, 1, 1, 0, 0, 2, 1, 1, 0, 1, 1, 1, 2, 2, 1, \"1.0 1.0\", 2],\n            ],\n            columns=expected_columns,\n        )\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n        )",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 23,
                                "end_lineno": 759,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "9212a767e0a634f7779dd9539a258451a341f1de^",
    "new_commit_hash": "9212a767e0a634f7779dd9539a258451a341f1de",
    "commit_message": "Group by: Restore aggregations if removed due to open context",
    "commit_date": "2022-02-04T11:23:40+01:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "9212a767e0a634f7779dd9539a258451a341f1de",
    "test_file_codes": [
        "import os\nimport unittest\nfrom typing import List\nfrom unittest.mock import Mock, patch\n\nimport numpy as np\nimport pandas as pd\nfrom AnyQt import QtCore\nfrom AnyQt.QtCore import QItemSelectionModel, Qt\nfrom AnyQt.QtWidgets import QListView\n\nfrom Orange.data import (\n    Table,\n    table_to_frame,\n    Domain,\n    ContinuousVariable,\n)\nfrom Orange.data.tests.test_aggregate import create_sample_data\nfrom Orange.widgets.data.owgroupby import OWGroupBy\nfrom Orange.widgets.tests.base import WidgetTest\n\n\nclass TestOWGroupBy(WidgetTest):\n    def setUp(self) -> None:\n        self.widget = self.create_widget(OWGroupBy)\n        self.iris = Table(\"iris\")\n\n        self.data = create_sample_data()\n\n    def test_none_data(self):\n        self.send_signal(self.widget.Inputs.data, None)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 0)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 0)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    def test_data(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        self.assertEqual(self.widget.agg_table_model.rowCount(), 5)\n        self.assertEqual(self.widget.gb_attrs_model.rowCount(), 5)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n    def test_data_domain_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.iris[:, -2:])\n        self.assert_aggregations_equal([\"Mean\", \"Concatenate\"])\n\n        self.send_signal(self.widget.Inputs.data, self.iris[:, -3:])\n        self.assert_aggregations_equal([\"Mean\", \"Mean\", \"Concatenate\"])\n        self.select_table_rows(self.widget.agg_table_view, [0])\n\n    @staticmethod\n    def _set_selection(view: QListView, indices: List[int]):\n        view.clearSelection()\n        sm = view.selectionModel()\n        model = view.model()\n        for ind in indices:\n            sm.select(model.index(ind), QItemSelectionModel.Select)\n\n    def test_groupby_attr_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.iris)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 35)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 3)\n\n        # select iris attribute with index 0\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n        self.wait_until_finished()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 57)\n\n    def assert_enabled_cbs(self, enabled_true):\n        enabled_actual = set(\n            name for name, cb in self.widget.agg_checkboxes.items() if cb.isEnabled()\n        )\n        self.assertSetEqual(enabled_true, enabled_actual)\n\n    @staticmethod\n    def select_table_rows(table, rows):\n        table.clearSelection()\n        indexes = [table.model().index(r, 0) for r in rows]\n        mode = QtCore.QItemSelectionModel.Select | QtCore.QItemSelectionModel.Rows\n        for i in indexes:\n            table.selectionModel().select(i, mode)\n\n    def test_attr_table_row_selection(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        model = self.widget.agg_table_model\n        table = self.widget.agg_table_view\n\n        self.assertListEqual(\n            [\"a\", \"b\", \"cvar\", \"dvar\", \"svar\"],\n            [model.data(model.index(i, 0)) for i in range(model.rowCount())],\n        )\n\n        self.select_table_rows(table, [0])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [0, 1])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2])\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3])  # discrete variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n        self.select_table_rows(table, [2, 3, 4])  # string variable\n        self.assert_enabled_cbs(\n            {\n                \"Mean\",\n                \"Median\",\n                \"Mode\",\n                \"Standard deviation\",\n                \"Variance\",\n                \"Sum\",\n                \"Min. value\",\n                \"Max. value\",\n                \"Count defined\",\n                \"Count\",\n                \"Concatenate\",\n                \"Span\",\n                \"First value\",\n                \"Last value\",\n                \"Random value\",\n                \"Proportion defined\",\n            }\n        )\n\n    def assert_aggregations_equal(self, expected_text):\n        model = self.widget.agg_table_model\n        agg_text = [model.data(model.index(i, 1)) for i in range(model.rowCount())]\n        self.assertListEqual(expected_text, agg_text)\n\n    def test_aggregations_change(self):\n        table = self.widget.agg_table_view\n        d = self.data.domain\n\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1])\n        # median is partially checked and will become checked\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Median\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Median, Mode\",\n                \"Mean, Median, Mode\",\n                \"Mean\",\n                \"Concatenate\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 3])\n        # median is unchecked and will change to partially checked\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Median, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assertEqual(\n            Qt.Unchecked, self.widget.agg_checkboxes[\"Median\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\"Mean, Mode\", \"Mean, Mode\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Count\"].click()\n        self.assertEqual(Qt.Checked, self.widget.agg_checkboxes[\"Count\"].checkState())\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # test the most complicated scenario: numeric with mode, numeric without\n        # mode and discrete\n        self.select_table_rows(table, [0])\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean, Mode\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.select_table_rows(table, [0, 1, 3])\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        # must stay partially checked since one Continuous can still have mode\n        # as a aggregation and discrete cannot have it\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count\",\n                \"Mean, Mode\",\n                \"Mean\",\n                \"Concatenate, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\"},\n                d[\"b\"]: {\"Mean\", \"Mode\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # since now all that can have Mode have it as an aggregation it can be\n        # unchecked on the next click\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.assertEqual(Qt.Unchecked, self.widget.agg_checkboxes[\"Mode\"].checkState())\n        self.assert_aggregations_equal(\n            [\"Mean, Count\", \"Mean\", \"Mean\", \"Concatenate, Count\", \"Concatenate\"]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Count\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        self.widget.agg_checkboxes[\"Mode\"].click()\n        self.widget.agg_checkboxes[\"Count defined\"].click()\n        self.assertEqual(\n            Qt.PartiallyChecked, self.widget.agg_checkboxes[\"Mode\"].checkState()\n        )\n        self.assert_aggregations_equal(\n            [\n                \"Mean, Mode, Count defined and 1 more\",\n                \"Mean, Mode, Count defined\",\n                \"Mean\",\n                \"Concatenate, Count defined, Count\",\n                \"Concatenate\",\n            ]\n        )\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Mode\", \"Count\", \"Count defined\"},\n                d[\"b\"]: {\"Mean\", \"Mode\", \"Count defined\"},\n                d[\"cvar\"]: {\"Mean\"},\n                d[\"dvar\"]: {\"Count\", \"Count defined\", \"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    def test_aggregation(self):\n        \"\"\"Test aggregation results\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        np.testing.assert_array_almost_equal(\n            output.X, [[1, 2.143, 0.317], [2, 2, 2]], decimal=3\n        )\n        np.testing.assert_array_equal(\n            output.metas,\n            np.array(\n                [\n                    [\n                        \"val1 val2 val2 val1 val2 val1\",\n                        \"sval1 sval2 sval2 sval1 sval2 sval1\",\n                        1.0,\n                    ],\n                    [\n                        \"val2 val1 val2 val1 val2 val1\",\n                        \"sval2 sval1 sval2 sval1 sval2 sval1\",\n                        2.0,\n                    ],\n                ],\n                dtype=object,\n            ),\n        )\n\n        # select all aggregations for all features except a and b\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.select_table_rows(self.widget.agg_table_view, [2, 3, 4])\n        # select all aggregations\n        for cb in self.widget.agg_checkboxes.values():\n            cb.click()\n            while not cb.isChecked():\n                cb.click()\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 1])\n        # unselect all aggregations for attr a and b\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"cvar - Mean\",\n            \"cvar - Median\",\n            \"cvar - Mode\",\n            \"cvar - Standard deviation\",\n            \"cvar - Variance\",\n            \"cvar - Sum\",\n            \"cvar - Min. value\",\n            \"cvar - Max. value\",\n            \"cvar - Span\",\n            \"cvar - First value\",\n            \"cvar - Last value\",\n            \"cvar - Count defined\",\n            \"cvar - Count\",\n            \"cvar - Proportion defined\",\n            \"dvar - First value\",\n            \"dvar - Last value\",\n            \"dvar - Count defined\",\n            \"dvar - Count\",\n            \"dvar - Proportion defined\",\n            \"svar - First value\",\n            \"svar - Last value\",\n            \"svar - Count defined\",\n            \"svar - Count\",\n            \"svar - Proportion defined\",\n            \"cvar - Concatenate\",\n            \"dvar - Concatenate\",\n            \"svar - Concatenate\",\n            \"a\",  # groupby variables are last two in metas\n            \"b\",\n        ]\n\n        # fmt: off\n        expected_df = pd.DataFrame([\n            [.15, .15, .1, .07, .005, .3, .1, .2, .1, 0.1, 0.2, 2, 2, 1,\n             \"val1\", \"val2\", 2, 2, 1,\n             \"sval1\", \"sval2\", 2, 2, 1,\n             \"0.1 0.2\", \"val1 val2\", \"sval1 sval2\",\n             1, 1],\n            [.3, .3, .3, np.nan, np.nan, .3, .3, .3, 0, .3, .3, 1, 2, 0.5,\n             \"val2\", \"val2\", 1, 2, 0.5,\n             \"\", \"sval2\", 2, 2, 1,\n             \"0.3\", \"val2\", \"sval2\",\n             1, 2],\n            [.433, .4, .3, 0.153, 0.023, 1.3, .3, .6, .3, .3, .6, 3, 3, 1,\n             \"val1\", \"val1\", 3, 3, 1,\n             \"sval1\", \"sval1\", 3, 3, 1,\n             \"0.3 0.4 0.6\", \"val1 val2 val1\", \"sval1 sval2 sval1\",\n             1, 3],\n            [1.5, 1.5, 1, 0.707, 0.5, 3, 1, 2, 1, 1, 2, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"1.0 2.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 1],\n            [-0.5, -0.5, -4, 4.95, 24.5, -1, -4, 3, 7, 3, -4, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"3.0 -4.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 2],\n            [5, 5, 5, 0, 0, 10, 5, 5, 0, 5, 5, 2, 2, 1,\n             \"val2\", \"val1\", 2, 2, 1,\n             \"sval2\", \"sval1\", 2, 2, 1,\n             \"5.0 5.0\", \"val2 val1\", \"sval2 sval1\",\n             2, 3]\n            ], columns=expected_columns\n        )\n        # fmt: on\n\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        # remove random since it is not possible to test\n        output_df = output_df.loc[:, ~output_df.columns.str.endswith(\"Random value\")]\n\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n            atol=1e-3,\n        )\n\n    def test_metas_results(self):\n        \"\"\"Test if variable that is in meta in input table remains in metas\"\"\"\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self._set_selection(self.widget.gb_attrs_view, [0, 1])\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIn(self.data.domain[\"svar\"], output.domain.metas)\n\n    def test_context(self):\n        d = self.data.domain\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean\", \"Mean\", \"Mean\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self.select_table_rows(self.widget.agg_table_view, [0, 2])\n        self.widget.agg_checkboxes[\"Median\"].click()\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n        # send new data and previous data to check if context restored correctly\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.send_signal(self.widget.Inputs.data, self.data)\n\n        self.assert_aggregations_equal(\n            [\"Mean, Median\", \"Mean\", \"Mean, Median\", \"Concatenate\", \"Concatenate\"]\n        )\n        self._set_selection(self.widget.gb_attrs_view, [1, 2])\n        self.assertListEqual([d[\"a\"], d[\"b\"]], self.widget.gb_attrs)\n        self.assertDictEqual(\n            {\n                d[\"a\"]: {\"Mean\", \"Median\"},\n                d[\"b\"]: {\"Mean\"},\n                d[\"cvar\"]: {\"Mean\", \"Median\"},\n                d[\"dvar\"]: {\"Concatenate\"},\n                d[\"svar\"]: {\"Concatenate\"},\n            },\n            self.widget.aggregations,\n        )\n\n    @patch(\n        \"Orange.data.aggregate.OrangeTableGroupBy.aggregate\",\n        Mock(side_effect=ValueError(\"Test unexpected err\")),\n    )\n    def test_unexpected_error(self):\n        \"\"\"Test if exception in aggregation shown correctly\"\"\"\n\n        self.send_signal(self.widget.Inputs.data, self.iris)\n        self.wait_until_finished()\n\n        self.assertTrue(self.widget.Error.unexpected_error.is_shown())\n        self.assertEqual(\n            str(self.widget.Error.unexpected_error),\n            \"Test unexpected err\",\n        )\n\n    def test_time_variable(self):\n        cur_dir = os.path.dirname(os.path.realpath(__file__))\n        test10_path = os.path.join(\n            cur_dir, \"..\", \"..\", \"..\", \"tests\", \"datasets\", \"test10.tab\"\n        )\n        data = Table.from_file(test10_path)\n\n        # time variable as a group by variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [1])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(3, len(output))\n\n        # time variable as a grouped variable\n        self.send_signal(self.widget.Inputs.data, data)\n        self._set_selection(self.widget.gb_attrs_view, [5])\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(2, len(output))\n\n    def test_only_nan_in_group(self):\n        data = Table(\n            Domain([ContinuousVariable(\"A\"), ContinuousVariable(\"B\")]),\n            np.array([[1, np.nan], [2, 1], [1, np.nan], [2, 1]]),\n        )\n        self.send_signal(self.widget.Inputs.data, data)\n\n        # select feature A as group-by\n        self._set_selection(self.widget.gb_attrs_view, [0])\n        # select all aggregations for feature B\n        self.select_table_rows(self.widget.agg_table_view, [1])\n        for cb in self.widget.agg_checkboxes.values():\n            while not cb.isChecked():\n                cb.click()\n\n        # unselect all aggregations for attr A\n        self.select_table_rows(self.widget.agg_table_view, [0])\n        for cb in self.widget.agg_checkboxes.values():\n            while cb.isChecked():\n                cb.click()\n\n        expected_columns = [\n            \"B - Mean\",\n            \"B - Median\",\n            \"B - Mode\",\n            \"B - Standard deviation\",\n            \"B - Variance\",\n            \"B - Sum\",\n            \"B - Min. value\",\n            \"B - Max. value\",\n            \"B - Span\",\n            \"B - First value\",\n            \"B - Last value\",\n            \"B - Random value\",\n            \"B - Count defined\",\n            \"B - Count\",\n            \"B - Proportion defined\",\n            \"B - Concatenate\",\n            \"A\",\n        ]\n        n = np.nan\n        expected_df = pd.DataFrame(\n            [\n                [n, n, n, n, n, 0, n, n, n, n, n, n, 0, 2, 0, \"\", 1],\n                [1, 1, 1, 0, 0, 2, 1, 1, 0, 1, 1, 1, 2, 2, 1, \"1.0 1.0\", 2],\n            ],\n            columns=expected_columns,\n        )\n        output_df = table_to_frame(\n            self.get_output(self.widget.Outputs.data), include_metas=True\n        )\n        pd.testing.assert_frame_equal(\n            output_df,\n            expected_df,\n            check_dtype=False,\n            check_column_type=False,\n            check_categorical=False,\n        )\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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.32.0.dev0+9212a76 to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de\nProcessing dependencies for Orange3==3.32.0.dev0+9212a76\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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for xlrd==2.0.1\nBest match: xlrd 2.0.1\nAdding xlrd 2.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for setuptools==59.8.0\nBest match: setuptools 59.8.0\nAdding setuptools 59.8.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for serverfiles==0.3.1\nBest match: serverfiles 0.3.1\nAdding serverfiles 0.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for scipy==1.7.3\nBest match: scipy 1.7.3\nAdding scipy 1.7.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for scikit-learn==1.0.2\nBest match: scikit-learn 1.0.2\nAdding scikit-learn 1.0.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for requests==2.31.0\nBest match: requests 2.31.0\nAdding requests 2.31.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for qtconsole==5.4.4\nBest match: qtconsole 5.4.4\nAdding qtconsole 5.4.4 to easy-install.pth file\nInstalling jupyter-qtconsole script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for PyYAML==6.0.1\nBest match: PyYAML 6.0.1\nAdding PyYAML 6.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for python-louvain==0.16\nBest match: python-louvain 0.16\nAdding python-louvain 0.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for pyqtgraph==0.12.4\nBest match: pyqtgraph 0.12.4\nAdding pyqtgraph 0.12.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for pygments==2.17.2\nBest match: pygments 2.17.2\nAdding pygments 2.17.2 to easy-install.pth file\nInstalling pygmentize script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for pip==24.0\nBest match: pip 24.0\nAdding pip 24.0 to easy-install.pth file\nInstalling pip script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for pandas==1.3.5\nBest match: pandas 1.3.5\nAdding pandas 1.3.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for orange-widget-base==4.22.0\nBest match: orange-widget-base 4.22.0\nAdding orange-widget-base 4.22.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for orange-canvas-core==0.1.35\nBest match: orange-canvas-core 0.1.35\nAdding orange-canvas-core 0.1.35 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for openpyxl==3.1.3\nBest match: openpyxl 3.1.3\nAdding openpyxl 3.1.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for openTSNE==1.0.1\nBest match: openTSNE 1.0.1\nAdding openTSNE 1.0.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for numpy==1.17.5\nBest match: numpy 1.17.5\nAdding numpy 1.17.5 to easy-install.pth file\nInstalling f2py script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for networkx==2.6.3\nBest match: networkx 2.6.3\nAdding networkx 2.6.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for matplotlib==3.5.3\nBest match: matplotlib 3.5.3\nAdding matplotlib 3.5.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for keyrings.alt==4.2.0\nBest match: keyrings.alt 4.2.0\nAdding keyrings.alt 4.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for keyring==24.1.1\nBest match: keyring 24.1.1\nAdding keyring 24.1.1 to easy-install.pth file\nInstalling keyring script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for joblib==1.3.2\nBest match: joblib 1.3.2\nAdding joblib 1.3.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for httpx==0.19.0\nBest match: httpx 0.19.0\nAdding httpx 0.19.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for chardet==5.2.0\nBest match: chardet 5.2.0\nAdding chardet 5.2.0 to easy-install.pth file\nInstalling chardetect script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for Bottleneck==1.4.0\nBest match: Bottleneck 1.4.0\nAdding Bottleneck 1.4.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for baycomp==1.0.3\nBest match: baycomp 1.0.3\nAdding baycomp 1.0.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for PyQtWebEngine==5.15.6\nBest match: PyQtWebEngine 5.15.6\nAdding PyQtWebEngine 5.15.6 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for PyQt5==5.15.10\nBest match: PyQt5 5.15.10\nAdding PyQt5 5.15.10 to easy-install.pth file\nInstalling pylupdate5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling pyrcc5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling pyuic5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for AnyQt==0.2.0\nBest match: AnyQt 0.2.0\nAdding AnyQt 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for threadpoolctl==3.1.0\nBest match: threadpoolctl 3.1.0\nAdding threadpoolctl 3.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for idna==3.10\nBest match: idna 3.10\nAdding idna 3.10 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for urllib3==2.0.7\nBest match: urllib3 2.0.7\nAdding urllib3 2.0.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for certifi==2024.12.14\nBest match: certifi 2024.12.14\nAdding certifi 2024.12.14 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for charset-normalizer==3.4.1\nBest match: charset-normalizer 3.4.1\nAdding charset-normalizer 3.4.1 to easy-install.pth file\nInstalling normalizer script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for ipython-genutils==0.2.0\nBest match: ipython-genutils 0.2.0\nAdding ipython-genutils 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for QtPy==2.4.2\nBest match: QtPy 2.4.2\nAdding QtPy 2.4.2 to easy-install.pth file\nInstalling qtpy script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for pyzmq==26.2.0\nBest match: pyzmq 26.2.0\nAdding pyzmq 26.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for jupyter-client==7.4.9\nBest match: jupyter-client 7.4.9\nAdding jupyter-client 7.4.9 to easy-install.pth file\nInstalling jupyter-kernel script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling jupyter-kernelspec script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling jupyter-run script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for jupyter-core==4.12.0\nBest match: jupyter-core 4.12.0\nAdding jupyter-core 4.12.0 to easy-install.pth file\nInstalling jupyter script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling jupyter-migrate script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling jupyter-troubleshoot script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for traitlets==5.9.0\nBest match: traitlets 5.9.0\nAdding traitlets 5.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for ipykernel==6.16.2\nBest match: ipykernel 6.16.2\nAdding ipykernel 6.16.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for packaging==24.0\nBest match: packaging 24.0\nAdding packaging 24.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for pytz==2024.2\nBest match: pytz 2024.2\nAdding pytz 2024.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for python-dateutil==2.9.0.post0\nBest match: python-dateutil 2.9.0.post0\nAdding python-dateutil 2.9.0.post0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for typing-extensions==4.7.1\nBest match: typing-extensions 4.7.1\nAdding typing-extensions 4.7.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for requests-cache==1.1.1\nBest match: requests-cache 1.1.1\nAdding requests-cache 1.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for docutils==0.20.1\nBest match: docutils 0.20.1\nAdding docutils 0.20.1 to easy-install.pth file\nInstalling docutils script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for dictdiffer==0.9.0\nBest match: dictdiffer 0.9.0\nAdding dictdiffer 0.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for qasync==0.25.0\nBest match: qasync 0.25.0\nAdding qasync 0.25.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for commonmark==0.9.1\nBest match: commonmark 0.9.1\nAdding commonmark 0.9.1 to easy-install.pth file\nInstalling cmark script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for importlib-metadata==6.7.0\nBest match: importlib-metadata 6.7.0\nAdding importlib-metadata 6.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for et-xmlfile==1.1.0\nBest match: et-xmlfile 1.1.0\nAdding et-xmlfile 1.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for cycler==0.11.0\nBest match: cycler 0.11.0\nAdding cycler 0.11.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for fonttools==4.38.0\nBest match: fonttools 4.38.0\nAdding fonttools 4.38.0 to easy-install.pth file\nInstalling fonttools script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for kiwisolver==1.4.5\nBest match: kiwisolver 1.4.5\nAdding kiwisolver 1.4.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for Pillow==9.5.0\nBest match: Pillow 9.5.0\nAdding Pillow 9.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for pyparsing==3.1.4\nBest match: pyparsing 3.1.4\nAdding pyparsing 3.1.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for jaraco.classes==3.2.3\nBest match: jaraco.classes 3.2.3\nAdding jaraco.classes 3.2.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for jeepney==0.8.0\nBest match: jeepney 0.8.0\nAdding jeepney 0.8.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for SecretStorage==3.3.3\nBest match: SecretStorage 3.3.3\nAdding SecretStorage 3.3.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for importlib-resources==5.12.0\nBest match: importlib-resources 5.12.0\nAdding importlib-resources 5.12.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for rfc3986==1.5.0\nBest match: rfc3986 1.5.0\nAdding rfc3986 1.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for httpcore==0.13.7\nBest match: httpcore 0.13.7\nAdding httpcore 0.13.7 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for sniffio==1.3.1\nBest match: sniffio 1.3.1\nAdding sniffio 1.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for PyQt5-sip==12.13.0\nBest match: PyQt5-sip 12.13.0\nAdding PyQt5-sip 12.13.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for PyQtWebEngine-Qt5==5.15.16\nBest match: PyQtWebEngine-Qt5 5.15.16\nAdding PyQtWebEngine-Qt5 5.15.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for PyQt5-Qt5==5.15.16\nBest match: PyQt5-Qt5 5.15.16\nAdding PyQt5-Qt5 5.15.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for tornado==6.2\nBest match: tornado 6.2\nAdding tornado 6.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for entrypoints==0.4\nBest match: entrypoints 0.4\nAdding entrypoints 0.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for nest-asyncio==1.6.0\nBest match: nest-asyncio 1.6.0\nAdding nest-asyncio 1.6.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for ipython==7.34.0\nBest match: ipython 7.34.0\nAdding ipython 7.34.0 to easy-install.pth file\nInstalling iptest script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling iptest3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling ipython script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\nInstalling ipython3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for matplotlib-inline==0.1.6\nBest match: matplotlib-inline 0.1.6\nAdding matplotlib-inline 0.1.6 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for debugpy==1.7.0\nBest match: debugpy 1.7.0\nAdding debugpy 1.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for psutil==6.1.1\nBest match: psutil 6.1.1\nAdding psutil 6.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for six==1.17.0\nBest match: six 1.17.0\nAdding six 1.17.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for attrs==24.2.0\nBest match: attrs 24.2.0\nAdding attrs 24.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for cattrs==23.1.2\nBest match: cattrs 23.1.2\nAdding cattrs 23.1.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for url-normalize==1.4.3\nBest match: url-normalize 1.4.3\nAdding url-normalize 1.4.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for platformdirs==4.0.0\nBest match: platformdirs 4.0.0\nAdding platformdirs 4.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for zipp==3.15.0\nBest match: zipp 3.15.0\nAdding zipp 3.15.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for more-itertools==9.1.0\nBest match: more-itertools 9.1.0\nAdding more-itertools 9.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for cryptography==44.0.0\nBest match: cryptography 44.0.0\nAdding cryptography 44.0.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for h11==0.12.0\nBest match: h11 0.12.0\nAdding h11 0.12.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for anyio==3.7.1\nBest match: anyio 3.7.1\nAdding anyio 3.7.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for pickleshare==0.7.5\nBest match: pickleshare 0.7.5\nAdding pickleshare 0.7.5 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for prompt-toolkit==3.0.48\nBest match: prompt-toolkit 3.0.48\nAdding prompt-toolkit 3.0.48 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for pexpect==4.9.0\nBest match: pexpect 4.9.0\nAdding pexpect 4.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for backcall==0.2.0\nBest match: backcall 0.2.0\nAdding backcall 0.2.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for decorator==5.1.1\nBest match: decorator 5.1.1\nAdding decorator 5.1.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for jedi==0.19.2\nBest match: jedi 0.19.2\nAdding jedi 0.19.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for exceptiongroup==1.2.2\nBest match: exceptiongroup 1.2.2\nAdding exceptiongroup 1.2.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for cffi==1.15.1\nBest match: cffi 1.15.1\nAdding cffi 1.15.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for wcwidth==0.2.13\nBest match: wcwidth 0.2.13\nAdding wcwidth 0.2.13 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for ptyprocess==0.7.0\nBest match: ptyprocess 0.7.0\nAdding ptyprocess 0.7.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for parso==0.8.4\nBest match: parso 0.8.4\nAdding parso 0.8.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nSearching for pycparser==2.21\nBest match: pycparser 2.21\nAdding pycparser 2.21 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.32.0.dev0+9212a76\nVerifying Orange installation...\n✅ Orange installation successful!\nSuccessfully installed orange using Python 3.7\n",
    "setup_res_stderr": "Using CPython 3.7.9\nCreating virtual environment at: .venv\nActivate with: source .venv/bin/activate\nResolved 18 packages in 60ms\nPrepared 18 packages in 2ms\nInstalled 18 packages in 155ms\n + cython==0.29.37\n + exceptiongroup==1.2.2\n + importlib-metadata==6.7.0\n + iniconfig==2.0.0\n + numpy==1.17.5\n + packaging==24.0\n + pluggy==1.2.0\n + pyqt5==5.15.10\n + pyqt5-qt5==5.15.16\n + pyqt5-sip==12.13.0\n + pyqtwebengine==5.15.6\n + pyqtwebengine-qt5==5.15.16\n + pytest==7.4.4\n + setuptools==59.8.0\n + tomli==2.0.1\n + typing-extensions==4.7.1\n + wheel==0.42.0\n + zipp==3.15.0\nResolved 55 packages in 302ms\nInstalled 48 packages in 796ms\n + anyio==3.7.1\n + baycomp==1.0.3\n + bottleneck==1.4.0\n + certifi==2024.12.14\n + cffi==1.15.1\n + chardet==5.2.0\n + charset-normalizer==3.4.1\n + cryptography==44.0.0\n + cycler==0.11.0\n + et-xmlfile==1.1.0\n + fonttools==4.38.0\n + h11==0.12.0\n + httpcore==0.13.7\n + httpx==0.19.0\n + idna==3.10\n + importlib-resources==5.12.0\n + jaraco-classes==3.2.3\n + jeepney==0.8.0\n + joblib==1.3.2\n + keyring==24.1.1\n + keyrings-alt==4.2.0\n + kiwisolver==1.4.5\n + matplotlib==3.5.3\n + more-itertools==9.1.0\n + networkx==2.6.3\n + openpyxl==3.1.3\n + opentsne==1.0.1\n + pandas==1.3.5\n + pillow==9.5.0\n + pip==24.0\n + pycparser==2.21\n + pyparsing==3.1.4\n + python-dateutil==2.9.0.post0\n + python-louvain==0.16\n + pytz==2024.2\n + pyyaml==6.0.1\n + requests==2.31.0\n + rfc3986==1.5.0\n + scikit-learn==1.0.2\n + scipy==1.7.3\n + secretstorage==3.3.3\n + serverfiles==0.3.1\n + six==1.17.0\n + sniffio==1.3.1\n + threadpoolctl==3.1.0\n + urllib3==2.0.7\n + xlrd==2.0.1\n + xlsxwriter==3.2.0\nResolved 59 packages in 265ms\nInstalled 38 packages in 295ms\n + anyqt==0.2.0\n + attrs==24.2.0\n + backcall==0.2.0\n + cattrs==23.1.2\n + commonmark==0.9.1\n + debugpy==1.7.0\n + decorator==5.1.1\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + entrypoints==0.4\n + ipykernel==6.16.2\n + ipython==7.34.0\n + ipython-genutils==0.2.0\n + jedi==0.19.2\n + jupyter-client==7.4.9\n + jupyter-core==4.12.0\n + matplotlib-inline==0.1.6\n + nest-asyncio==1.6.0\n + orange-canvas-core==0.1.35\n + orange-widget-base==4.22.0\n + parso==0.8.4\n + pexpect==4.9.0\n + pickleshare==0.7.5\n + platformdirs==4.0.0\n + prompt-toolkit==3.0.48\n + psutil==6.1.1\n + ptyprocess==0.7.0\n + pygments==2.17.2\n + pyqtgraph==0.12.4\n + pyzmq==26.2.0\n + qasync==0.25.0\n + qtconsole==5.4.4\n + qtpy==2.4.2\n + requests-cache==1.1.1\n + tornado==6.2\n + traitlets==5.9.0\n + url-normalize==1.4.3\n + wcwidth==0.2.13\nResolved 2 packages in 4ms\nInstalled 2 packages in 9ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nResolved 19 packages in 41ms\nInstalled 5 packages in 1.15s\n + catboost==1.2.7\n + graphviz==0.20.1\n + plotly==5.18.0\n + tenacity==8.2.3\n + xgboost==1.6.2\nAudited 2 packages in 2ms\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.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_9212a767e0a634f7779dd9539a258451a341f1de/.venv/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.\n  setuptools.SetuptoolsDeprecationWarning,\nwarning: no files found matching 'README*' under directory 'Orange'\nwarning: no files found matching 'LICENSE' under directory 'Orange'\nwarning: no files found matching '*.basket' under directory 'Orange/datasets'\nwarning: no files found matching '*.js' under directory 'Orange/widgets'\nwarning: no files found matching '*.css' under directory 'Orange/widgets'\nwarning: no files found matching '*.html' under directory 'Orange/widgets'\nwarning: no files found matching 'COPYING'\n",
    "new_commit_res_code": 1,
    "new_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de\nplugins: anyio-3.7.1\ncollected 18 items\n\nr2e_tests/test_1.py sss.........F...F.                                   [100%]\n\n=================================== FAILURES ===================================\n_______________________ TestOWGroupBy.test_minimum_size ________________________\n\nself = <r2e_tests.test_1.TestOWGroupBy testMethod=test_minimum_size>\n\n    def test_minimum_size(self):\n        widget = getattr(self, \"widget\", None)\n        if widget is None:\n            self.skipTest(\"minimum size not tested as .widget was not set\")\n>       self.check_minimum_size(widget)\n\n.venv/lib/python3.7/site-packages/orangewidget/tests/base.py:242: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n.venv/lib/python3.7/site-packages/orangewidget/tests/base.py:615: in check_minimum_size\n    self.assertLess(min_size.width(), 800)\nE   AssertionError: 1298 not less than 800\n_______________________ TestOWGroupBy.test_time_variable _______________________\n\nself = <r2e_tests.test_1.TestOWGroupBy testMethod=test_time_variable>\n\n    def test_time_variable(self):\n        cur_dir = os.path.dirname(os.path.realpath(__file__))\n        test10_path = os.path.join(\n            cur_dir, \"..\", \"..\", \"..\", \"tests\", \"datasets\", \"test10.tab\"\n        )\n>       data = Table.from_file(test10_path)\n\nr2e_tests/test_1.py:688: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \nOrange/data/table.py:1075: in from_file\n    absolute_filename = FileFormat.locate(filename, dataset_dirs)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\ncls = <class 'Orange.data.io.FileFormat'>\nfilename = '/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/r2e_tests/../../../tests/datasets/test10.tab'\nsearch_dirs = ['', '/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/Orange/datasets']\n\n    @classmethod\n    def locate(cls, filename, search_dirs=('.',)):\n        \"\"\"Locate a file with given filename that can be opened by one\n        of the available readers.\n    \n        Parameters\n        ----------\n        filename : str\n        search_dirs : Iterable[str]\n    \n        Returns\n        -------\n        str\n            Absolute path to the file\n        \"\"\"\n        if path.exists(filename):\n            return filename\n    \n        for directory in search_dirs:\n            absolute_filename = path.join(directory, filename)\n            if path.exists(absolute_filename):\n                break\n            for ext in cls.readers:\n                if fnmatch(path.basename(filename), '*' + ext):\n                    break\n                # glob uses fnmatch internally\n                matching_files = glob(absolute_filename + ext)\n                if matching_files:\n                    absolute_filename = matching_files[0]\n                    break\n            if path.exists(absolute_filename):\n                break\n        else:\n            absolute_filename = \"\"\n    \n        if not path.exists(absolute_filename):\n>           raise IOError('File \"{}\" was not found.'.format(filename))\nE           OSError: File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/r2e_tests/../../../tests/datasets/test10.tab\" was not found.\n\nOrange/data/io_base.py:796: OSError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_aggregation\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_aggregations_change\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_attr_table_row_selection\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_context\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_data\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_data_domain_changed\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_groupby_attr_selection\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_image_export\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_metas_results\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_none_data\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_only_nan_in_group\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_unexpected_error\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:244: image exporting not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:238: minimum size not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:250: msg base class not tested as .widget was not set\nFAILED r2e_tests/test_1.py::TestOWGroupBy::test_minimum_size - AssertionError...\nFAILED r2e_tests/test_1.py::TestOWGroupBy::test_time_variable - OSError: File...\n=================== 2 failed, 13 passed, 3 skipped in 6.05s ====================\nWidgets left: 0    Max widgets: 1380 \n\n",
    "new_commit_res_stderr": "",
    "old_commit_res_code": 1,
    "old_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de\nplugins: anyio-3.7.1\ncollected 18 items\n\nr2e_tests/test_1.py sss.....F...F...F.                                   [100%]\n\n=================================== FAILURES ===================================\n____________________ TestOWGroupBy.test_data_domain_changed ____________________\n\nself = <r2e_tests.test_1.TestOWGroupBy testMethod=test_data_domain_changed>\n\n    def test_data_domain_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.iris[:, -2:])\n        self.assert_aggregations_equal([\"Mean\", \"Concatenate\"])\n    \n        self.send_signal(self.widget.Inputs.data, self.iris[:, -3:])\n>       self.assert_aggregations_equal([\"Mean\", \"Mean\", \"Concatenate\"])\n\nr2e_tests/test_1.py:54: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \nr2e_tests/test_1.py:234: in assert_aggregations_equal\n    self.assertListEqual(expected_text, agg_text)\nE   AssertionError: Lists differ: ['Mean', 'Mean', 'Concatenate'] != ['', 'Mean', 'Concatenate']\nE   \nE   First differing element 0:\nE   'Mean'\nE   ''\nE   \nE   - ['Mean', 'Mean', 'Concatenate']\nE   ?         --------\nE   \nE   + ['', 'Mean', 'Concatenate']\nE   ?  ++++\n_______________________ TestOWGroupBy.test_minimum_size ________________________\n\nself = <r2e_tests.test_1.TestOWGroupBy testMethod=test_minimum_size>\n\n    def test_minimum_size(self):\n        widget = getattr(self, \"widget\", None)\n        if widget is None:\n            self.skipTest(\"minimum size not tested as .widget was not set\")\n>       self.check_minimum_size(widget)\n\n.venv/lib/python3.7/site-packages/orangewidget/tests/base.py:242: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n.venv/lib/python3.7/site-packages/orangewidget/tests/base.py:615: in check_minimum_size\n    self.assertLess(min_size.width(), 800)\nE   AssertionError: 1298 not less than 800\n_______________________ TestOWGroupBy.test_time_variable _______________________\n\nself = <r2e_tests.test_1.TestOWGroupBy testMethod=test_time_variable>\n\n    def test_time_variable(self):\n        cur_dir = os.path.dirname(os.path.realpath(__file__))\n        test10_path = os.path.join(\n            cur_dir, \"..\", \"..\", \"..\", \"tests\", \"datasets\", \"test10.tab\"\n        )\n>       data = Table.from_file(test10_path)\n\nr2e_tests/test_1.py:688: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \nOrange/data/table.py:1075: in from_file\n    absolute_filename = FileFormat.locate(filename, dataset_dirs)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\ncls = <class 'Orange.data.io.FileFormat'>\nfilename = '/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/r2e_tests/../../../tests/datasets/test10.tab'\nsearch_dirs = ['', '/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/Orange/datasets']\n\n    @classmethod\n    def locate(cls, filename, search_dirs=('.',)):\n        \"\"\"Locate a file with given filename that can be opened by one\n        of the available readers.\n    \n        Parameters\n        ----------\n        filename : str\n        search_dirs : Iterable[str]\n    \n        Returns\n        -------\n        str\n            Absolute path to the file\n        \"\"\"\n        if path.exists(filename):\n            return filename\n    \n        for directory in search_dirs:\n            absolute_filename = path.join(directory, filename)\n            if path.exists(absolute_filename):\n                break\n            for ext in cls.readers:\n                if fnmatch(path.basename(filename), '*' + ext):\n                    break\n                # glob uses fnmatch internally\n                matching_files = glob(absolute_filename + ext)\n                if matching_files:\n                    absolute_filename = matching_files[0]\n                    break\n            if path.exists(absolute_filename):\n                break\n        else:\n            absolute_filename = \"\"\n    \n        if not path.exists(absolute_filename):\n>           raise IOError('File \"{}\" was not found.'.format(filename))\nE           OSError: File \"/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_9212a767e0a634f7779dd9539a258451a341f1de/r2e_tests/../../../tests/datasets/test10.tab\" was not found.\n\nOrange/data/io_base.py:796: OSError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_aggregation\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_aggregations_change\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_attr_table_row_selection\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_context\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_data\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_groupby_attr_selection\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_image_export\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_metas_results\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_none_data\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_only_nan_in_group\nPASSED r2e_tests/test_1.py::TestOWGroupBy::test_unexpected_error\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:244: image exporting not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:238: minimum size not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:250: msg base class not tested as .widget was not set\nFAILED r2e_tests/test_1.py::TestOWGroupBy::test_data_domain_changed - Asserti...\nFAILED r2e_tests/test_1.py::TestOWGroupBy::test_minimum_size - AssertionError...\nFAILED r2e_tests/test_1.py::TestOWGroupBy::test_time_variable - OSError: File...\n=================== 3 failed, 12 passed, 3 skipped in 3.83s ====================\nWidgets left: 0    Max widgets: 1380 \n\n",
    "old_commit_res_stderr": ""
}
Orange/widgets/data/owgroupby.py Orange/widgets/data/tests/test_owgroupby.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** GroupBy Widget Fails to Restore Aggregations When Data Domain Changes

**Description:**
When changing the data domain in the GroupBy widget, previously set aggregations are not correctly restored. This leads to missing aggregation functions, causing unexpected behavior in data processing.

**Example Code:**
```python
# Setup GroupBy widget with initial data
widget = OWGroupBy()
widget.send_signal(widget.Inputs.data, initial_data)

# Change the data domain by sending new data
widget.send_signal(widget.Inputs.data, new_data)

# Check the aggregations
aggregations = widget.aggregations
print(aggregations)  # Expected: {'Mean', 'Mean', 'Concatenate'}
```

**Expected Behavior:**
After changing the data domain, the GroupBy widget should retain and correctly restore all previously set aggregation functions, such as "Mean" and "Concatenate".

**Actual Behavior:**
The first aggregation is missing after the data domain change, resulting in aggregations like `{'', 'Mean', 'Concatenate'}`. This causes the widget to behave incorrectly by not applying all intended aggregation functions.

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

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

--- BEGIN FILE ---
```
### Orange/widgets/data/owgroupby.py
from collections import namedtuple
from contextlib import contextmanager
from dataclasses import dataclass
from functools import partial
from typing import Any, Dict, List, Optional, Set

import pandas as pd
from numpy import nan
from AnyQt.QtCore import (
    QAbstractTableModel,
    QEvent,
    QItemSelectionModel,
    QModelIndex,
    Qt,
)
from AnyQt.QtWidgets import (
    QAbstractItemView,
    QCheckBox,
    QGridLayout,
    QHeaderView,
    QListView,
    QTableView,
)
from orangewidget.settings import ContextSetting, Setting
from orangewidget.utils.listview import ListViewSearch
from orangewidget.utils.signals import Input, Output
from orangewidget.widget import Msg

from Orange.data import (
    ContinuousVariable,
    DiscreteVariable,
    Domain,
    StringVariable,
    Table,
    TimeVariable,
    Variable,
)
from Orange.data.aggregate import OrangeTableGroupBy
from Orange.util import wrap_callback
from Orange.widgets import gui
from Orange.widgets.data.oweditdomain import disconnected
from Orange.widgets.settings import DomainContextHandler
from Orange.widgets.utils.concurrent import ConcurrentWidgetMixin, TaskState
from Orange.widgets.utils.itemmodels import DomainModel
from Orange.widgets.widget import OWWidget

Aggregation = namedtuple("Aggregation", ["function", "types"])


def concatenate(x):
    """
    Concatenate values of series if value is not missing (nan or empty string
    for StringVariable)
    """
    return " ".join(str(v) for v in x if not pd.isnull(v) and len(str(v)) > 0)


AGGREGATIONS = {
    "Mean": Aggregation("mean", {ContinuousVariable, TimeVariable}),
    "Median": Aggregation("median", {ContinuousVariable, TimeVariable}),
    "Mode": Aggregation(
        lambda x: pd.Series.mode(x).get(0, nan), {ContinuousVariable, TimeVariable}
    ),
    "Standard deviation": Aggregation("std", {ContinuousVariable, TimeVariable}),
    "Variance": Aggregation("var", {ContinuousVariable, TimeVariable}),
    "Sum": Aggregation("sum", {ContinuousVariable, TimeVariable}),
    "Concatenate": Aggregation(
        concatenate,
        {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable},
    ),
    "Min. value": Aggregation("min", {ContinuousVariable, TimeVariable}),
    "Max. value": Aggregation("max", {ContinuousVariable, TimeVariable}),
    "Span": Aggregation(
        lambda x: pd.Series.max(x) - pd.Series.min(x),
        {ContinuousVariable, TimeVariable},
    ),
    "First value": Aggregation(
        "first", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}
    ),
    "Last value": Aggregation(
        "last", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}
    ),
    "Random value": Aggregation(
        lambda x: x.sample(1, random_state=0),
        {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable},
    ),
    "Count defined": Aggregation(
        "count", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}
    ),
    "Count": Aggregation(
        "size", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}
    ),
    "Proportion defined": Aggregation(
        lambda x: x.count() / x.size,
        {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable},
    ),
}
# list of ordered aggregation names is required on several locations so we
# prepare it in advance
AGGREGATIONS_ORD = list(AGGREGATIONS)

# use first aggregation suitable for each type as default
DEFAULT_AGGREGATIONS = {
    var: {next(name for name, agg in AGGREGATIONS.items() if var in agg.types)}
    for var in (ContinuousVariable, TimeVariable, DiscreteVariable, StringVariable)
}


@dataclass
class Result:
    group_by: OrangeTableGroupBy = None
    result_table: Optional[Table] = None


def _run(
    data: Table,
    group_by_attrs: List[Variable],
    aggregations: Dict[Variable, Set[str]],
    result: Result,
    state: TaskState,
) -> Result:
    def progress(part):
        state.set_progress_value(part * 100)
        if state.is_interruption_requested():
            raise Exception

    state.set_status("Aggregating")
    # group table rows
    if result.group_by is None:
        result.group_by = data.groupby(group_by_attrs)
    state.set_partial_result(result)

    aggregations = {
        var: [
            (agg, AGGREGATIONS[agg].function)
            for agg in sorted(aggs, key=AGGREGATIONS_ORD.index)
        ]
        for var, aggs in aggregations.items()
    }
    result.result_table = result.group_by.aggregate(
        aggregations, wrap_callback(progress, 0.2, 1)
    )
    return result


class TabColumn:
    attribute = 0
    aggregations = 1


TABLE_COLUMN_NAMES = ["Attributes", "Aggregations"]


class VarTableModel(QAbstractTableModel):
    def __init__(self, parent: "OWGroupBy", *args):
        super().__init__(*args)
        self.domain = None
        self.parent = parent

    def set_domain(self, domain: Domain) -> None:
        """
        Reset the table view to new domain
        """
        self.domain = domain
        self.modelReset.emit()

    def update_aggregation(self, attribute: str) -> None:
        """
        Reset the aggregation values in the table for the attribute
        """
        index = self.domain.index(attribute)
        if index < 0:
            # indices of metas are negative: first meta -1, second meta -2, ...
            index = len(self.domain.variables) - 1 - index
        index = self.index(index, 1)
        self.dataChanged.emit(index, index)

    def rowCount(self, parent=None) -> int:
        return (
            0
            if self.domain is None or (parent is not None and parent.isValid())
            else len(self.domain.variables) + len(self.domain.metas)
        )

    @staticmethod
    def columnCount(parent=None) -> int:
        return 0 if parent is not None and parent.isValid() else len(TABLE_COLUMN_NAMES)

    def data(self, index, role=Qt.DisplayRole) -> Any:
        row, col = index.row(), index.column()
        val = (self.domain.variables + self.domain.metas)[row]
        if role in (Qt.DisplayRole, Qt.EditRole):
            if col == TabColumn.attribute:
                return str(val)
            else:  # col == TabColumn.aggregations
                # plot first two aggregations comma separated and write n more
                # for others
                aggs = sorted(
                    self.parent.aggregations.get(val, []), key=AGGREGATIONS_ORD.index
                )
                n_more = "" if len(aggs) <= 3 else f" and {len(aggs) - 3} more"
                return ", ".join(aggs[:3]) + n_more
        elif role == Qt.DecorationRole and col == TabColumn.attribute:
            return gui.attributeIconDict[val]
        return None

    def headerData(self, i, orientation, role=Qt.DisplayRole) -> str:
        if orientation == Qt.Horizontal and role == Qt.DisplayRole and i < 2:
            return TABLE_COLUMN_NAMES[i]
        return super().headerData(i, orientation, role)


class AggregateListViewSearch(ListViewSearch):
    """ListViewSearch that disables unselecting all items in the list"""

    def selectionCommand(
        self, index: QModelIndex, event: QEvent = None
    ) -> QItemSelectionModel.SelectionFlags:
        flags = super().selectionCommand(index, event)
        selmodel = self.selectionModel()
        if not index.isValid():  # Click on empty viewport; don't clear
            return QItemSelectionModel.NoUpdate
        if selmodel.isSelected(index):
            currsel = selmodel.selectedIndexes()
            if len(currsel) == 1 and index == currsel[0]:
                # Is the last selected index; do not deselect it
                return QItemSelectionModel.NoUpdate
        if (
            event is not None
            and event.type() == QEvent.MouseMove
            and flags & QItemSelectionModel.ToggleCurrent
        ):
            # Disable ctrl drag 'toggle'; can be made to deselect the last
            # index, would need to keep track of the current selection
            # (selectionModel does this but does not expose it)
            flags &= ~QItemSelectionModel.Toggle
            flags |= QItemSelectionModel.Select
        return flags


class CheckBox(QCheckBox):
    def __init__(self, text, parent):
        super().__init__(text)
        self.parent: OWGroupBy = parent

    def nextCheckState(self) -> None:
        """
        Custom behaviour for switching between steps. It is required since
        sometimes user will select different types of attributes at the same
        time. In this case we step between unchecked, partially checked and
        checked or just between unchecked and checked - depending on situation
        """
        if self.checkState() == Qt.Checked:
            # if checked always uncheck
            self.setCheckState(Qt.Unchecked)
        else:
            agg = self.text()
            selected_attrs = self.parent.get_selected_attributes()
            types = set(type(attr) for attr in selected_attrs)
            can_be_applied_all = types <= AGGREGATIONS[agg].types

            # true if aggregation applied to all attributes that can be
            # aggregated with selected aggregation
            applied_all = all(
                type(attr) not in AGGREGATIONS[agg].types
                or agg in self.parent.aggregations[attr]
                for attr in selected_attrs
            )
            if self.checkState() == Qt.PartiallyChecked:
                # if partially check: 1) check if agg can be applied to all
                # 2) else uncheck if agg already applied to all
                # 3) else leve partially checked to apply to all that can be aggregated
                if can_be_applied_all:
                    self.setCheckState(Qt.Checked)
                elif applied_all:
                    self.setCheckState(Qt.Unchecked)
                else:
                    self.setCheckState(Qt.PartiallyChecked)
                    # since checkbox state stay same signal is not emitted
                    # automatically but we need a callback call so we emit it
                    self.stateChanged.emit(Qt.PartiallyChecked)
            else:  # self.checkState() == Qt.Unchecked
                # if unchecked: check if all can be checked else partially check
                self.setCheckState(
                    Qt.Checked if can_be_applied_all else Qt.PartiallyChecked
                )


@contextmanager
def block_signals(widget):
    widget.blockSignals(True)
    try:
        yield
    finally:
        widget.blockSignals(False)


class OWGroupBy(OWWidget, ConcurrentWidgetMixin):
    name = "Group by"
    description = ""
    category = "Transform"
    icon = "icons/GroupBy.svg"
    keywords = ["aggregate", "group by"]

    class Inputs:
        data = Input("Data", Table, doc="Input data table")

    class Outputs:
        data = Output("Data", Table, doc="Aggregated data")

    class Error(OWWidget.Error):
        unexpected_error = Msg("{}")

    settingsHandler = DomainContextHandler()

    gb_attrs: List[Variable] = ContextSetting([])
    aggregations: Dict[Variable, Set[str]] = ContextSetting({})
    auto_commit: bool = Setting(True)

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

        self.data = None
        self.result = None

        self.gb_attrs_model = DomainModel(
            separators=False,
        )
        self.agg_table_model = VarTableModel(self)
        self.agg_checkboxes = {}

        self.__init_control_area()
        self.__init_main_area()

    def __init_control_area(self) -> None:
        """Init all controls in the control area"""
        box = gui.vBox(self.controlArea, "Group by")
        self.gb_attrs_view = AggregateListViewSearch(
            selectionMode=QListView.ExtendedSelection
        )
        self.gb_attrs_view.setModel(self.gb_attrs_model)
        self.gb_attrs_view.selectionModel().selectionChanged.connect(self.__gb_changed)
        box.layout().addWidget(self.gb_attrs_view)

        gui.auto_send(self.buttonsArea, self, "auto_commit")

    def __init_main_area(self) -> None:
        """Init all controls in the main area"""
        # aggregation table
        self.agg_table_view = tableview = QTableView()
        tableview.setModel(self.agg_table_model)
        tableview.setSelectionBehavior(QAbstractItemView.SelectRows)
        tableview.selectionModel().selectionChanged.connect(self.__rows_selected)
        tableview.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)

        vbox = gui.vBox(self.mainArea, " ")
        vbox.layout().addWidget(tableview)

        # aggregations checkboxes
        grid_layout = QGridLayout()
        gui.widgetBox(self.mainArea, orientation=grid_layout, box="Aggregations")

        col = 0
        row = 0
        break_rows = (5, 5, 99)
        for agg in AGGREGATIONS:
            self.agg_checkboxes[agg] = cb = CheckBox(agg, self)
            cb.setDisabled(True)
            cb.stateChanged.connect(partial(self.__aggregation_changed, agg))
            grid_layout.addWidget(cb, row, col)
            row += 1
            if row == break_rows[col]:
                row = 0
                col += 1

    ############
    # Callbacks

    def __rows_selected(self) -> None:
        """Callback for table selection change; update checkboxes"""
        selected_attrs = self.get_selected_attributes()

        types = {type(attr) for attr in selected_attrs}
        active_aggregations = [self.aggregations[attr] for attr in selected_attrs]
        for agg, cb in self.agg_checkboxes.items():
            cb.setDisabled(not types & AGGREGATIONS[agg].types)

            activated = {agg in a for a in active_aggregations}
            with block_signals(cb):
                # check if aggregation active for all selected attributes,
                # partially check if active for some else uncheck
                cb.setCheckState(
                    Qt.Checked
                    if activated == {True}
                    else (Qt.Unchecked if activated == {False} else Qt.PartiallyChecked)
                )

    def __gb_changed(self) -> None:
        """
        Callback for Group-by attributes selection change; update attribute
        and call commit
        """
        rows = self.gb_attrs_view.selectionModel().selectedRows()
        values = self.gb_attrs_view.model()[:]
        self.gb_attrs = [values[row.row()] for row in sorted(rows)]
        # everything cached in result should be recomputed on gb change
        self.result = Result()
        self.commit.deferred()

    def __aggregation_changed(self, agg: str) -> None:
        """
        Callback for aggregation change; update aggregations dictionary and call
        commit
        """
        selected_attrs = self.get_selected_attributes()
        for attr in selected_attrs:
            if self.agg_checkboxes[agg].isChecked() and self.__aggregation_compatible(
                agg, attr
            ):
                self.aggregations[attr].add(agg)
            else:
                self.aggregations[attr].discard(agg)
            self.agg_table_model.update_aggregation(attr)
        self.commit.deferred()

    @Inputs.data
    def set_data(self, data: Table) -> None:
        self.closeContext()
        self.data = data

        # reset states
        self.cancel()
        self.result = Result()
        self.Outputs.data.send(None)
        self.gb_attrs_model.set_domain(data.domain if data else None)
        self.gb_attrs = data.domain[:1] if data else []
        self.aggregations = (
            {
                attr: DEFAULT_AGGREGATIONS[type(attr)].copy()
                for attr in data.domain.variables + data.domain.metas
            }
            if data
            else {}
        )

        self.openContext(self.data)

        # update selections in widgets and re-plot
        self.agg_table_model.set_domain(data.domain if data else None)
        self._set_gb_selection()

        self.commit.now()

    #########################
    # Task connected methods

    @gui.deferred
    def commit(self) -> None:
        self.Error.clear()
        self.Warning.clear()
        if self.data:
            self.start(_run, self.data, self.gb_attrs, self.aggregations, self.result)

    def on_done(self, result: Result) -> None:
        self.result = result
        self.Outputs.data.send(result.result_table)

    def on_partial_result(self, result: Result) -> None:
        # store result in case the task is canceled and on_done is not called
        self.result = result

    def on_exception(self, ex: Exception):
        self.Error.unexpected_error(str(ex))

    ###################
    # Helper methods

    def get_selected_attributes(self):
        """Get select attributes in the table"""
        selection_model = self.agg_table_view.selectionModel()
        sel_rows = selection_model.selectedRows()
        vars_ = self.data.domain.variables + self.data.domain.metas
        return [vars_[index.row()] for index in sel_rows]

    def _set_gb_selection(self) -> None:
        """Set selection in groupby list according to self.gb_attrs"""
        sm = self.gb_attrs_view.selectionModel()
        values = self.gb_attrs_model[:]
        with disconnected(sm.selectionChanged, self.__gb_changed):
            for val in self.gb_attrs:
                index = values.index(val)
                model_index = self.gb_attrs_model.index(index, 0)
                sm.select(model_index, QItemSelectionModel.Select)

    @staticmethod
    def __aggregation_compatible(agg, attr):
        """Check a compatibility of aggregation with the variable"""
        return type(attr) in AGGREGATIONS[agg].types


if __name__ == "__main__":
    # pylint: disable=ungrouped-imports
    from orangewidget.utils.widgetpreview import WidgetPreview

    WidgetPreview(OWGroupBy).run(Table("iris"))

```
--- 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:** GroupBy Widget Fails to Restore Aggregations When Data Domain Changes

**Description:**
When changing the data domain in the GroupBy widget, previously set aggregations are not correctly restored. This leads to missing aggregation functions, causing unexpected behavior in data processing.

**Example Code:**
```python
# Setup GroupBy widget with initial data
widget = OWGroupBy()
widget.send_signal(widget.Inputs.data, initial_data)

# Change the data domain by sending new data
widget.send_signal(widget.Inputs.data, new_data)

# Check the aggregations
aggregations = widget.aggregations
print(aggregations)  # Expected: {'Mean', 'Mean', 'Concatenate'}
```

**Expected Behavior:**
After changing the data domain, the GroupBy widget should retain and correctly restore all previously set aggregation functions, such as "Mean" and "Concatenate".

**Actual Behavior:**
The first aggregation is missing after the data domain change, resulting in aggregations like `{'', 'Mean', 'Concatenate'}`. This causes the widget to behave incorrectly by not applying all intended aggregation functions.

[/ISSUE]
{
    "TestOWGroupBy.test_aggregation": "PASSED",
    "TestOWGroupBy.test_aggregations_change": "PASSED",
    "TestOWGroupBy.test_attr_table_row_selection": "PASSED",
    "TestOWGroupBy.test_context": "PASSED",
    "TestOWGroupBy.test_data": "PASSED",
    "TestOWGroupBy.test_data_domain_changed": "PASSED",
    "TestOWGroupBy.test_groupby_attr_selection": "PASSED",
    "TestOWGroupBy.test_image_export": "PASSED",
    "TestOWGroupBy.test_metas_results": "PASSED",
    "TestOWGroupBy.test_msg_base_class": "PASSED",
    "TestOWGroupBy.test_none_data": "PASSED",
    "TestOWGroupBy.test_only_nan_in_group": "PASSED",
    "TestOWGroupBy.test_unexpected_error": "PASSED",
    "TestOWGroupBy.test_minimum_size": "FAILED",
    "TestOWGroupBy.test_time_variable": "FAILED"
}
diff --git a/Orange/widgets/data/owgroupby.py b/Orange/widgets/data/owgroupby.py
index 07821aec2..ad160b55f 100644
--- a/Orange/widgets/data/owgroupby.py
+++ b/Orange/widgets/data/owgroupby.py
@@ -443,9 +443,14 @@ class OWGroupBy(OWWidget, ConcurrentWidgetMixin):
             if data
             else {}
         )
+        default_aggregations = self.aggregations.copy()
 
         self.openContext(self.data)
 
+        # restore aggregations
+        self.aggregations.update({k: v for k, v in default_aggregations.items()
+                                  if k not in self.aggregations})
+
         # update selections in widgets and re-plot
         self.agg_table_model.set_domain(data.domain if data else None)
         self._set_gb_selection()

{"Orange/widgets/data/owgroupby.py": "from collections import namedtuple\nfrom contextlib import contextmanager\nfrom dataclasses import dataclass\nfrom functools import partial\nfrom typing import Any, Dict, List, Optional, Set\n\nimport pandas as pd\nfrom numpy import nan\nfrom AnyQt.QtCore import (\n    QAbstractTableModel,\n    QEvent,\n    QItemSelectionModel,\n    QModelIndex,\n    Qt,\n)\nfrom AnyQt.QtWidgets import (\n    QAbstractItemView,\n    QCheckBox,\n    QGridLayout,\n    QHeaderView,\n    QListView,\n    QTableView,\n)\nfrom orangewidget.settings import ContextSetting, Setting\nfrom orangewidget.utils.listview import ListViewSearch\nfrom orangewidget.utils.signals import Input, Output\nfrom orangewidget.widget import Msg\n\nfrom Orange.data import (\n    ContinuousVariable,\n    DiscreteVariable,\n    Domain,\n    StringVariable,\n    Table,\n    TimeVariable,\n    Variable,\n)\nfrom Orange.data.aggregate import OrangeTableGroupBy\nfrom Orange.util import wrap_callback\nfrom Orange.widgets import gui\nfrom Orange.widgets.data.oweditdomain import disconnected\nfrom Orange.widgets.settings import DomainContextHandler\nfrom Orange.widgets.utils.concurrent import ConcurrentWidgetMixin, TaskState\nfrom Orange.widgets.utils.itemmodels import DomainModel\nfrom Orange.widgets.widget import OWWidget\n\nAggregation = namedtuple(\"Aggregation\", [\"function\", \"types\"])\n\n\ndef concatenate(x):\n    \"\"\"\n    Concatenate values of series if value is not missing (nan or empty string\n    for StringVariable)\n    \"\"\"\n    return \" \".join(str(v) for v in x if not pd.isnull(v) and len(str(v)) > 0)\n\n\nAGGREGATIONS = {\n    \"Mean\": Aggregation(\"mean\", {ContinuousVariable, TimeVariable}),\n    \"Median\": Aggregation(\"median\", {ContinuousVariable, TimeVariable}),\n    \"Mode\": Aggregation(\n        lambda x: pd.Series.mode(x).get(0, nan), {ContinuousVariable, TimeVariable}\n    ),\n    \"Standard deviation\": Aggregation(\"std\", {ContinuousVariable, TimeVariable}),\n    \"Variance\": Aggregation(\"var\", {ContinuousVariable, TimeVariable}),\n    \"Sum\": Aggregation(\"sum\", {ContinuousVariable, TimeVariable}),\n    \"Concatenate\": Aggregation(\n        concatenate,\n        {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable},\n    ),\n    \"Min. value\": Aggregation(\"min\", {ContinuousVariable, TimeVariable}),\n    \"Max. value\": Aggregation(\"max\", {ContinuousVariable, TimeVariable}),\n    \"Span\": Aggregation(\n        lambda x: pd.Series.max(x) - pd.Series.min(x),\n        {ContinuousVariable, TimeVariable},\n    ),\n    \"First value\": Aggregation(\n        \"first\", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}\n    ),\n    \"Last value\": Aggregation(\n        \"last\", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}\n    ),\n    \"Random value\": Aggregation(\n        lambda x: x.sample(1, random_state=0),\n        {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable},\n    ),\n    \"Count defined\": Aggregation(\n        \"count\", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}\n    ),\n    \"Count\": Aggregation(\n        \"size\", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}\n    ),\n    \"Proportion defined\": Aggregation(\n        lambda x: x.count() / x.size,\n        {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable},\n    ),\n}\n# list of ordered aggregation names is required on several locations so we\n# prepare it in advance\nAGGREGATIONS_ORD = list(AGGREGATIONS)\n\n# use first aggregation suitable for each type as default\nDEFAULT_AGGREGATIONS = {\n    var: {next(name for name, agg in AGGREGATIONS.items() if var in agg.types)}\n    for var in (ContinuousVariable, TimeVariable, DiscreteVariable, StringVariable)\n}\n\n\n@dataclass\nclass Result:\n    group_by: OrangeTableGroupBy = None\n    result_table: Optional[Table] = None\n\n\ndef _run(\n    data: Table,\n    group_by_attrs: List[Variable],\n    aggregations: Dict[Variable, Set[str]],\n    result: Result,\n    state: TaskState,\n) -> Result:\n    def progress(part):\n        state.set_progress_value(part * 100)\n        if state.is_interruption_requested():\n            raise Exception\n\n    state.set_status(\"Aggregating\")\n    # group table rows\n    if result.group_by is None:\n        result.group_by = data.groupby(group_by_attrs)\n    state.set_partial_result(result)\n\n    aggregations = {\n        var: [\n            (agg, AGGREGATIONS[agg].function)\n            for agg in sorted(aggs, key=AGGREGATIONS_ORD.index)\n        ]\n        for var, aggs in aggregations.items()\n    }\n    result.result_table = result.group_by.aggregate(\n        aggregations, wrap_callback(progress, 0.2, 1)\n    )\n    return result\n\n\nclass TabColumn:\n    attribute = 0\n    aggregations = 1\n\n\nTABLE_COLUMN_NAMES = [\"Attributes\", \"Aggregations\"]\n\n\nclass VarTableModel(QAbstractTableModel):\n    def __init__(self, parent: \"OWGroupBy\", *args):\n        super().__init__(*args)\n        self.domain = None\n        self.parent = parent\n\n    def set_domain(self, domain: Domain) -> None:\n        \"\"\"\n        Reset the table view to new domain\n        \"\"\"\n        self.domain = domain\n        self.modelReset.emit()\n\n    def update_aggregation(self, attribute: str) -> None:\n        \"\"\"\n        Reset the aggregation values in the table for the attribute\n        \"\"\"\n        index = self.domain.index(attribute)\n        if index < 0:\n            # indices of metas are negative: first meta -1, second meta -2, ...\n            index = len(self.domain.variables) - 1 - index\n        index = self.index(index, 1)\n        self.dataChanged.emit(index, index)\n\n    def rowCount(self, parent=None) -> int:\n        return (\n            0\n            if self.domain is None or (parent is not None and parent.isValid())\n            else len(self.domain.variables) + len(self.domain.metas)\n        )\n\n    @staticmethod\n    def columnCount(parent=None) -> int:\n        return 0 if parent is not None and parent.isValid() else len(TABLE_COLUMN_NAMES)\n\n    def data(self, index, role=Qt.DisplayRole) -> Any:\n        row, col = index.row(), index.column()\n        val = (self.domain.variables + self.domain.metas)[row]\n        if role in (Qt.DisplayRole, Qt.EditRole):\n            if col == TabColumn.attribute:\n                return str(val)\n            else:  # col == TabColumn.aggregations\n                # plot first two aggregations comma separated and write n more\n                # for others\n                aggs = sorted(\n                    self.parent.aggregations.get(val, []), key=AGGREGATIONS_ORD.index\n                )\n                n_more = \"\" if len(aggs) <= 3 else f\" and {len(aggs) - 3} more\"\n                return \", \".join(aggs[:3]) + n_more\n        elif role == Qt.DecorationRole and col == TabColumn.attribute:\n            return gui.attributeIconDict[val]\n        return None\n\n    def headerData(self, i, orientation, role=Qt.DisplayRole) -> str:\n        if orientation == Qt.Horizontal and role == Qt.DisplayRole and i < 2:\n            return TABLE_COLUMN_NAMES[i]\n        return super().headerData(i, orientation, role)\n\n\nclass AggregateListViewSearch(ListViewSearch):\n    \"\"\"ListViewSearch that disables unselecting all items in the list\"\"\"\n\n    def selectionCommand(\n        self, index: QModelIndex, event: QEvent = None\n    ) -> QItemSelectionModel.SelectionFlags:\n        flags = super().selectionCommand(index, event)\n        selmodel = self.selectionModel()\n        if not index.isValid():  # Click on empty viewport; don't clear\n            return QItemSelectionModel.NoUpdate\n        if selmodel.isSelected(index):\n            currsel = selmodel.selectedIndexes()\n            if len(currsel) == 1 and index == currsel[0]:\n                # Is the last selected index; do not deselect it\n                return QItemSelectionModel.NoUpdate\n        if (\n            event is not None\n            and event.type() == QEvent.MouseMove\n            and flags & QItemSelectionModel.ToggleCurrent\n        ):\n            # Disable ctrl drag 'toggle'; can be made to deselect the last\n            # index, would need to keep track of the current selection\n            # (selectionModel does this but does not expose it)\n            flags &= ~QItemSelectionModel.Toggle\n            flags |= QItemSelectionModel.Select\n        return flags\n\n\nclass CheckBox(QCheckBox):\n    def __init__(self, text, parent):\n        super().__init__(text)\n        self.parent: OWGroupBy = parent\n\n    def nextCheckState(self) -> None:\n        \"\"\"\n        Custom behaviour for switching between steps. It is required since\n        sometimes user will select different types of attributes at the same\n        time. In this case we step between unchecked, partially checked and\n        checked or just between unchecked and checked - depending on situation\n        \"\"\"\n        if self.checkState() == Qt.Checked:\n            # if checked always uncheck\n            self.setCheckState(Qt.Unchecked)\n        else:\n            agg = self.text()\n            selected_attrs = self.parent.get_selected_attributes()\n            types = set(type(attr) for attr in selected_attrs)\n            can_be_applied_all = types <= AGGREGATIONS[agg].types\n\n            # true if aggregation applied to all attributes that can be\n            # aggregated with selected aggregation\n            applied_all = all(\n                type(attr) not in AGGREGATIONS[agg].types\n                or agg in self.parent.aggregations[attr]\n                for attr in selected_attrs\n            )\n            if self.checkState() == Qt.PartiallyChecked:\n                # if partially check: 1) check if agg can be applied to all\n                # 2) else uncheck if agg already applied to all\n                # 3) else leve partially checked to apply to all that can be aggregated\n                if can_be_applied_all:\n                    self.setCheckState(Qt.Checked)\n                elif applied_all:\n                    self.setCheckState(Qt.Unchecked)\n                else:\n                    self.setCheckState(Qt.PartiallyChecked)\n                    # since checkbox state stay same signal is not emitted\n                    # automatically but we need a callback call so we emit it\n                    self.stateChanged.emit(Qt.PartiallyChecked)\n            else:  # self.checkState() == Qt.Unchecked\n                # if unchecked: check if all can be checked else partially check\n                self.setCheckState(\n                    Qt.Checked if can_be_applied_all else Qt.PartiallyChecked\n                )\n\n\n@contextmanager\ndef block_signals(widget):\n    widget.blockSignals(True)\n    try:\n        yield\n    finally:\n        widget.blockSignals(False)\n\n\nclass OWGroupBy(OWWidget, ConcurrentWidgetMixin):\n    name = \"Group by\"\n    description = \"\"\n    category = \"Transform\"\n    icon = \"icons/GroupBy.svg\"\n    keywords = [\"aggregate\", \"group by\"]\n\n    class Inputs:\n        data = Input(\"Data\", Table, doc=\"Input data table\")\n\n    class Outputs:\n        data = Output(\"Data\", Table, doc=\"Aggregated data\")\n\n    class Error(OWWidget.Error):\n        unexpected_error = Msg(\"{}\")\n\n    settingsHandler = DomainContextHandler()\n\n    gb_attrs: List[Variable] = ContextSetting([])\n    aggregations: Dict[Variable, Set[str]] = ContextSetting({})\n    auto_commit: bool = Setting(True)\n\n    def __init__(self):\n        super().__init__()\n        ConcurrentWidgetMixin.__init__(self)\n\n        self.data = None\n        self.result = None\n\n        self.gb_attrs_model = DomainModel(\n            separators=False,\n        )\n        self.agg_table_model = VarTableModel(self)\n        self.agg_checkboxes = {}\n\n        self.__init_control_area()\n        self.__init_main_area()\n\n    def __init_control_area(self) -> None:\n        \"\"\"Init all controls in the control area\"\"\"\n        box = gui.vBox(self.controlArea, \"Group by\")\n        self.gb_attrs_view = AggregateListViewSearch(\n            selectionMode=QListView.ExtendedSelection\n        )\n        self.gb_attrs_view.setModel(self.gb_attrs_model)\n        self.gb_attrs_view.selectionModel().selectionChanged.connect(self.__gb_changed)\n        box.layout().addWidget(self.gb_attrs_view)\n\n        gui.auto_send(self.buttonsArea, self, \"auto_commit\")\n\n    def __init_main_area(self) -> None:\n        \"\"\"Init all controls in the main area\"\"\"\n        # aggregation table\n        self.agg_table_view = tableview = QTableView()\n        tableview.setModel(self.agg_table_model)\n        tableview.setSelectionBehavior(QAbstractItemView.SelectRows)\n        tableview.selectionModel().selectionChanged.connect(self.__rows_selected)\n        tableview.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)\n\n        vbox = gui.vBox(self.mainArea, \" \")\n        vbox.layout().addWidget(tableview)\n\n        # aggregations checkboxes\n        grid_layout = QGridLayout()\n        gui.widgetBox(self.mainArea, orientation=grid_layout, box=\"Aggregations\")\n\n        col = 0\n        row = 0\n        break_rows = (5, 5, 99)\n        for agg in AGGREGATIONS:\n            self.agg_checkboxes[agg] = cb = CheckBox(agg, self)\n            cb.setDisabled(True)\n            cb.stateChanged.connect(partial(self.__aggregation_changed, agg))\n            grid_layout.addWidget(cb, row, col)\n            row += 1\n            if row == break_rows[col]:\n                row = 0\n                col += 1\n\n    ############\n    # Callbacks\n\n    def __rows_selected(self) -> None:\n        \"\"\"Callback for table selection change; update checkboxes\"\"\"\n        selected_attrs = self.get_selected_attributes()\n\n        types = {type(attr) for attr in selected_attrs}\n        active_aggregations = [self.aggregations[attr] for attr in selected_attrs]\n        for agg, cb in self.agg_checkboxes.items():\n            cb.setDisabled(not types & AGGREGATIONS[agg].types)\n\n            activated = {agg in a for a in active_aggregations}\n            with block_signals(cb):\n                # check if aggregation active for all selected attributes,\n                # partially check if active for some else uncheck\n                cb.setCheckState(\n                    Qt.Checked\n                    if activated == {True}\n                    else (Qt.Unchecked if activated == {False} else Qt.PartiallyChecked)\n                )\n\n    def __gb_changed(self) -> None:\n        \"\"\"\n        Callback for Group-by attributes selection change; update attribute\n        and call commit\n        \"\"\"\n        rows = self.gb_attrs_view.selectionModel().selectedRows()\n        values = self.gb_attrs_view.model()[:]\n        self.gb_attrs = [values[row.row()] for row in sorted(rows)]\n        # everything cached in result should be recomputed on gb change\n        self.result = Result()\n        self.commit.deferred()\n\n    def __aggregation_changed(self, agg: str) -> None:\n        \"\"\"\n        Callback for aggregation change; update aggregations dictionary and call\n        commit\n        \"\"\"\n        selected_attrs = self.get_selected_attributes()\n        for attr in selected_attrs:\n            if self.agg_checkboxes[agg].isChecked() and self.__aggregation_compatible(\n                agg, attr\n            ):\n                self.aggregations[attr].add(agg)\n            else:\n                self.aggregations[attr].discard(agg)\n            self.agg_table_model.update_aggregation(attr)\n        self.commit.deferred()\n\n    @Inputs.data\n    def set_data(self, data: Table) -> None:\n        self.closeContext()\n        self.data = data\n\n        # reset states\n        self.cancel()\n        self.result = Result()\n        self.Outputs.data.send(None)\n        self.gb_attrs_model.set_domain(data.domain if data else None)\n        self.gb_attrs = data.domain[:1] if data else []\n        self.aggregations = (\n            {\n                attr: DEFAULT_AGGREGATIONS[type(attr)].copy()\n                for attr in data.domain.variables + data.domain.metas\n            }\n            if data\n            else {}\n        )\n\n        self.openContext(self.data)\n\n        # update selections in widgets and re-plot\n        self.agg_table_model.set_domain(data.domain if data else None)\n        self._set_gb_selection()\n\n        self.commit.now()\n\n    #########################\n    # Task connected methods\n\n    @gui.deferred\n    def commit(self) -> None:\n        self.Error.clear()\n        self.Warning.clear()\n        if self.data:\n            self.start(_run, self.data, self.gb_attrs, self.aggregations, self.result)\n\n    def on_done(self, result: Result) -> None:\n        self.result = result\n        self.Outputs.data.send(result.result_table)\n\n    def on_partial_result(self, result: Result) -> None:\n        # store result in case the task is canceled and on_done is not called\n        self.result = result\n\n    def on_exception(self, ex: Exception):\n        self.Error.unexpected_error(str(ex))\n\n    ###################\n    # Helper methods\n\n    def get_selected_attributes(self):\n        \"\"\"Get select attributes in the table\"\"\"\n        selection_model = self.agg_table_view.selectionModel()\n        sel_rows = selection_model.selectedRows()\n        vars_ = self.data.domain.variables + self.data.domain.metas\n        return [vars_[index.row()] for index in sel_rows]\n\n    def _set_gb_selection(self) -> None:\n        \"\"\"Set selection in groupby list according to self.gb_attrs\"\"\"\n        sm = self.gb_attrs_view.selectionModel()\n        values = self.gb_attrs_model[:]\n        with disconnected(sm.selectionChanged, self.__gb_changed):\n            for val in self.gb_attrs:\n                index = values.index(val)\n                model_index = self.gb_attrs_model.index(index, 0)\n                sm.select(model_index, QItemSelectionModel.Select)\n\n    @staticmethod\n    def __aggregation_compatible(agg, attr):\n        \"\"\"Check a compatibility of aggregation with the variable\"\"\"\n        return type(attr) in AGGREGATIONS[agg].types\n\n\nif __name__ == \"__main__\":\n    # pylint: disable=ungrouped-imports\n    from orangewidget.utils.widgetpreview import WidgetPreview\n\n    WidgetPreview(OWGroupBy).run(Table(\"iris\"))\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:** GroupBy Widget Fails to Restore Aggregations When Data Domain Changes

**Description:**
When changing the data domain in the GroupBy widget, previously set aggregations are not correctly restored. This leads to missing aggregation functions, causing unexpected behavior in data processing.

**Example Code:**
```python
# Setup GroupBy widget with initial data
widget = OWGroupBy()
widget.send_signal(widget.Inputs.data, initial_data)

# Change the data domain by sending new data
widget.send_signal(widget.Inputs.data, new_data)

# Check the aggregations
aggregations = widget.aggregations
print(aggregations)  # Expected: {'Mean', 'Mean', 'Concatenate'}
```

**Expected Behavior:**
After changing the data domain, the GroupBy widget should retain and correctly restore all previously set aggregation functions, such as "Mean" and "Concatenate".

**Actual Behavior:**
The first aggregation is missing after the data domain change, resulting in aggregations like `{'', 'Mean', 'Concatenate'}`. This causes the widget to behave incorrectly by not applying all intended aggregation functions.

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

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

--- BEGIN FILE ---
```
### Orange/widgets/data/owgroupby.py
from collections import namedtuple
from contextlib import contextmanager
from dataclasses import dataclass
from functools import partial
from typing import Any, Dict, List, Optional, Set

import pandas as pd
from numpy import nan
from AnyQt.QtCore import (
    QAbstractTableModel,
    QEvent,
    QItemSelectionModel,
    QModelIndex,
    Qt,
)
from AnyQt.QtWidgets import (
    QAbstractItemView,
    QCheckBox,
    QGridLayout,
    QHeaderView,
    QListView,
    QTableView,
)
from orangewidget.settings import ContextSetting, Setting
from orangewidget.utils.listview import ListViewSearch
from orangewidget.utils.signals import Input, Output
from orangewidget.widget import Msg

from Orange.data import (
    ContinuousVariable,
    DiscreteVariable,
    Domain,
    StringVariable,
    Table,
    TimeVariable,
    Variable,
)
from Orange.data.aggregate import OrangeTableGroupBy
from Orange.util import wrap_callback
from Orange.widgets import gui
from Orange.widgets.data.oweditdomain import disconnected
from Orange.widgets.settings import DomainContextHandler
from Orange.widgets.utils.concurrent import ConcurrentWidgetMixin, TaskState
from Orange.widgets.utils.itemmodels import DomainModel
from Orange.widgets.widget import OWWidget

Aggregation = namedtuple("Aggregation", ["function", "types"])


def concatenate(x):
    """
    Concatenate values of series if value is not missing (nan or empty string
    for StringVariable)
    """
    return " ".join(str(v) for v in x if not pd.isnull(v) and len(str(v)) > 0)


AGGREGATIONS = {
    "Mean": Aggregation("mean", {ContinuousVariable, TimeVariable}),
    "Median": Aggregation("median", {ContinuousVariable, TimeVariable}),
    "Mode": Aggregation(
        lambda x: pd.Series.mode(x).get(0, nan), {ContinuousVariable, TimeVariable}
    ),
    "Standard deviation": Aggregation("std", {ContinuousVariable, TimeVariable}),
    "Variance": Aggregation("var", {ContinuousVariable, TimeVariable}),
    "Sum": Aggregation("sum", {ContinuousVariable, TimeVariable}),
    "Concatenate": Aggregation(
        concatenate,
        {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable},
    ),
    "Min. value": Aggregation("min", {ContinuousVariable, TimeVariable}),
    "Max. value": Aggregation("max", {ContinuousVariable, TimeVariable}),
    "Span": Aggregation(
        lambda x: pd.Series.max(x) - pd.Series.min(x),
        {ContinuousVariable, TimeVariable},
    ),
    "First value": Aggregation(
        "first", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}
    ),
    "Last value": Aggregation(
        "last", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}
    ),
    "Random value": Aggregation(
        lambda x: x.sample(1, random_state=0),
        {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable},
    ),
    "Count defined": Aggregation(
        "count", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}
    ),
    "Count": Aggregation(
        "size", {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable}
    ),
    "Proportion defined": Aggregation(
        lambda x: x.count() / x.size,
        {ContinuousVariable, DiscreteVariable, StringVariable, TimeVariable},
    ),
}
# list of ordered aggregation names is required on several locations so we
# prepare it in advance
AGGREGATIONS_ORD = list(AGGREGATIONS)

# use first aggregation suitable for each type as default
DEFAULT_AGGREGATIONS = {
    var: {next(name for name, agg in AGGREGATIONS.items() if var in agg.types)}
    for var in (ContinuousVariable, TimeVariable, DiscreteVariable, StringVariable)
}


@dataclass
class Result:
    group_by: OrangeTableGroupBy = None
    result_table: Optional[Table] = None


def _run(
    data: Table,
    group_by_attrs: List[Variable],
    aggregations: Dict[Variable, Set[str]],
    result: Result,
    state: TaskState,
) -> Result:
    def progress(part):
        state.set_progress_value(part * 100)
        if state.is_interruption_requested():
            raise Exception

    state.set_status("Aggregating")
    # group table rows
    if result.group_by is None:
        result.group_by = data.groupby(group_by_attrs)
    state.set_partial_result(result)

    aggregations = {
        var: [
            (agg, AGGREGATIONS[agg].function)
            for agg in sorted(aggs, key=AGGREGATIONS_ORD.index)
        ]
        for var, aggs in aggregations.items()
    }
    result.result_table = result.group_by.aggregate(
        aggregations, wrap_callback(progress, 0.2, 1)
    )
    return result


class TabColumn:
    attribute = 0
    aggregations = 1


TABLE_COLUMN_NAMES = ["Attributes", "Aggregations"]


class VarTableModel(QAbstractTableModel):
    def __init__(self, parent: "OWGroupBy", *args):
        super().__init__(*args)
        self.domain = None
        self.parent = parent

    def set_domain(self, domain: Domain) -> None:
        """
        Reset the table view to new domain
        """
        self.domain = domain
        self.modelReset.emit()

    def update_aggregation(self, attribute: str) -> None:
        """
        Reset the aggregation values in the table for the attribute
        """
        index = self.domain.index(attribute)
        if index < 0:
            # indices of metas are negative: first meta -1, second meta -2, ...
            index = len(self.domain.variables) - 1 - index
        index = self.index(index, 1)
        self.dataChanged.emit(index, index)

    def rowCount(self, parent=None) -> int:
        return (
            0
            if self.domain is None or (parent is not None and parent.isValid())
            else len(self.domain.variables) + len(self.domain.metas)
        )

    @staticmethod
    def columnCount(parent=None) -> int:
        return 0 if parent is not None and parent.isValid() else len(TABLE_COLUMN_NAMES)

    def data(self, index, role=Qt.DisplayRole) -> Any:
        row, col = index.row(), index.column()
        val = (self.domain.variables + self.domain.metas)[row]
        if role in (Qt.DisplayRole, Qt.EditRole):
            if col == TabColumn.attribute:
                return str(val)
            else:  # col == TabColumn.aggregations
                # plot first two aggregations comma separated and write n more
                # for others
                aggs = sorted(
                    self.parent.aggregations.get(val, []), key=AGGREGATIONS_ORD.index
                )
                n_more = "" if len(aggs) <= 3 else f" and {len(aggs) - 3} more"
                return ", ".join(aggs[:3]) + n_more
        elif role == Qt.DecorationRole and col == TabColumn.attribute:
            return gui.attributeIconDict[val]
        return None

    def headerData(self, i, orientation, role=Qt.DisplayRole) -> str:
        if orientation == Qt.Horizontal and role == Qt.DisplayRole and i < 2:
            return TABLE_COLUMN_NAMES[i]
        return super().headerData(i, orientation, role)


class AggregateListViewSearch(ListViewSearch):
    """ListViewSearch that disables unselecting all items in the list"""

    def selectionCommand(
        self, index: QModelIndex, event: QEvent = None
    ) -> QItemSelectionModel.SelectionFlags:
        flags = super().selectionCommand(index, event)
        selmodel = self.selectionModel()
        if not index.isValid():  # Click on empty viewport; don't clear
            return QItemSelectionModel.NoUpdate
        if selmodel.isSelected(index):
            currsel = selmodel.selectedIndexes()
            if len(currsel) == 1 and index == currsel[0]:
                # Is the last selected index; do not deselect it
                return QItemSelectionModel.NoUpdate
        if (
            event is not None
            and event.type() == QEvent.MouseMove
            and flags & QItemSelectionModel.ToggleCurrent
        ):
            # Disable ctrl drag 'toggle'; can be made to deselect the last
            # index, would need to keep track of the current selection
            # (selectionModel does this but does not expose it)
            flags &= ~QItemSelectionModel.Toggle
            flags |= QItemSelectionModel.Select
        return flags


class CheckBox(QCheckBox):
    def __init__(self, text, parent):
        super().__init__(text)
        self.parent: OWGroupBy = parent

    def nextCheckState(self) -> None:
        """
        Custom behaviour for switching between steps. It is required since
        sometimes user will select different types of attributes at the same
        time. In this case we step between unchecked, partially checked and
        checked or just between unchecked and checked - depending on situation
        """
        if self.checkState() == Qt.Checked:
            # if checked always uncheck
            self.setCheckState(Qt.Unchecked)
        else:
            agg = self.text()
            selected_attrs = self.parent.get_selected_attributes()
            types = set(type(attr) for attr in selected_attrs)
            can_be_applied_all = types <= AGGREGATIONS[agg].types

            # true if aggregation applied to all attributes that can be
            # aggregated with selected aggregation
            applied_all = all(
                type(attr) not in AGGREGATIONS[agg].types
                or agg in self.parent.aggregations[attr]
                for attr in selected_attrs
            )
            if self.checkState() == Qt.PartiallyChecked:
                # if partially check: 1) check if agg can be applied to all
                # 2) else uncheck if agg already applied to all
                # 3) else leve partially checked to apply to all that can be aggregated
                if can_be_applied_all:
                    self.setCheckState(Qt.Checked)
                elif applied_all:
                    self.setCheckState(Qt.Unchecked)
                else:
                    self.setCheckState(Qt.PartiallyChecked)
                    # since checkbox state stay same signal is not emitted
                    # automatically but we need a callback call so we emit it
                    self.stateChanged.emit(Qt.PartiallyChecked)
            else:  # self.checkState() == Qt.Unchecked
                # if unchecked: check if all can be checked else partially check
                self.setCheckState(
                    Qt.Checked if can_be_applied_all else Qt.PartiallyChecked
                )


@contextmanager
def block_signals(widget):
    widget.blockSignals(True)
    try:
        yield
    finally:
        widget.blockSignals(False)


class OWGroupBy(OWWidget, ConcurrentWidgetMixin):
    name = "Group by"
    description = ""
    category = "Transform"
    icon = "icons/GroupBy.svg"
    keywords = ["aggregate", "group by"]

    class Inputs:
        data = Input("Data", Table, doc="Input data table")

    class Outputs:
        data = Output("Data", Table, doc="Aggregated data")

    class Error(OWWidget.Error):
        unexpected_error = Msg("{}")

    settingsHandler = DomainContextHandler()

    gb_attrs: List[Variable] = ContextSetting([])
    aggregations: Dict[Variable, Set[str]] = ContextSetting({})
    auto_commit: bool = Setting(True)

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

        self.data = None
        self.result = None

        self.gb_attrs_model = DomainModel(
            separators=False,
        )
        self.agg_table_model = VarTableModel(self)
        self.agg_checkboxes = {}

        self.__init_control_area()
        self.__init_main_area()

    def __init_control_area(self) -> None:
        """Init all controls in the control area"""
        box = gui.vBox(self.controlArea, "Group by")
        self.gb_attrs_view = AggregateListViewSearch(
            selectionMode=QListView.ExtendedSelection
        )
        self.gb_attrs_view.setModel(self.gb_attrs_model)
        self.gb_attrs_view.selectionModel().selectionChanged.connect(self.__gb_changed)
        box.layout().addWidget(self.gb_attrs_view)

        gui.auto_send(self.buttonsArea, self, "auto_commit")

    def __init_main_area(self) -> None:
        """Init all controls in the main area"""
        # aggregation table
        self.agg_table_view = tableview = QTableView()
        tableview.setModel(self.agg_table_model)
        tableview.setSelectionBehavior(QAbstractItemView.SelectRows)
        tableview.selectionModel().selectionChanged.connect(self.__rows_selected)
        tableview.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)

        vbox = gui.vBox(self.mainArea, " ")
        vbox.layout().addWidget(tableview)

        # aggregations checkboxes
        grid_layout = QGridLayout()
        gui.widgetBox(self.mainArea, orientation=grid_layout, box="Aggregations")

        col = 0
        row = 0
        break_rows = (5, 5, 99)
        for agg in AGGREGATIONS:
            self.agg_checkboxes[agg] = cb = CheckBox(agg, self)
            cb.setDisabled(True)
            cb.stateChanged.connect(partial(self.__aggregation_changed, agg))
            grid_layout.addWidget(cb, row, col)
            row += 1
            if row == break_rows[col]:
                row = 0
                col += 1

    ############
    # Callbacks

    def __rows_selected(self) -> None:
        """Callback for table selection change; update checkboxes"""
        selected_attrs = self.get_selected_attributes()

        types = {type(attr) for attr in selected_attrs}
        active_aggregations = [self.aggregations[attr] for attr in selected_attrs]
        for agg, cb in self.agg_checkboxes.items():
            cb.setDisabled(not types & AGGREGATIONS[agg].types)

            activated = {agg in a for a in active_aggregations}
            with block_signals(cb):
                # check if aggregation active for all selected attributes,
                # partially check if active for some else uncheck
                cb.setCheckState(
                    Qt.Checked
                    if activated == {True}
                    else (Qt.Unchecked if activated == {False} else Qt.PartiallyChecked)
                )

    def __gb_changed(self) -> None:
        """
        Callback for Group-by attributes selection change; update attribute
        and call commit
        """
        rows = self.gb_attrs_view.selectionModel().selectedRows()
        values = self.gb_attrs_view.model()[:]
        self.gb_attrs = [values[row.row()] for row in sorted(rows)]
        # everything cached in result should be recomputed on gb change
        self.result = Result()
        self.commit.deferred()

    def __aggregation_changed(self, agg: str) -> None:
        """
        Callback for aggregation change; update aggregations dictionary and call
        commit
        """
        selected_attrs = self.get_selected_attributes()
        for attr in selected_attrs:
            if self.agg_checkboxes[agg].isChecked() and self.__aggregation_compatible(
                agg, attr
            ):
                self.aggregations[attr].add(agg)
            else:
                self.aggregations[attr].discard(agg)
            self.agg_table_model.update_aggregation(attr)
        self.commit.deferred()

    @Inputs.data
    def set_data(self, data: Table) -> None:
        self.closeContext()
        self.data = data

        # reset states
        self.cancel()
        self.result = Result()
        self.Outputs.data.send(None)
        self.gb_attrs_model.set_domain(data.domain if data else None)
        self.gb_attrs = data.domain[:1] if data else []
        self.aggregations = (
            {
                attr: DEFAULT_AGGREGATIONS[type(attr)].copy()
                for attr in data.domain.variables + data.domain.metas
            }
            if data
            else {}
        )

        self.openContext(self.data)

        # update selections in widgets and re-plot
        self.agg_table_model.set_domain(data.domain if data else None)
        self._set_gb_selection()

        self.commit.now()

    #########################
    # Task connected methods

    @gui.deferred
    def commit(self) -> None:
        self.Error.clear()
        self.Warning.clear()
        if self.data:
            self.start(_run, self.data, self.gb_attrs, self.aggregations, self.result)

    def on_done(self, result: Result) -> None:
        self.result = result
        self.Outputs.data.send(result.result_table)

    def on_partial_result(self, result: Result) -> None:
        # store result in case the task is canceled and on_done is not called
        self.result = result

    def on_exception(self, ex: Exception):
        self.Error.unexpected_error(str(ex))

    ###################
    # Helper methods

    def get_selected_attributes(self):
        """Get select attributes in the table"""
        selection_model = self.agg_table_view.selectionModel()
        sel_rows = selection_model.selectedRows()
        vars_ = self.data.domain.variables + self.data.domain.metas
        return [vars_[index.row()] for index in sel_rows]

    def _set_gb_selection(self) -> None:
        """Set selection in groupby list according to self.gb_attrs"""
        sm = self.gb_attrs_view.selectionModel()
        values = self.gb_attrs_model[:]
        with disconnected(sm.selectionChanged, self.__gb_changed):
            for val in self.gb_attrs:
                index = values.index(val)
                model_index = self.gb_attrs_model.index(index, 0)
                sm.select(model_index, QItemSelectionModel.Select)

    @staticmethod
    def __aggregation_compatible(agg, attr):
        """Check a compatibility of aggregation with the variable"""
        return type(attr) in AGGREGATIONS[agg].types


if __name__ == "__main__":
    # pylint: disable=ungrouped-imports
    from orangewidget.utils.widgetpreview import WidgetPreview

    WidgetPreview(OWGroupBy).run(Table("iris"))

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