{
    "file_diffs": [
        {
            "old_file_content": "from typing import Optional, Callable, List, Union, Dict\nfrom collections import namedtuple\nfrom functools import singledispatch\n\nimport numpy as np\n\nfrom AnyQt.QtCore import Qt, QSortFilterProxyModel, QSize, QDateTime, \\\n    QModelIndex, Signal, QPoint, QRect, QEvent\nfrom AnyQt.QtGui import QStandardItemModel, QStandardItem, QIcon, QPainter, \\\n    QColor\nfrom AnyQt.QtWidgets import QLineEdit, QTableView, QSlider, \\\n    QComboBox, QStyledItemDelegate, QWidget, QDateTimeEdit, QHBoxLayout, \\\n    QDoubleSpinBox, QSizePolicy, QStyleOptionViewItem, QLabel, QMenu, QAction\n\nfrom orangewidget.gui import Slider\n\nfrom Orange.data import DiscreteVariable, ContinuousVariable, \\\n    TimeVariable, Table, StringVariable, Variable, Domain\nfrom Orange.widgets import gui\nfrom Orange.widgets.utils.itemmodels import TableModel\nfrom Orange.widgets.settings import Setting\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\nfrom Orange.widgets.widget import OWWidget, Input, Output, Msg\n\nVariableRole = next(gui.OrangeUserRole)\nValuesRole = next(gui.OrangeUserRole)\nValueRole = next(gui.OrangeUserRole)\n\n\nclass VariableEditor(QWidget):\n    valueChanged = Signal(float)\n\n    def __init__(self, parent: QWidget, callback: Callable):\n        super().__init__(parent)\n        layout = QHBoxLayout()\n        layout.setContentsMargins(6, 0, 6, 0)\n        layout.setAlignment(Qt.AlignLeft)\n        self.setLayout(layout)\n        self.valueChanged.connect(callback)\n\n    @property\n    def value(self) -> Union[int, float, str]:\n        return NotImplemented\n\n    @value.setter\n    def value(self, value: Union[float, str]):\n        raise NotImplementedError\n\n    def sizeHint(self):\n        return QSize(super().sizeHint().width(), 40)\n\n\nclass DiscreteVariableEditor(VariableEditor):\n    valueChanged = Signal(int)\n\n    def __init__(self, parent: QWidget, items: List[str], callback: Callable):\n        super().__init__(parent, callback)\n        self._combo = QComboBox(\n            parent,\n            maximumWidth=180,\n            sizePolicy=QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)\n        )\n        self._combo.addItems(items)\n        self._combo.currentIndexChanged.connect(self.valueChanged)\n        self.layout().addWidget(self._combo)\n\n    @property\n    def value(self) -> int:\n        return self._combo.currentIndex()\n\n    @value.setter\n    def value(self, value: float):\n        assert value == int(value)\n        self._combo.setCurrentIndex(int(value))\n\n\nclass ContinuousVariableEditor(VariableEditor):\n    MAX_FLOAT = 2147483647\n\n    def __init__(self, parent: QWidget, variable: ContinuousVariable,\n                 min_value: float, max_value: float, callback: Callable):\n        super().__init__(parent, callback)\n\n        if np.isnan(min_value) or np.isnan(max_value):\n            raise ValueError(\"Min/Max cannot be NaN.\")\n\n        n_decimals = variable.number_of_decimals\n        abs_max = max(abs(min_value), max_value)\n        if abs_max * 10 ** n_decimals > self.MAX_FLOAT:\n            n_decimals = int(np.log10(self.MAX_FLOAT / abs_max))\n\n        self._value: float = min_value\n        self._n_decimals: int = n_decimals\n        self._min_value: float = self.__round_value(min_value)\n        self._max_value: float = self.__round_value(max_value)\n\n        sp_spin = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)\n        sp_spin.setHorizontalStretch(1)\n        sp_slider = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)\n        sp_slider.setHorizontalStretch(5)\n        sp_edit = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)\n        sp_edit.setHorizontalStretch(1)\n\n        class DoubleSpinBox(QDoubleSpinBox):\n            def sizeHint(self) -> QSize:\n                size: QSize = super().sizeHint()\n                return QSize(size.width(), size.height() + 2)\n\n        self._spin = DoubleSpinBox(\n            parent,\n            value=self._min_value,\n            minimum=-np.inf,\n            maximum=np.inf,\n            singleStep=10 ** (-self._n_decimals),\n            decimals=self._n_decimals,\n            minimumWidth=70,\n            sizePolicy=sp_spin,\n        )\n        self._slider = Slider(\n            parent,\n            minimum=self.__map_to_slider(self._min_value),\n            maximum=self.__map_to_slider(self._max_value),\n            singleStep=1,\n            orientation=Qt.Horizontal,\n            sizePolicy=sp_slider,\n        )\n        self._label_min = QLabel(\n            parent,\n            text=variable.repr_val(min_value),\n            alignment=Qt.AlignRight,\n            minimumWidth=60,\n            sizePolicy=sp_edit,\n        )\n        self._label_max = QLabel(\n            parent,\n            text=variable.repr_val(max_value),\n            alignment=Qt.AlignLeft,\n            minimumWidth=60,\n            sizePolicy=sp_edit,\n        )\n\n        self._slider.valueChanged.connect(self._apply_slider_value)\n        self._spin.valueChanged.connect(self._apply_spin_value)\n\n        self.layout().addWidget(self._spin)\n        self.layout().addWidget(self._label_min)\n        self.layout().addWidget(self._slider)\n        self.layout().addWidget(self._label_max)\n\n        self.setFocusProxy(self._spin)\n\n        def deselect():\n            self._spin.lineEdit().deselect()\n            try:\n                self._spin.lineEdit().selectionChanged.disconnect(deselect)\n            except TypeError:\n                pass\n\n        # Invoking self.setFocusProxy(self._spin), causes the\n        # self._spin.lineEdit()s to have selected texts (focus is set to\n        # provide keyboard functionality, i.e.: pressing ESC after changing\n        # spinbox value). Since the spin text is selected only after the\n        # delegate draws it, it cannot be deselected during initialization.\n        # Therefore connect the deselect() function to\n        # self._spin.lineEdit().selectionChanged only for editor creation.\n        self._spin.lineEdit().selectionChanged.connect(deselect)\n\n        self._slider.installEventFilter(self)\n        self._spin.installEventFilter(self)\n\n    @property\n    def value(self) -> float:\n        return self.__round_value(self._value)\n\n    @value.setter\n    def value(self, value: float):\n        if self._value is None or self.__round_value(value) != self.value:\n            self._value = value\n            self.valueChanged.emit(self.value)\n            self._spin.setValue(self.value)\n            # prevent emitting self.valueChanged again, due to slider change\n            slider_value = self.__map_to_slider(self.value)\n            self._value = self.__map_from_slider(slider_value)\n            self._slider.setValue(slider_value)\n            self._value = value\n\n    def _apply_slider_value(self):\n        self.value = self.__map_from_slider(self._slider.value())\n\n    def _apply_spin_value(self):\n        self.value = self._spin.value()\n\n    def __round_value(self, value):\n        return round(value, self._n_decimals)\n\n    def __map_to_slider(self, value: float) -> int:\n        value = min(self._max_value, max(self._min_value, value))\n        return round(value * 10 ** self._n_decimals)\n\n    def __map_from_slider(self, value: int) -> float:\n        return value * 10 ** (-self._n_decimals)\n\n    def eventFilter(self, obj: Union[QSlider, QDoubleSpinBox], event: QEvent) \\\n            -> bool:\n        if event.type() == QEvent.Wheel:\n            return True\n        return super().eventFilter(obj, event)\n\n\nclass StringVariableEditor(VariableEditor):\n    valueChanged = Signal()\n\n    def __init__(self, parent: QWidget, callback: Callable):\n        super().__init__(parent, callback)\n        self._edit = QLineEdit(\n            parent,\n            sizePolicy=QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)\n        )\n        self._edit.textChanged.connect(self.valueChanged)\n        self.layout().addWidget(self._edit)\n        self.setFocusProxy(self._edit)\n\n    @property\n    def value(self) -> str:\n        return self._edit.text()\n\n    @value.setter\n    def value(self, value: str):\n        self._edit.setText(value)\n\n\nclass TimeVariableEditor(VariableEditor):\n    DATE_FORMAT = \"yyyy-MM-dd\"\n    TIME_FORMAT = \"hh:mm:ss\"\n\n    def __init__(self, parent: QWidget, variable: TimeVariable,\n                 callback: Callable):\n        super().__init__(parent, callback)\n        self._value: float = 0\n        self._variable: TimeVariable = variable\n\n        if variable.have_date and not variable.have_time:\n            self._format = TimeVariableEditor.DATE_FORMAT\n        elif not variable.have_date and variable.have_time:\n            self._format = TimeVariableEditor.TIME_FORMAT\n        else:\n            self._format = f\"{TimeVariableEditor.DATE_FORMAT} \" \\\n                           f\"{TimeVariableEditor.TIME_FORMAT}\"\n\n        class DateTimeEdit(QDateTimeEdit):\n            def sizeHint(self) -> QSize:\n                size: QSize = super().sizeHint()\n                return QSize(size.width(), size.height() + 2)\n\n        self._edit = DateTimeEdit(\n            parent,\n            dateTime=self.__map_to_datetime(self._value),\n            displayFormat=self._format,\n            sizePolicy=QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)\n        )\n        self._edit.dateTimeChanged.connect(self._apply_edit_value)\n\n        self.layout().addWidget(self._edit)\n        self.setFocusProxy(self._edit)\n\n        self._edit.installEventFilter(self)\n\n    @property\n    def value(self) -> float:\n        return self._value\n\n    @value.setter\n    def value(self, value: float):\n        if value != self.value:\n            self._value = value\n            self.valueChanged.emit(self.value)\n            self._edit.setDateTime(self.__map_to_datetime(self.value))\n\n    def _apply_edit_value(self):\n        self.value = self.__map_from_datetime(self._edit.dateTime())\n\n    def __map_from_datetime(self, date_time: QDateTime) -> float:\n        return self._variable.to_val(date_time.toString(self._format))\n\n    def __map_to_datetime(self, value: float) -> QDateTime:\n        return QDateTime.fromString(self._variable.repr_val(value),\n                                    self._format)\n\n    def eventFilter(self, obj: QDateTimeEdit, event: QEvent) -> bool:\n        if event.type() == QEvent.Wheel:\n            return True\n        return super().eventFilter(obj, event)\n\n\nclass VariableDelegate(QStyledItemDelegate):\n    def paint(self, painter: QPainter, option: QStyleOptionViewItem,\n              index: QModelIndex):\n        self.parent().view.openPersistentEditor(index)\n        super().paint(painter, option, index)\n\n    def createEditor(self, parent: QWidget, _: QStyleOptionViewItem,\n                     index: QModelIndex) -> VariableEditor:\n        variable = index.data(VariableRole)\n        values = index.data(ValuesRole)\n        return _create_editor(variable, values, parent, self._commit_data)\n\n    def _commit_data(self):\n        editor = self.sender()\n        assert isinstance(editor, VariableEditor)\n        self.commitData.emit(editor)\n\n    # pylint: disable=no-self-use\n    def setEditorData(self, editor: VariableEditor, index: QModelIndex):\n        editor.value = index.model().data(index, ValueRole)\n\n    # pylint: disable=no-self-use\n    def setModelData(self, editor: VariableEditor,\n                     model: QSortFilterProxyModel, index: QModelIndex):\n        model.setData(index, editor.value, ValueRole)\n\n    # pylint: disable=no-self-use\n    def updateEditorGeometry(self, editor: VariableEditor,\n                             option: QStyleOptionViewItem, _: QModelIndex):\n        rect: QRect = option.rect\n        if isinstance(editor, ContinuousVariableEditor):\n            width = editor.sizeHint().width()\n            if width > rect.width():\n                rect.setWidth(width)\n        editor.setGeometry(rect)\n\n    # pylint: disable=no-self-use\n    def sizeHint(self, _: QStyleOptionViewItem, index: QModelIndex) -> QSize:\n        return _create_editor(index.data(role=VariableRole), np.array([0]),\n                              None, lambda: 1).sizeHint()\n\n\n@singledispatch\ndef _create_editor(*_) -> VariableEditor:\n    raise NotImplementedError\n\n\n@_create_editor.register(DiscreteVariable)\ndef _(variable: DiscreteVariable, _: np.ndarray,\n      parent: QWidget, callback: Callable) -> DiscreteVariableEditor:\n    return DiscreteVariableEditor(parent, variable.values, callback)\n\n\n@_create_editor.register(ContinuousVariable)\ndef _(variable: ContinuousVariable, values: np.ndarray,\n      parent: QWidget, callback: Callable) -> ContinuousVariableEditor:\n    return ContinuousVariableEditor(parent, variable, np.nanmin(values),\n                                    np.nanmax(values), callback)\n\n\n@_create_editor.register(StringVariable)\ndef _(_: StringVariable, __: np.ndarray, parent: QWidget,\n      callback: Callable) -> StringVariableEditor:\n    return StringVariableEditor(parent, callback)\n\n\n@_create_editor.register(TimeVariable)\ndef _(variable: TimeVariable, _: np.ndarray,\n      parent: QWidget, callback: Callable) -> TimeVariableEditor:\n    return TimeVariableEditor(parent, variable, callback)\n\n\ndef majority(values: np.ndarray) -> int:\n    return np.bincount(values[~np.isnan(values)].astype(int)).argmax()\n\n\ndef disc_random(values: np.ndarray) -> int:\n    return np.random.randint(low=np.nanmin(values), high=np.nanmax(values) + 1)\n\n\ndef cont_random(values: np.ndarray) -> float:\n    return np.random.uniform(low=np.nanmin(values), high=np.nanmax(values))\n\n\nclass VariableItemModel(QStandardItemModel):\n    dataHasNanColumn = Signal()\n\n    # pylint: disable=dangerous-default-value\n    def set_data(self, data: Table, saved_values={}):\n        domain = data.domain\n        variables = [(TableModel.Attribute, a) for a in domain.attributes] + \\\n                    [(TableModel.ClassVar, c) for c in domain.class_vars] + \\\n                    [(TableModel.Meta, m) for m in domain.metas]\n        for place, variable in variables:\n            if variable.is_primitive():\n                values = data.get_column_view(variable)[0].astype(float)\n                if all(np.isnan(values)):\n                    self.dataHasNanColumn.emit()\n                    continue\n            else:\n                values = np.array([])\n            color = TableModel.ColorForRole.get(place)\n            self._add_row(variable, values, color,\n                          saved_values.get(variable.name))\n\n    def _add_row(self, variable: Variable, values: np.ndarray, color: QColor,\n                 saved_value: Optional[Union[int, float, str]]):\n        var_item = QStandardItem()\n        var_item.setData(variable.name, Qt.DisplayRole)\n        var_item.setToolTip(variable.name)\n        var_item.setIcon(self._variable_icon(variable))\n        var_item.setEditable(False)\n        if color:\n            var_item.setBackground(color)\n\n        control_item = QStandardItem()\n        control_item.setData(variable, VariableRole)\n        control_item.setData(values, ValuesRole)\n        if color:\n            control_item.setBackground(color)\n\n        value = self._default_for_variable(variable, values)\n        if saved_value is not None and not \\\n                (variable.is_discrete and saved_value >= len(variable.values)):\n            value = saved_value\n        control_item.setData(value, ValueRole)\n\n        self.appendRow([var_item, control_item])\n\n    @staticmethod\n    def _default_for_variable(variable: Variable, values: np.ndarray) \\\n            -> Union[float, int, str]:\n        if variable.is_continuous:\n            return round(np.nanmedian(values), variable.number_of_decimals)\n        elif variable.is_discrete:\n            return majority(values)\n        elif variable.is_string:\n            return \"\"\n        else:\n            raise NotImplementedError\n\n    @staticmethod\n    def _variable_icon(variable: Variable) -> QIcon:\n        if variable.is_discrete:\n            return gui.attributeIconDict[1]\n        elif variable.is_time:\n            return gui.attributeIconDict[4]\n        elif variable.is_continuous:\n            return gui.attributeIconDict[2]\n        elif variable.is_string:\n            return gui.attributeIconDict[3]\n        else:\n            return gui.attributeIconDict[-1]\n\n\nclass OWCreateInstance(OWWidget):\n    name = \"Create Instance\"\n    description = \"Interactively create a data instance from sample dataset.\"\n    icon = \"icons/CreateInstance.svg\"\n    category = \"Transform\"\n    keywords = [\"simulator\"]\n    priority = 2310\n\n    class Inputs:\n        data = Input(\"Data\", Table)\n        reference = Input(\"Reference\", Table)\n\n    class Outputs:\n        data = Output(\"Data\", Table)\n\n    class Information(OWWidget.Information):\n        nans_removed = Msg(\"Variables with only missing values were \"\n                           \"removed from the list.\")\n\n    want_main_area = False\n    ACTIONS = [\"median\", \"mean\", \"random\", \"input\"]\n    HEADER = [[\"name\", \"Variable\"],\n              [\"variable\", \"Value\"]]\n    Header = namedtuple(\n        \"header\", [tag for tag, _ in HEADER]\n    )(*range(len(HEADER)))\n\n    values: Dict[str, Union[float, str]] = Setting({}, schema_only=True)\n    append_to_data = Setting(True)\n    auto_commit = Setting(True)\n\n    def __init__(self):\n        super().__init__()\n        self.data: Optional[Table] = None\n        self.reference: Optional[Table] = None\n\n        self.filter_edit = QLineEdit(textChanged=self.__filter_edit_changed,\n                                     placeholderText=\"Filter...\")\n        self.view = QTableView(sortingEnabled=True,\n                               contextMenuPolicy=Qt.CustomContextMenu,\n                               selectionMode=QTableView.NoSelection)\n        self.view.customContextMenuRequested.connect(self.__menu_requested)\n        self.view.setItemDelegateForColumn(\n            self.Header.variable, VariableDelegate(self)\n        )\n        self.view.verticalHeader().hide()\n        self.view.horizontalHeader().setStretchLastSection(True)\n        self.view.horizontalHeader().setMaximumSectionSize(350)\n\n        self.model = VariableItemModel(self)\n        self.model.setHorizontalHeaderLabels([x for _, x in self.HEADER])\n        self.model.dataChanged.connect(self.__table_data_changed)\n        self.model.dataHasNanColumn.connect(self.Information.nans_removed)\n        self.proxy_model = QSortFilterProxyModel()\n        self.proxy_model.setFilterKeyColumn(-1)\n        self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive)\n        self.proxy_model.setSourceModel(self.model)\n        self.view.setModel(self.proxy_model)\n\n        vbox = gui.vBox(self.controlArea, box=True)\n        vbox.layout().addWidget(self.filter_edit)\n        vbox.layout().addWidget(self.view)\n\n        box = gui.hBox(vbox, objectName=\"buttonBox\")\n        gui.rubber(box)\n        for name in self.ACTIONS:\n            gui.button(\n                box, self, name.capitalize(),\n                lambda *args, fun=name: self._initialize_values(fun),\n                autoDefault=False\n            )\n        gui.rubber(box)\n\n        gui.checkBox(self.buttonsArea, self, \"append_to_data\",\n                     \"Append this instance to input data\",\n                     callback=self.commit.deferred)\n        gui.rubber(self.buttonsArea)\n        gui.auto_apply(self.buttonsArea, self, \"auto_commit\")\n\n        self.settingsAboutToBePacked.connect(self.pack_settings)\n\n    def __filter_edit_changed(self):\n        self.proxy_model.setFilterFixedString(self.filter_edit.text().strip())\n\n    def __table_data_changed(self):\n        self.commit.deferred()\n\n    def __menu_requested(self, point: QPoint):\n        index = self.view.indexAt(point)\n        model: QSortFilterProxyModel = index.model()\n        source_index = model.mapToSource(index)\n        menu = QMenu(self)\n        for action in self._create_actions(source_index):\n            menu.addAction(action)\n        menu.popup(self.view.viewport().mapToGlobal(point))\n\n    def _create_actions(self, index: QModelIndex) -> List[QAction]:\n        actions = []\n        for name in self.ACTIONS:\n            action = QAction(name.capitalize(), self)\n            action.triggered.connect(\n                lambda *args, fun=name: self._initialize_values(fun, [index])\n            )\n            actions.append(action)\n        return actions\n\n    def _initialize_values(self, fun: str, indices: List[QModelIndex] = None):\n        cont_fun = {\"median\": np.nanmedian,\n                    \"mean\": np.nanmean,\n                    \"random\": cont_random,\n                    \"input\": np.nanmean}.get(fun, NotImplemented)\n        disc_fun = {\"median\": majority,\n                    \"mean\": majority,\n                    \"random\": disc_random,\n                    \"input\": majority}.get(fun, NotImplemented)\n\n        if not self.data or fun == \"input\" and not self.reference:\n            return\n\n        self.model.dataChanged.disconnect(self.__table_data_changed)\n        rows = range(self.proxy_model.rowCount()) if indices is None else \\\n            [index.row() for index in indices]\n        for row in rows:\n            index = self.model.index(row, self.Header.variable)\n            variable = self.model.data(index, VariableRole)\n\n            if fun == \"input\":\n                if variable not in self.reference.domain:\n                    continue\n                values = self.reference.get_column_view(variable)[0]\n                if variable.is_primitive():\n                    values = values.astype(float)\n                    if all(np.isnan(values)):\n                        continue\n            else:\n                values = self.model.data(index, ValuesRole)\n\n            if variable.is_continuous:\n                value = cont_fun(values)\n                value = round(value, variable.number_of_decimals)\n            elif variable.is_discrete:\n                value = disc_fun(values)\n            elif variable.is_string:\n                value = \"\"\n            else:\n                raise NotImplementedError\n\n            self.model.setData(index, value, ValueRole)\n        self.model.dataChanged.connect(self.__table_data_changed)\n        self.commit.deferred()\n\n    @Inputs.data\n    def set_data(self, data: Table):\n        self.data = data\n        self._set_model_data()\n        self.commit.now()\n\n    def _set_model_data(self):\n        self.Information.nans_removed.clear()\n        self.model.removeRows(0, self.model.rowCount())\n        if not self.data:\n            return\n\n        self.model.set_data(self.data, self.values)\n        self.values = {}\n        self.view.horizontalHeader().setStretchLastSection(False)\n        self.view.resizeColumnsToContents()\n        self.view.resizeRowsToContents()\n        self.view.horizontalHeader().setStretchLastSection(True)\n\n    @Inputs.reference\n    def set_reference(self, data: Table):\n        self.reference = data\n\n    @gui.deferred\n    def commit(self):\n        output_data = None\n        if self.data:\n            output_data = self._create_data_from_values()\n            if self.append_to_data:\n                output_data = self._append_to_data(output_data)\n        self.Outputs.data.send(output_data)\n\n    def _create_data_from_values(self) -> Table:\n        data = Table.from_domain(self.data.domain, 1)\n        with data.unlocked():\n            data.name = \"created\"\n            if data.X.size:\n                data.X[:] = np.nan\n            if data.Y.size:\n                data.Y[:] = np.nan\n            for i, m in enumerate(self.data.domain.metas):\n                data.metas[:, i] = \"\" if m.is_string else np.nan\n\n            values = self._get_values()\n            for var_name, value in values.items():\n                data[:, var_name] = value\n        return data\n\n    def _append_to_data(self, data: Table) -> Table:\n        assert self.data\n        assert len(data) == 1\n\n        var = DiscreteVariable(\"Source ID\", values=(self.data.name, data.name))\n        data = Table.concatenate([self.data, data], axis=0)\n        domain = Domain(data.domain.attributes, data.domain.class_vars,\n                        data.domain.metas + (var,))\n        data = data.transform(domain)\n        with data.unlocked(data.metas):\n            data.metas[: len(self.data), -1] = 0\n            data.metas[len(self.data):, -1] = 1\n        return data\n\n    def _get_values(self) -> Dict[str, Union[str, float]]:\n        values = {}\n        for row in range(self.model.rowCount()):\n            index = self.model.index(row, self.Header.variable)\n            values[self.model.data(index, VariableRole).name] = \\\n                self.model.data(index, ValueRole)\n        return values\n\n    def send_report(self):\n        if not self.data:\n            return\n        self.report_domain(\"Input\", self.data.domain)\n        self.report_domain(\"Output\", self.data.domain)\n        items = []\n        values: Dict = self._get_values()\n        for var in self.data.domain.variables + self.data.domain.metas:\n            val = values.get(var.name, np.nan)\n            if var.is_primitive():\n                val = var.repr_val(val)\n            items.append([f\"{var.name}:\", val])\n        self.report_table(\"Values\", items)\n\n    @staticmethod\n    def sizeHint():\n        return QSize(600, 500)\n\n    def pack_settings(self):\n        self.values: Dict[str, Union[str, float]] = self._get_values()\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    table = Table(\"housing\")\n    WidgetPreview(OWCreateInstance).run(set_data=table,\n                                        set_reference=table[:1])\n",
            "new_file_content": "from typing import Optional, Callable, List, Union, Dict\nfrom collections import namedtuple\nfrom functools import singledispatch\n\nimport numpy as np\n\nfrom AnyQt.QtCore import Qt, QSortFilterProxyModel, QSize, QDateTime, \\\n    QModelIndex, Signal, QPoint, QRect, QEvent\nfrom AnyQt.QtGui import QStandardItemModel, QStandardItem, QIcon, QPainter, \\\n    QColor\nfrom AnyQt.QtWidgets import QLineEdit, QTableView, QSlider, \\\n    QComboBox, QStyledItemDelegate, QWidget, QDateTimeEdit, QHBoxLayout, \\\n    QDoubleSpinBox, QSizePolicy, QStyleOptionViewItem, QLabel, QMenu, QAction\n\nfrom orangewidget.gui import Slider\n\nfrom Orange.data import DiscreteVariable, ContinuousVariable, \\\n    TimeVariable, Table, StringVariable, Variable, Domain\nfrom Orange.data.util import get_unique_names\nfrom Orange.widgets import gui\nfrom Orange.widgets.utils.itemmodels import TableModel\nfrom Orange.widgets.settings import Setting\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\nfrom Orange.widgets.widget import OWWidget, Input, Output, Msg\n\nVariableRole = next(gui.OrangeUserRole)\nValuesRole = next(gui.OrangeUserRole)\nValueRole = next(gui.OrangeUserRole)\n\n\nclass VariableEditor(QWidget):\n    valueChanged = Signal(float)\n\n    def __init__(self, parent: QWidget, callback: Callable):\n        super().__init__(parent)\n        layout = QHBoxLayout()\n        layout.setContentsMargins(6, 0, 6, 0)\n        layout.setAlignment(Qt.AlignLeft)\n        self.setLayout(layout)\n        self.valueChanged.connect(callback)\n\n    @property\n    def value(self) -> Union[int, float, str]:\n        return NotImplemented\n\n    @value.setter\n    def value(self, value: Union[float, str]):\n        raise NotImplementedError\n\n    def sizeHint(self):\n        return QSize(super().sizeHint().width(), 40)\n\n\nclass DiscreteVariableEditor(VariableEditor):\n    valueChanged = Signal(int)\n\n    def __init__(self, parent: QWidget, items: List[str], callback: Callable):\n        super().__init__(parent, callback)\n        self._combo = QComboBox(\n            parent,\n            maximumWidth=180,\n            sizePolicy=QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)\n        )\n        self._combo.addItems(items)\n        self._combo.currentIndexChanged.connect(self.valueChanged)\n        self.layout().addWidget(self._combo)\n\n    @property\n    def value(self) -> int:\n        return self._combo.currentIndex()\n\n    @value.setter\n    def value(self, value: float):\n        assert value == int(value)\n        self._combo.setCurrentIndex(int(value))\n\n\nclass ContinuousVariableEditor(VariableEditor):\n    MAX_FLOAT = 2147483647\n\n    def __init__(self, parent: QWidget, variable: ContinuousVariable,\n                 min_value: float, max_value: float, callback: Callable):\n        super().__init__(parent, callback)\n\n        if np.isnan(min_value) or np.isnan(max_value):\n            raise ValueError(\"Min/Max cannot be NaN.\")\n\n        n_decimals = variable.number_of_decimals\n        abs_max = max(abs(min_value), max_value)\n        if abs_max * 10 ** n_decimals > self.MAX_FLOAT:\n            n_decimals = int(np.log10(self.MAX_FLOAT / abs_max))\n\n        self._value: float = min_value\n        self._n_decimals: int = n_decimals\n        self._min_value: float = self.__round_value(min_value)\n        self._max_value: float = self.__round_value(max_value)\n\n        sp_spin = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)\n        sp_spin.setHorizontalStretch(1)\n        sp_slider = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)\n        sp_slider.setHorizontalStretch(5)\n        sp_edit = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)\n        sp_edit.setHorizontalStretch(1)\n\n        class DoubleSpinBox(QDoubleSpinBox):\n            def sizeHint(self) -> QSize:\n                size: QSize = super().sizeHint()\n                return QSize(size.width(), size.height() + 2)\n\n        self._spin = DoubleSpinBox(\n            parent,\n            value=self._min_value,\n            minimum=-np.inf,\n            maximum=np.inf,\n            singleStep=10 ** (-self._n_decimals),\n            decimals=self._n_decimals,\n            minimumWidth=70,\n            sizePolicy=sp_spin,\n        )\n        self._slider = Slider(\n            parent,\n            minimum=self.__map_to_slider(self._min_value),\n            maximum=self.__map_to_slider(self._max_value),\n            singleStep=1,\n            orientation=Qt.Horizontal,\n            sizePolicy=sp_slider,\n        )\n        self._label_min = QLabel(\n            parent,\n            text=variable.repr_val(min_value),\n            alignment=Qt.AlignRight,\n            minimumWidth=60,\n            sizePolicy=sp_edit,\n        )\n        self._label_max = QLabel(\n            parent,\n            text=variable.repr_val(max_value),\n            alignment=Qt.AlignLeft,\n            minimumWidth=60,\n            sizePolicy=sp_edit,\n        )\n\n        self._slider.valueChanged.connect(self._apply_slider_value)\n        self._spin.valueChanged.connect(self._apply_spin_value)\n\n        self.layout().addWidget(self._spin)\n        self.layout().addWidget(self._label_min)\n        self.layout().addWidget(self._slider)\n        self.layout().addWidget(self._label_max)\n\n        self.setFocusProxy(self._spin)\n\n        def deselect():\n            self._spin.lineEdit().deselect()\n            try:\n                self._spin.lineEdit().selectionChanged.disconnect(deselect)\n            except TypeError:\n                pass\n\n        # Invoking self.setFocusProxy(self._spin), causes the\n        # self._spin.lineEdit()s to have selected texts (focus is set to\n        # provide keyboard functionality, i.e.: pressing ESC after changing\n        # spinbox value). Since the spin text is selected only after the\n        # delegate draws it, it cannot be deselected during initialization.\n        # Therefore connect the deselect() function to\n        # self._spin.lineEdit().selectionChanged only for editor creation.\n        self._spin.lineEdit().selectionChanged.connect(deselect)\n\n        self._slider.installEventFilter(self)\n        self._spin.installEventFilter(self)\n\n    @property\n    def value(self) -> float:\n        return self.__round_value(self._value)\n\n    @value.setter\n    def value(self, value: float):\n        if self._value is None or self.__round_value(value) != self.value:\n            self._value = value\n            self.valueChanged.emit(self.value)\n            self._spin.setValue(self.value)\n            # prevent emitting self.valueChanged again, due to slider change\n            slider_value = self.__map_to_slider(self.value)\n            self._value = self.__map_from_slider(slider_value)\n            self._slider.setValue(slider_value)\n            self._value = value\n\n    def _apply_slider_value(self):\n        self.value = self.__map_from_slider(self._slider.value())\n\n    def _apply_spin_value(self):\n        self.value = self._spin.value()\n\n    def __round_value(self, value):\n        return round(value, self._n_decimals)\n\n    def __map_to_slider(self, value: float) -> int:\n        value = min(self._max_value, max(self._min_value, value))\n        return round(value * 10 ** self._n_decimals)\n\n    def __map_from_slider(self, value: int) -> float:\n        return value * 10 ** (-self._n_decimals)\n\n    def eventFilter(self, obj: Union[QSlider, QDoubleSpinBox], event: QEvent) \\\n            -> bool:\n        if event.type() == QEvent.Wheel:\n            return True\n        return super().eventFilter(obj, event)\n\n\nclass StringVariableEditor(VariableEditor):\n    valueChanged = Signal()\n\n    def __init__(self, parent: QWidget, callback: Callable):\n        super().__init__(parent, callback)\n        self._edit = QLineEdit(\n            parent,\n            sizePolicy=QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)\n        )\n        self._edit.textChanged.connect(self.valueChanged)\n        self.layout().addWidget(self._edit)\n        self.setFocusProxy(self._edit)\n\n    @property\n    def value(self) -> str:\n        return self._edit.text()\n\n    @value.setter\n    def value(self, value: str):\n        self._edit.setText(value)\n\n\nclass TimeVariableEditor(VariableEditor):\n    DATE_FORMAT = \"yyyy-MM-dd\"\n    TIME_FORMAT = \"hh:mm:ss\"\n\n    def __init__(self, parent: QWidget, variable: TimeVariable,\n                 callback: Callable):\n        super().__init__(parent, callback)\n        self._value: float = 0\n        self._variable: TimeVariable = variable\n\n        if variable.have_date and not variable.have_time:\n            self._format = TimeVariableEditor.DATE_FORMAT\n        elif not variable.have_date and variable.have_time:\n            self._format = TimeVariableEditor.TIME_FORMAT\n        else:\n            self._format = f\"{TimeVariableEditor.DATE_FORMAT} \" \\\n                           f\"{TimeVariableEditor.TIME_FORMAT}\"\n\n        class DateTimeEdit(QDateTimeEdit):\n            def sizeHint(self) -> QSize:\n                size: QSize = super().sizeHint()\n                return QSize(size.width(), size.height() + 2)\n\n        self._edit = DateTimeEdit(\n            parent,\n            dateTime=self.__map_to_datetime(self._value),\n            displayFormat=self._format,\n            sizePolicy=QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)\n        )\n        self._edit.dateTimeChanged.connect(self._apply_edit_value)\n\n        self.layout().addWidget(self._edit)\n        self.setFocusProxy(self._edit)\n\n        self._edit.installEventFilter(self)\n\n    @property\n    def value(self) -> float:\n        return self._value\n\n    @value.setter\n    def value(self, value: float):\n        if value != self.value:\n            self._value = value\n            self.valueChanged.emit(self.value)\n            self._edit.setDateTime(self.__map_to_datetime(self.value))\n\n    def _apply_edit_value(self):\n        self.value = self.__map_from_datetime(self._edit.dateTime())\n\n    def __map_from_datetime(self, date_time: QDateTime) -> float:\n        return self._variable.to_val(date_time.toString(self._format))\n\n    def __map_to_datetime(self, value: float) -> QDateTime:\n        return QDateTime.fromString(self._variable.repr_val(value),\n                                    self._format)\n\n    def eventFilter(self, obj: QDateTimeEdit, event: QEvent) -> bool:\n        if event.type() == QEvent.Wheel:\n            return True\n        return super().eventFilter(obj, event)\n\n\nclass VariableDelegate(QStyledItemDelegate):\n    def paint(self, painter: QPainter, option: QStyleOptionViewItem,\n              index: QModelIndex):\n        self.parent().view.openPersistentEditor(index)\n        super().paint(painter, option, index)\n\n    def createEditor(self, parent: QWidget, _: QStyleOptionViewItem,\n                     index: QModelIndex) -> VariableEditor:\n        variable = index.data(VariableRole)\n        values = index.data(ValuesRole)\n        return _create_editor(variable, values, parent, self._commit_data)\n\n    def _commit_data(self):\n        editor = self.sender()\n        assert isinstance(editor, VariableEditor)\n        self.commitData.emit(editor)\n\n    # pylint: disable=no-self-use\n    def setEditorData(self, editor: VariableEditor, index: QModelIndex):\n        editor.value = index.model().data(index, ValueRole)\n\n    # pylint: disable=no-self-use\n    def setModelData(self, editor: VariableEditor,\n                     model: QSortFilterProxyModel, index: QModelIndex):\n        model.setData(index, editor.value, ValueRole)\n\n    # pylint: disable=no-self-use\n    def updateEditorGeometry(self, editor: VariableEditor,\n                             option: QStyleOptionViewItem, _: QModelIndex):\n        rect: QRect = option.rect\n        if isinstance(editor, ContinuousVariableEditor):\n            width = editor.sizeHint().width()\n            if width > rect.width():\n                rect.setWidth(width)\n        editor.setGeometry(rect)\n\n    # pylint: disable=no-self-use\n    def sizeHint(self, _: QStyleOptionViewItem, index: QModelIndex) -> QSize:\n        return _create_editor(index.data(role=VariableRole), np.array([0]),\n                              None, lambda: 1).sizeHint()\n\n\n@singledispatch\ndef _create_editor(*_) -> VariableEditor:\n    raise NotImplementedError\n\n\n@_create_editor.register(DiscreteVariable)\ndef _(variable: DiscreteVariable, _: np.ndarray,\n      parent: QWidget, callback: Callable) -> DiscreteVariableEditor:\n    return DiscreteVariableEditor(parent, variable.values, callback)\n\n\n@_create_editor.register(ContinuousVariable)\ndef _(variable: ContinuousVariable, values: np.ndarray,\n      parent: QWidget, callback: Callable) -> ContinuousVariableEditor:\n    return ContinuousVariableEditor(parent, variable, np.nanmin(values),\n                                    np.nanmax(values), callback)\n\n\n@_create_editor.register(StringVariable)\ndef _(_: StringVariable, __: np.ndarray, parent: QWidget,\n      callback: Callable) -> StringVariableEditor:\n    return StringVariableEditor(parent, callback)\n\n\n@_create_editor.register(TimeVariable)\ndef _(variable: TimeVariable, _: np.ndarray,\n      parent: QWidget, callback: Callable) -> TimeVariableEditor:\n    return TimeVariableEditor(parent, variable, callback)\n\n\ndef majority(values: np.ndarray) -> int:\n    return np.bincount(values[~np.isnan(values)].astype(int)).argmax()\n\n\ndef disc_random(values: np.ndarray) -> int:\n    return np.random.randint(low=np.nanmin(values), high=np.nanmax(values) + 1)\n\n\ndef cont_random(values: np.ndarray) -> float:\n    return np.random.uniform(low=np.nanmin(values), high=np.nanmax(values))\n\n\nclass VariableItemModel(QStandardItemModel):\n    dataHasNanColumn = Signal()\n\n    # pylint: disable=dangerous-default-value\n    def set_data(self, data: Table, saved_values={}):\n        domain = data.domain\n        variables = [(TableModel.Attribute, a) for a in domain.attributes] + \\\n                    [(TableModel.ClassVar, c) for c in domain.class_vars] + \\\n                    [(TableModel.Meta, m) for m in domain.metas]\n        for place, variable in variables:\n            if variable.is_primitive():\n                values = data.get_column_view(variable)[0].astype(float)\n                if all(np.isnan(values)):\n                    self.dataHasNanColumn.emit()\n                    continue\n            else:\n                values = np.array([])\n            color = TableModel.ColorForRole.get(place)\n            self._add_row(variable, values, color,\n                          saved_values.get(variable.name))\n\n    def _add_row(self, variable: Variable, values: np.ndarray, color: QColor,\n                 saved_value: Optional[Union[int, float, str]]):\n        var_item = QStandardItem()\n        var_item.setData(variable.name, Qt.DisplayRole)\n        var_item.setToolTip(variable.name)\n        var_item.setIcon(self._variable_icon(variable))\n        var_item.setEditable(False)\n        if color:\n            var_item.setBackground(color)\n\n        control_item = QStandardItem()\n        control_item.setData(variable, VariableRole)\n        control_item.setData(values, ValuesRole)\n        if color:\n            control_item.setBackground(color)\n\n        value = self._default_for_variable(variable, values)\n        if saved_value is not None and not \\\n                (variable.is_discrete and saved_value >= len(variable.values)):\n            value = saved_value\n        control_item.setData(value, ValueRole)\n\n        self.appendRow([var_item, control_item])\n\n    @staticmethod\n    def _default_for_variable(variable: Variable, values: np.ndarray) \\\n            -> Union[float, int, str]:\n        if variable.is_continuous:\n            return round(np.nanmedian(values), variable.number_of_decimals)\n        elif variable.is_discrete:\n            return majority(values)\n        elif variable.is_string:\n            return \"\"\n        else:\n            raise NotImplementedError\n\n    @staticmethod\n    def _variable_icon(variable: Variable) -> QIcon:\n        if variable.is_discrete:\n            return gui.attributeIconDict[1]\n        elif variable.is_time:\n            return gui.attributeIconDict[4]\n        elif variable.is_continuous:\n            return gui.attributeIconDict[2]\n        elif variable.is_string:\n            return gui.attributeIconDict[3]\n        else:\n            return gui.attributeIconDict[-1]\n\n\nclass OWCreateInstance(OWWidget):\n    name = \"Create Instance\"\n    description = \"Interactively create a data instance from sample dataset.\"\n    icon = \"icons/CreateInstance.svg\"\n    category = \"Transform\"\n    keywords = [\"simulator\"]\n    priority = 2310\n\n    class Inputs:\n        data = Input(\"Data\", Table)\n        reference = Input(\"Reference\", Table)\n\n    class Outputs:\n        data = Output(\"Data\", Table)\n\n    class Information(OWWidget.Information):\n        nans_removed = Msg(\"Variables with only missing values were \"\n                           \"removed from the list.\")\n\n    want_main_area = False\n    ACTIONS = [\"median\", \"mean\", \"random\", \"input\"]\n    HEADER = [[\"name\", \"Variable\"],\n              [\"variable\", \"Value\"]]\n    Header = namedtuple(\n        \"header\", [tag for tag, _ in HEADER]\n    )(*range(len(HEADER)))\n\n    values: Dict[str, Union[float, str]] = Setting({}, schema_only=True)\n    append_to_data = Setting(True)\n    auto_commit = Setting(True)\n\n    def __init__(self):\n        super().__init__()\n        self.data: Optional[Table] = None\n        self.reference: Optional[Table] = None\n\n        self.filter_edit = QLineEdit(textChanged=self.__filter_edit_changed,\n                                     placeholderText=\"Filter...\")\n        self.view = QTableView(sortingEnabled=True,\n                               contextMenuPolicy=Qt.CustomContextMenu,\n                               selectionMode=QTableView.NoSelection)\n        self.view.customContextMenuRequested.connect(self.__menu_requested)\n        self.view.setItemDelegateForColumn(\n            self.Header.variable, VariableDelegate(self)\n        )\n        self.view.verticalHeader().hide()\n        self.view.horizontalHeader().setStretchLastSection(True)\n        self.view.horizontalHeader().setMaximumSectionSize(350)\n\n        self.model = VariableItemModel(self)\n        self.model.setHorizontalHeaderLabels([x for _, x in self.HEADER])\n        self.model.dataChanged.connect(self.__table_data_changed)\n        self.model.dataHasNanColumn.connect(self.Information.nans_removed)\n        self.proxy_model = QSortFilterProxyModel()\n        self.proxy_model.setFilterKeyColumn(-1)\n        self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive)\n        self.proxy_model.setSourceModel(self.model)\n        self.view.setModel(self.proxy_model)\n\n        vbox = gui.vBox(self.controlArea, box=True)\n        vbox.layout().addWidget(self.filter_edit)\n        vbox.layout().addWidget(self.view)\n\n        box = gui.hBox(vbox, objectName=\"buttonBox\")\n        gui.rubber(box)\n        for name in self.ACTIONS:\n            gui.button(\n                box, self, name.capitalize(),\n                lambda *args, fun=name: self._initialize_values(fun),\n                autoDefault=False\n            )\n        gui.rubber(box)\n\n        gui.checkBox(self.buttonsArea, self, \"append_to_data\",\n                     \"Append this instance to input data\",\n                     callback=self.commit.deferred)\n        gui.rubber(self.buttonsArea)\n        gui.auto_apply(self.buttonsArea, self, \"auto_commit\")\n\n        self.settingsAboutToBePacked.connect(self.pack_settings)\n\n    def __filter_edit_changed(self):\n        self.proxy_model.setFilterFixedString(self.filter_edit.text().strip())\n\n    def __table_data_changed(self):\n        self.commit.deferred()\n\n    def __menu_requested(self, point: QPoint):\n        index = self.view.indexAt(point)\n        model: QSortFilterProxyModel = index.model()\n        source_index = model.mapToSource(index)\n        menu = QMenu(self)\n        for action in self._create_actions(source_index):\n            menu.addAction(action)\n        menu.popup(self.view.viewport().mapToGlobal(point))\n\n    def _create_actions(self, index: QModelIndex) -> List[QAction]:\n        actions = []\n        for name in self.ACTIONS:\n            action = QAction(name.capitalize(), self)\n            action.triggered.connect(\n                lambda *args, fun=name: self._initialize_values(fun, [index])\n            )\n            actions.append(action)\n        return actions\n\n    def _initialize_values(self, fun: str, indices: List[QModelIndex] = None):\n        cont_fun = {\"median\": np.nanmedian,\n                    \"mean\": np.nanmean,\n                    \"random\": cont_random,\n                    \"input\": np.nanmean}.get(fun, NotImplemented)\n        disc_fun = {\"median\": majority,\n                    \"mean\": majority,\n                    \"random\": disc_random,\n                    \"input\": majority}.get(fun, NotImplemented)\n\n        if not self.data or fun == \"input\" and not self.reference:\n            return\n\n        self.model.dataChanged.disconnect(self.__table_data_changed)\n        rows = range(self.proxy_model.rowCount()) if indices is None else \\\n            [index.row() for index in indices]\n        for row in rows:\n            index = self.model.index(row, self.Header.variable)\n            variable = self.model.data(index, VariableRole)\n\n            if fun == \"input\":\n                if variable not in self.reference.domain:\n                    continue\n                values = self.reference.get_column_view(variable)[0]\n                if variable.is_primitive():\n                    values = values.astype(float)\n                    if all(np.isnan(values)):\n                        continue\n            else:\n                values = self.model.data(index, ValuesRole)\n\n            if variable.is_continuous:\n                value = cont_fun(values)\n                value = round(value, variable.number_of_decimals)\n            elif variable.is_discrete:\n                value = disc_fun(values)\n            elif variable.is_string:\n                value = \"\"\n            else:\n                raise NotImplementedError\n\n            self.model.setData(index, value, ValueRole)\n        self.model.dataChanged.connect(self.__table_data_changed)\n        self.commit.deferred()\n\n    @Inputs.data\n    def set_data(self, data: Table):\n        self.data = data\n        self._set_model_data()\n        self.commit.now()\n\n    def _set_model_data(self):\n        self.Information.nans_removed.clear()\n        self.model.removeRows(0, self.model.rowCount())\n        if not self.data:\n            return\n\n        self.model.set_data(self.data, self.values)\n        self.values = {}\n        self.view.horizontalHeader().setStretchLastSection(False)\n        self.view.resizeColumnsToContents()\n        self.view.resizeRowsToContents()\n        self.view.horizontalHeader().setStretchLastSection(True)\n\n    @Inputs.reference\n    def set_reference(self, data: Table):\n        self.reference = data\n\n    @gui.deferred\n    def commit(self):\n        output_data = None\n        if self.data:\n            output_data = self._create_data_from_values()\n            if self.append_to_data:\n                output_data = self._append_to_data(output_data)\n        self.Outputs.data.send(output_data)\n\n    def _create_data_from_values(self) -> Table:\n        data = Table.from_domain(self.data.domain, 1)\n        with data.unlocked():\n            data.name = \"created\"\n            if data.X.size:\n                data.X[:] = np.nan\n            if data.Y.size:\n                data.Y[:] = np.nan\n            for i, m in enumerate(self.data.domain.metas):\n                data.metas[:, i] = \"\" if m.is_string else np.nan\n\n            values = self._get_values()\n            for var_name, value in values.items():\n                data[:, var_name] = value\n        return data\n\n    def _append_to_data(self, instance: Table) -> Table:\n        assert self.data\n        assert len(instance) == 1\n        source_label = \"__source_widget\"\n\n        data = Table.concatenate([self.data, instance], axis=0)\n        for var in self.data.domain.variables + self.data.domain.metas:\n            if var.attributes.get(source_label) == OWCreateInstance:\n                with data.unlocked():\n                    data.get_column_view(var)[0][-1] = 1\n                return data\n\n        name = get_unique_names(self.data.domain, \"Source ID\")\n        var = DiscreteVariable(name, values=(self.data.name, instance.name))\n        var.attributes[source_label] = OWCreateInstance\n        domain = Domain(data.domain.attributes, data.domain.class_vars,\n                        data.domain.metas + (var,))\n        data = data.transform(domain)\n        with data.unlocked(data.metas):\n            data.metas[: len(self.data), -1] = 0\n            data.metas[len(self.data):, -1] = 1\n        return data\n\n    def _get_values(self) -> Dict[str, Union[str, float]]:\n        values = {}\n        for row in range(self.model.rowCount()):\n            index = self.model.index(row, self.Header.variable)\n            values[self.model.data(index, VariableRole).name] = \\\n                self.model.data(index, ValueRole)\n        return values\n\n    def send_report(self):\n        if not self.data:\n            return\n        self.report_domain(\"Input\", self.data.domain)\n        self.report_domain(\"Output\", self.data.domain)\n        items = []\n        values: Dict = self._get_values()\n        for var in self.data.domain.variables + self.data.domain.metas:\n            val = values.get(var.name, np.nan)\n            if var.is_primitive():\n                val = var.repr_val(val)\n            items.append([f\"{var.name}:\", val])\n        self.report_table(\"Values\", items)\n\n    @staticmethod\n    def sizeHint():\n        return QSize(600, 500)\n\n    def pack_settings(self):\n        self.values: Dict[str, Union[str, float]] = self._get_values()\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    table = Table(\"housing\")\n    WidgetPreview(OWCreateInstance).run(set_data=table,\n                                        set_reference=table[:1])\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/data/owcreateinstance.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "d2fc8db97",
                "new_commit_hash": "53bb1e311",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/data/owcreateinstance.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/data/owcreateinstance.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 16,
                            "length": 6
                        },
                        "new_range": {
                            "start": 16,
                            "length": 7
                        },
                        "section": "from orangewidget.gui import Slider"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "from Orange.data import DiscreteVariable, ContinuousVariable, \\",
                                "type": "context"
                            },
                            {
                                "content": "    TimeVariable, Table, StringVariable, Variable, Domain",
                                "type": "context"
                            },
                            {
                                "content": "from Orange.data.util import get_unique_names",
                                "type": "added"
                            },
                            {
                                "content": "from Orange.widgets import gui",
                                "type": "context"
                            },
                            {
                                "content": "from Orange.widgets.utils.itemmodels import TableModel",
                                "type": "context"
                            },
                            {
                                "content": "from Orange.widgets.settings import Setting",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [
                        {
                            "file_name": "Orange/widgets/data/owcreateinstance.py",
                            "type": "statement",
                            "name": "",
                            "content": "from Orange.data.util import get_unique_names",
                            "ast_type_str": "ImportFrom",
                            "start_lineno": 19,
                            "end_lineno": 19,
                            "parent": null
                        }
                    ],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 646,
                            "length": 12
                        },
                        "new_range": {
                            "start": 647,
                            "length": 21
                        },
                        "section": "class OWCreateInstance(OWWidget):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "                data[:, var_name] = value",
                                "type": "context"
                            },
                            {
                                "content": "        return data",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def _append_to_data(self, data: Table) -> Table:",
                                "type": "deleted"
                            },
                            {
                                "content": "    def _append_to_data(self, instance: Table) -> Table:",
                                "type": "added"
                            },
                            {
                                "content": "        assert self.data",
                                "type": "context"
                            },
                            {
                                "content": "        assert len(data) == 1",
                                "type": "deleted"
                            },
                            {
                                "content": "        assert len(instance) == 1",
                                "type": "added"
                            },
                            {
                                "content": "        source_label = \"__source_widget\"",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        var = DiscreteVariable(\"Source ID\", values=(self.data.name, data.name))",
                                "type": "deleted"
                            },
                            {
                                "content": "        data = Table.concatenate([self.data, data], axis=0)",
                                "type": "deleted"
                            },
                            {
                                "content": "        data = Table.concatenate([self.data, instance], axis=0)",
                                "type": "added"
                            },
                            {
                                "content": "        for var in self.data.domain.variables + self.data.domain.metas:",
                                "type": "added"
                            },
                            {
                                "content": "            if var.attributes.get(source_label) == OWCreateInstance:",
                                "type": "added"
                            },
                            {
                                "content": "                with data.unlocked():",
                                "type": "added"
                            },
                            {
                                "content": "                    data.get_column_view(var)[0][-1] = 1",
                                "type": "added"
                            },
                            {
                                "content": "                return data",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        name = get_unique_names(self.data.domain, \"Source ID\")",
                                "type": "added"
                            },
                            {
                                "content": "        var = DiscreteVariable(name, values=(self.data.name, instance.name))",
                                "type": "added"
                            },
                            {
                                "content": "        var.attributes[source_label] = OWCreateInstance",
                                "type": "added"
                            },
                            {
                                "content": "        domain = Domain(data.domain.attributes, data.domain.class_vars,",
                                "type": "context"
                            },
                            {
                                "content": "                        data.domain.metas + (var,))",
                                "type": "context"
                            },
                            {
                                "content": "        data = data.transform(domain)",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/owcreateinstance.py",
                            "type": "class",
                            "name": "OWCreateInstance",
                            "content": "class OWCreateInstance(OWWidget):\n    name = \"Create Instance\"\n    description = \"Interactively create a data instance from sample dataset.\"\n    icon = \"icons/CreateInstance.svg\"\n    category = \"Transform\"\n    keywords = [\"simulator\"]\n    priority = 2310\n\n    class Inputs:\n        data = Input(\"Data\", Table)\n        reference = Input(\"Reference\", Table)\n\n    class Outputs:\n        data = Output(\"Data\", Table)\n\n    class Information(OWWidget.Information):\n        nans_removed = Msg(\"Variables with only missing values were \"\n                           \"removed from the list.\")\n\n    want_main_area = False\n    ACTIONS = [\"median\", \"mean\", \"random\", \"input\"]\n    HEADER = [[\"name\", \"Variable\"],\n              [\"variable\", \"Value\"]]\n    Header = namedtuple(\n        \"header\", [tag for tag, _ in HEADER]\n    )(*range(len(HEADER)))\n\n    values: Dict[str, Union[float, str]] = Setting({}, schema_only=True)\n    append_to_data = Setting(True)\n    auto_commit = Setting(True)\n\n    def __init__(self):\n        super().__init__()\n        self.data: Optional[Table] = None\n        self.reference: Optional[Table] = None\n\n        self.filter_edit = QLineEdit(textChanged=self.__filter_edit_changed,\n                                     placeholderText=\"Filter...\")\n        self.view = QTableView(sortingEnabled=True,\n                               contextMenuPolicy=Qt.CustomContextMenu,\n                               selectionMode=QTableView.NoSelection)\n        self.view.customContextMenuRequested.connect(self.__menu_requested)\n        self.view.setItemDelegateForColumn(\n            self.Header.variable, VariableDelegate(self)\n        )\n        self.view.verticalHeader().hide()\n        self.view.horizontalHeader().setStretchLastSection(True)\n        self.view.horizontalHeader().setMaximumSectionSize(350)\n\n        self.model = VariableItemModel(self)\n        self.model.setHorizontalHeaderLabels([x for _, x in self.HEADER])\n        self.model.dataChanged.connect(self.__table_data_changed)\n        self.model.dataHasNanColumn.connect(self.Information.nans_removed)\n        self.proxy_model = QSortFilterProxyModel()\n        self.proxy_model.setFilterKeyColumn(-1)\n        self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive)\n        self.proxy_model.setSourceModel(self.model)\n        self.view.setModel(self.proxy_model)\n\n        vbox = gui.vBox(self.controlArea, box=True)\n        vbox.layout().addWidget(self.filter_edit)\n        vbox.layout().addWidget(self.view)\n\n        box = gui.hBox(vbox, objectName=\"buttonBox\")\n        gui.rubber(box)\n        for name in self.ACTIONS:\n            gui.button(\n                box, self, name.capitalize(),\n                lambda *args, fun=name: self._initialize_values(fun),\n                autoDefault=False\n            )\n        gui.rubber(box)\n\n        gui.checkBox(self.buttonsArea, self, \"append_to_data\",\n                     \"Append this instance to input data\",\n                     callback=self.commit.deferred)\n        gui.rubber(self.buttonsArea)\n        gui.auto_apply(self.buttonsArea, self, \"auto_commit\")\n\n        self.settingsAboutToBePacked.connect(self.pack_settings)\n\n    def __filter_edit_changed(self):\n        self.proxy_model.setFilterFixedString(self.filter_edit.text().strip())\n\n    def __table_data_changed(self):\n        self.commit.deferred()\n\n    def __menu_requested(self, point: QPoint):\n        index = self.view.indexAt(point)\n        model: QSortFilterProxyModel = index.model()\n        source_index = model.mapToSource(index)\n        menu = QMenu(self)\n        for action in self._create_actions(source_index):\n            menu.addAction(action)\n        menu.popup(self.view.viewport().mapToGlobal(point))\n\n    def _create_actions(self, index: QModelIndex) -> List[QAction]:\n        actions = []\n        for name in self.ACTIONS:\n            action = QAction(name.capitalize(), self)\n            action.triggered.connect(\n                lambda *args, fun=name: self._initialize_values(fun, [index])\n            )\n            actions.append(action)\n        return actions\n\n    def _initialize_values(self, fun: str, indices: List[QModelIndex] = None):\n        cont_fun = {\"median\": np.nanmedian,\n                    \"mean\": np.nanmean,\n                    \"random\": cont_random,\n                    \"input\": np.nanmean}.get(fun, NotImplemented)\n        disc_fun = {\"median\": majority,\n                    \"mean\": majority,\n                    \"random\": disc_random,\n                    \"input\": majority}.get(fun, NotImplemented)\n\n        if not self.data or fun == \"input\" and not self.reference:\n            return\n\n        self.model.dataChanged.disconnect(self.__table_data_changed)\n        rows = range(self.proxy_model.rowCount()) if indices is None else \\\n            [index.row() for index in indices]\n        for row in rows:\n            index = self.model.index(row, self.Header.variable)\n            variable = self.model.data(index, VariableRole)\n\n            if fun == \"input\":\n                if variable not in self.reference.domain:\n                    continue\n                values = self.reference.get_column_view(variable)[0]\n                if variable.is_primitive():\n                    values = values.astype(float)\n                    if all(np.isnan(values)):\n                        continue\n            else:\n                values = self.model.data(index, ValuesRole)\n\n            if variable.is_continuous:\n                value = cont_fun(values)\n                value = round(value, variable.number_of_decimals)\n            elif variable.is_discrete:\n                value = disc_fun(values)\n            elif variable.is_string:\n                value = \"\"\n            else:\n                raise NotImplementedError\n\n            self.model.setData(index, value, ValueRole)\n        self.model.dataChanged.connect(self.__table_data_changed)\n        self.commit.deferred()\n\n    @Inputs.data\n    def set_data(self, data: Table):\n        self.data = data\n        self._set_model_data()\n        self.commit.now()\n\n    def _set_model_data(self):\n        self.Information.nans_removed.clear()\n        self.model.removeRows(0, self.model.rowCount())\n        if not self.data:\n            return\n\n        self.model.set_data(self.data, self.values)\n        self.values = {}\n        self.view.horizontalHeader().setStretchLastSection(False)\n        self.view.resizeColumnsToContents()\n        self.view.resizeRowsToContents()\n        self.view.horizontalHeader().setStretchLastSection(True)\n\n    @Inputs.reference\n    def set_reference(self, data: Table):\n        self.reference = data\n\n    @gui.deferred\n    def commit(self):\n        output_data = None\n        if self.data:\n            output_data = self._create_data_from_values()\n            if self.append_to_data:\n                output_data = self._append_to_data(output_data)\n        self.Outputs.data.send(output_data)\n\n    def _create_data_from_values(self) -> Table:\n        data = Table.from_domain(self.data.domain, 1)\n        with data.unlocked():\n            data.name = \"created\"\n            if data.X.size:\n                data.X[:] = np.nan\n            if data.Y.size:\n                data.Y[:] = np.nan\n            for i, m in enumerate(self.data.domain.metas):\n                data.metas[:, i] = \"\" if m.is_string else np.nan\n\n            values = self._get_values()\n            for var_name, value in values.items():\n                data[:, var_name] = value\n        return data\n\n    def _append_to_data(self, data: Table) -> Table:\n        assert self.data\n        assert len(data) == 1\n\n        var = DiscreteVariable(\"Source ID\", values=(self.data.name, data.name))\n        data = Table.concatenate([self.data, data], axis=0)\n        domain = Domain(data.domain.attributes, data.domain.class_vars,\n                        data.domain.metas + (var,))\n        data = data.transform(domain)\n        with data.unlocked(data.metas):\n            data.metas[: len(self.data), -1] = 0\n            data.metas[len(self.data):, -1] = 1\n        return data\n\n    def _get_values(self) -> Dict[str, Union[str, float]]:\n        values = {}\n        for row in range(self.model.rowCount()):\n            index = self.model.index(row, self.Header.variable)\n            values[self.model.data(index, VariableRole).name] = \\\n                self.model.data(index, ValueRole)\n        return values\n\n    def send_report(self):\n        if not self.data:\n            return\n        self.report_domain(\"Input\", self.data.domain)\n        self.report_domain(\"Output\", self.data.domain)\n        items = []\n        values: Dict = self._get_values()\n        for var in self.data.domain.variables + self.data.domain.metas:\n            val = values.get(var.name, np.nan)\n            if var.is_primitive():\n                val = var.repr_val(val)\n            items.append([f\"{var.name}:\", val])\n        self.report_table(\"Values\", items)\n\n    @staticmethod\n    def sizeHint():\n        return QSize(600, 500)\n\n    def pack_settings(self):\n        self.values: Dict[str, Union[str, float]] = self._get_values()",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 450,
                            "end_lineno": 690,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/widgets/data/owcreateinstance.py",
                            "type": "method",
                            "name": "OWCreateInstance._append_to_data",
                            "content": "class OWCreateInstance(OWWidget):\n    name = \"Create Instance\"\n    description = \"Interactively create a data instance from sample dataset.\"\n    icon = \"icons/CreateInstance.svg\"\n    category = \"Transform\"\n    keywords = [\"simulator\"]\n    priority = 2310\n\n    class Inputs:\n        data = Input(\"Data\", Table)\n        reference = Input(\"Reference\", Table)\n\n    class Outputs:\n        data = Output(\"Data\", Table)\n\n    class Information(OWWidget.Information):\n        nans_removed = Msg(\"Variables with only missing values were \"\n                           \"removed from the list.\")\n\n    want_main_area = False\n    ACTIONS = [\"median\", \"mean\", \"random\", \"input\"]\n    HEADER = [[\"name\", \"Variable\"],\n              [\"variable\", \"Value\"]]\n    Header = namedtuple(\n        \"header\", [tag for tag, _ in HEADER]\n    )(*range(len(HEADER)))\n\n    values: Dict[str, Union[float, str]] = Setting({}, schema_only=True)\n    append_to_data = Setting(True)\n    auto_commit = Setting(True)\n\n    def __init__(self):\n        super().__init__()\n        self.data: Optional[Table] = None\n        self.reference: Optional[Table] = None\n\n        self.filter_edit = QLineEdit(textChanged=self.__filter_edit_changed,\n                                     placeholderText=\"Filter...\")\n        self.view = QTableView(sortingEnabled=True,\n                               contextMenuPolicy=Qt.CustomContextMenu,\n                               selectionMode=QTableView.NoSelection)\n        self.view.customContextMenuRequested.connect(self.__menu_requested)\n        self.view.setItemDelegateForColumn(\n            self.Header.variable, VariableDelegate(self)\n        )\n        self.view.verticalHeader().hide()\n        self.view.horizontalHeader().setStretchLastSection(True)\n        self.view.horizontalHeader().setMaximumSectionSize(350)\n\n        self.model = VariableItemModel(self)\n        self.model.setHorizontalHeaderLabels([x for _, x in self.HEADER])\n        self.model.dataChanged.connect(self.__table_data_changed)\n        self.model.dataHasNanColumn.connect(self.Information.nans_removed)\n        self.proxy_model = QSortFilterProxyModel()\n        self.proxy_model.setFilterKeyColumn(-1)\n        self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive)\n        self.proxy_model.setSourceModel(self.model)\n        self.view.setModel(self.proxy_model)\n\n        vbox = gui.vBox(self.controlArea, box=True)\n        vbox.layout().addWidget(self.filter_edit)\n        vbox.layout().addWidget(self.view)\n\n        box = gui.hBox(vbox, objectName=\"buttonBox\")\n        gui.rubber(box)\n        for name in self.ACTIONS:\n            gui.button(\n                box, self, name.capitalize(),\n                lambda *args, fun=name: self._initialize_values(fun),\n                autoDefault=False\n            )\n        gui.rubber(box)\n\n        gui.checkBox(self.buttonsArea, self, \"append_to_data\",\n                     \"Append this instance to input data\",\n                     callback=self.commit.deferred)\n        gui.rubber(self.buttonsArea)\n        gui.auto_apply(self.buttonsArea, self, \"auto_commit\")\n\n        self.settingsAboutToBePacked.connect(self.pack_settings)\n\n    def __filter_edit_changed(self):\n        self.proxy_model.setFilterFixedString(self.filter_edit.text().strip())\n\n    def __table_data_changed(self):\n        self.commit.deferred()\n\n    def __menu_requested(self, point: QPoint):\n        index = self.view.indexAt(point)\n        model: QSortFilterProxyModel = index.model()\n        source_index = model.mapToSource(index)\n        menu = QMenu(self)\n        for action in self._create_actions(source_index):\n            menu.addAction(action)\n        menu.popup(self.view.viewport().mapToGlobal(point))\n\n    def _create_actions(self, index: QModelIndex) -> List[QAction]:\n        actions = []\n        for name in self.ACTIONS:\n            action = QAction(name.capitalize(), self)\n            action.triggered.connect(\n                lambda *args, fun=name: self._initialize_values(fun, [index])\n            )\n            actions.append(action)\n        return actions\n\n    def _initialize_values(self, fun: str, indices: List[QModelIndex] = None):\n        cont_fun = {\"median\": np.nanmedian,\n                    \"mean\": np.nanmean,\n                    \"random\": cont_random,\n                    \"input\": np.nanmean}.get(fun, NotImplemented)\n        disc_fun = {\"median\": majority,\n                    \"mean\": majority,\n                    \"random\": disc_random,\n                    \"input\": majority}.get(fun, NotImplemented)\n\n        if not self.data or fun == \"input\" and not self.reference:\n            return\n\n        self.model.dataChanged.disconnect(self.__table_data_changed)\n        rows = range(self.proxy_model.rowCount()) if indices is None else \\\n            [index.row() for index in indices]\n        for row in rows:\n            index = self.model.index(row, self.Header.variable)\n            variable = self.model.data(index, VariableRole)\n\n            if fun == \"input\":\n                if variable not in self.reference.domain:\n                    continue\n                values = self.reference.get_column_view(variable)[0]\n                if variable.is_primitive():\n                    values = values.astype(float)\n                    if all(np.isnan(values)):\n                        continue\n            else:\n                values = self.model.data(index, ValuesRole)\n\n            if variable.is_continuous:\n                value = cont_fun(values)\n                value = round(value, variable.number_of_decimals)\n            elif variable.is_discrete:\n                value = disc_fun(values)\n            elif variable.is_string:\n                value = \"\"\n            else:\n                raise NotImplementedError\n\n            self.model.setData(index, value, ValueRole)\n        self.model.dataChanged.connect(self.__table_data_changed)\n        self.commit.deferred()\n\n    @Inputs.data\n    def set_data(self, data: Table):\n        self.data = data\n        self._set_model_data()\n        self.commit.now()\n\n    def _set_model_data(self):\n        self.Information.nans_removed.clear()\n        self.model.removeRows(0, self.model.rowCount())\n        if not self.data:\n            return\n\n        self.model.set_data(self.data, self.values)\n        self.values = {}\n        self.view.horizontalHeader().setStretchLastSection(False)\n        self.view.resizeColumnsToContents()\n        self.view.resizeRowsToContents()\n        self.view.horizontalHeader().setStretchLastSection(True)\n\n    @Inputs.reference\n    def set_reference(self, data: Table):\n        self.reference = data\n\n    @gui.deferred\n    def commit(self):\n        output_data = None\n        if self.data:\n            output_data = self._create_data_from_values()\n            if self.append_to_data:\n                output_data = self._append_to_data(output_data)\n        self.Outputs.data.send(output_data)\n\n    def _create_data_from_values(self) -> Table:\n        data = Table.from_domain(self.data.domain, 1)\n        with data.unlocked():\n            data.name = \"created\"\n            if data.X.size:\n                data.X[:] = np.nan\n            if data.Y.size:\n                data.Y[:] = np.nan\n            for i, m in enumerate(self.data.domain.metas):\n                data.metas[:, i] = \"\" if m.is_string else np.nan\n\n            values = self._get_values()\n            for var_name, value in values.items():\n                data[:, var_name] = value\n        return data\n\n    def _append_to_data(self, data: Table) -> Table:\n        assert self.data\n        assert len(data) == 1\n\n        var = DiscreteVariable(\"Source ID\", values=(self.data.name, data.name))\n        data = Table.concatenate([self.data, data], axis=0)\n        domain = Domain(data.domain.attributes, data.domain.class_vars,\n                        data.domain.metas + (var,))\n        data = data.transform(domain)\n        with data.unlocked(data.metas):\n            data.metas[: len(self.data), -1] = 0\n            data.metas[len(self.data):, -1] = 1\n        return data\n\n    def _get_values(self) -> Dict[str, Union[str, float]]:\n        values = {}\n        for row in range(self.model.rowCount()):\n            index = self.model.index(row, self.Header.variable)\n            values[self.model.data(index, VariableRole).name] = \\\n                self.model.data(index, ValueRole)\n        return values\n\n    def send_report(self):\n        if not self.data:\n            return\n        self.report_domain(\"Input\", self.data.domain)\n        self.report_domain(\"Output\", self.data.domain)\n        items = []\n        values: Dict = self._get_values()\n        for var in self.data.domain.variables + self.data.domain.metas:\n            val = values.get(var.name, np.nan)\n            if var.is_primitive():\n                val = var.repr_val(val)\n            items.append([f\"{var.name}:\", val])\n        self.report_table(\"Values\", items)\n\n    @staticmethod\n    def sizeHint():\n        return QSize(600, 500)\n\n    def pack_settings(self):\n        self.values: Dict[str, Union[str, float]] = self._get_values()",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 649,
                            "end_lineno": 661,
                            "parent": {
                                "file_name": "Orange/widgets/data/owcreateinstance.py",
                                "type": "class",
                                "name": "OWCreateInstance",
                                "content": "class OWCreateInstance(OWWidget):\n    name = \"Create Instance\"\n    description = \"Interactively create a data instance from sample dataset.\"\n    icon = \"icons/CreateInstance.svg\"\n    category = \"Transform\"\n    keywords = [\"simulator\"]\n    priority = 2310\n\n    class Inputs:\n        data = Input(\"Data\", Table)\n        reference = Input(\"Reference\", Table)\n\n    class Outputs:\n        data = Output(\"Data\", Table)\n\n    class Information(OWWidget.Information):\n        nans_removed = Msg(\"Variables with only missing values were \"\n                           \"removed from the list.\")\n\n    want_main_area = False\n    ACTIONS = [\"median\", \"mean\", \"random\", \"input\"]\n    HEADER = [[\"name\", \"Variable\"],\n              [\"variable\", \"Value\"]]\n    Header = namedtuple(\n        \"header\", [tag for tag, _ in HEADER]\n    )(*range(len(HEADER)))\n\n    values: Dict[str, Union[float, str]] = Setting({}, schema_only=True)\n    append_to_data = Setting(True)\n    auto_commit = Setting(True)\n\n    def __init__(self):\n        super().__init__()\n        self.data: Optional[Table] = None\n        self.reference: Optional[Table] = None\n\n        self.filter_edit = QLineEdit(textChanged=self.__filter_edit_changed,\n                                     placeholderText=\"Filter...\")\n        self.view = QTableView(sortingEnabled=True,\n                               contextMenuPolicy=Qt.CustomContextMenu,\n                               selectionMode=QTableView.NoSelection)\n        self.view.customContextMenuRequested.connect(self.__menu_requested)\n        self.view.setItemDelegateForColumn(\n            self.Header.variable, VariableDelegate(self)\n        )\n        self.view.verticalHeader().hide()\n        self.view.horizontalHeader().setStretchLastSection(True)\n        self.view.horizontalHeader().setMaximumSectionSize(350)\n\n        self.model = VariableItemModel(self)\n        self.model.setHorizontalHeaderLabels([x for _, x in self.HEADER])\n        self.model.dataChanged.connect(self.__table_data_changed)\n        self.model.dataHasNanColumn.connect(self.Information.nans_removed)\n        self.proxy_model = QSortFilterProxyModel()\n        self.proxy_model.setFilterKeyColumn(-1)\n        self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive)\n        self.proxy_model.setSourceModel(self.model)\n        self.view.setModel(self.proxy_model)\n\n        vbox = gui.vBox(self.controlArea, box=True)\n        vbox.layout().addWidget(self.filter_edit)\n        vbox.layout().addWidget(self.view)\n\n        box = gui.hBox(vbox, objectName=\"buttonBox\")\n        gui.rubber(box)\n        for name in self.ACTIONS:\n            gui.button(\n                box, self, name.capitalize(),\n                lambda *args, fun=name: self._initialize_values(fun),\n                autoDefault=False\n            )\n        gui.rubber(box)\n\n        gui.checkBox(self.buttonsArea, self, \"append_to_data\",\n                     \"Append this instance to input data\",\n                     callback=self.commit.deferred)\n        gui.rubber(self.buttonsArea)\n        gui.auto_apply(self.buttonsArea, self, \"auto_commit\")\n\n        self.settingsAboutToBePacked.connect(self.pack_settings)\n\n    def __filter_edit_changed(self):\n        self.proxy_model.setFilterFixedString(self.filter_edit.text().strip())\n\n    def __table_data_changed(self):\n        self.commit.deferred()\n\n    def __menu_requested(self, point: QPoint):\n        index = self.view.indexAt(point)\n        model: QSortFilterProxyModel = index.model()\n        source_index = model.mapToSource(index)\n        menu = QMenu(self)\n        for action in self._create_actions(source_index):\n            menu.addAction(action)\n        menu.popup(self.view.viewport().mapToGlobal(point))\n\n    def _create_actions(self, index: QModelIndex) -> List[QAction]:\n        actions = []\n        for name in self.ACTIONS:\n            action = QAction(name.capitalize(), self)\n            action.triggered.connect(\n                lambda *args, fun=name: self._initialize_values(fun, [index])\n            )\n            actions.append(action)\n        return actions\n\n    def _initialize_values(self, fun: str, indices: List[QModelIndex] = None):\n        cont_fun = {\"median\": np.nanmedian,\n                    \"mean\": np.nanmean,\n                    \"random\": cont_random,\n                    \"input\": np.nanmean}.get(fun, NotImplemented)\n        disc_fun = {\"median\": majority,\n                    \"mean\": majority,\n                    \"random\": disc_random,\n                    \"input\": majority}.get(fun, NotImplemented)\n\n        if not self.data or fun == \"input\" and not self.reference:\n            return\n\n        self.model.dataChanged.disconnect(self.__table_data_changed)\n        rows = range(self.proxy_model.rowCount()) if indices is None else \\\n            [index.row() for index in indices]\n        for row in rows:\n            index = self.model.index(row, self.Header.variable)\n            variable = self.model.data(index, VariableRole)\n\n            if fun == \"input\":\n                if variable not in self.reference.domain:\n                    continue\n                values = self.reference.get_column_view(variable)[0]\n                if variable.is_primitive():\n                    values = values.astype(float)\n                    if all(np.isnan(values)):\n                        continue\n            else:\n                values = self.model.data(index, ValuesRole)\n\n            if variable.is_continuous:\n                value = cont_fun(values)\n                value = round(value, variable.number_of_decimals)\n            elif variable.is_discrete:\n                value = disc_fun(values)\n            elif variable.is_string:\n                value = \"\"\n            else:\n                raise NotImplementedError\n\n            self.model.setData(index, value, ValueRole)\n        self.model.dataChanged.connect(self.__table_data_changed)\n        self.commit.deferred()\n\n    @Inputs.data\n    def set_data(self, data: Table):\n        self.data = data\n        self._set_model_data()\n        self.commit.now()\n\n    def _set_model_data(self):\n        self.Information.nans_removed.clear()\n        self.model.removeRows(0, self.model.rowCount())\n        if not self.data:\n            return\n\n        self.model.set_data(self.data, self.values)\n        self.values = {}\n        self.view.horizontalHeader().setStretchLastSection(False)\n        self.view.resizeColumnsToContents()\n        self.view.resizeRowsToContents()\n        self.view.horizontalHeader().setStretchLastSection(True)\n\n    @Inputs.reference\n    def set_reference(self, data: Table):\n        self.reference = data\n\n    @gui.deferred\n    def commit(self):\n        output_data = None\n        if self.data:\n            output_data = self._create_data_from_values()\n            if self.append_to_data:\n                output_data = self._append_to_data(output_data)\n        self.Outputs.data.send(output_data)\n\n    def _create_data_from_values(self) -> Table:\n        data = Table.from_domain(self.data.domain, 1)\n        with data.unlocked():\n            data.name = \"created\"\n            if data.X.size:\n                data.X[:] = np.nan\n            if data.Y.size:\n                data.Y[:] = np.nan\n            for i, m in enumerate(self.data.domain.metas):\n                data.metas[:, i] = \"\" if m.is_string else np.nan\n\n            values = self._get_values()\n            for var_name, value in values.items():\n                data[:, var_name] = value\n        return data\n\n    def _append_to_data(self, data: Table) -> Table:\n        assert self.data\n        assert len(data) == 1\n\n        var = DiscreteVariable(\"Source ID\", values=(self.data.name, data.name))\n        data = Table.concatenate([self.data, data], axis=0)\n        domain = Domain(data.domain.attributes, data.domain.class_vars,\n                        data.domain.metas + (var,))\n        data = data.transform(domain)\n        with data.unlocked(data.metas):\n            data.metas[: len(self.data), -1] = 0\n            data.metas[len(self.data):, -1] = 1\n        return data\n\n    def _get_values(self) -> Dict[str, Union[str, float]]:\n        values = {}\n        for row in range(self.model.rowCount()):\n            index = self.model.index(row, self.Header.variable)\n            values[self.model.data(index, VariableRole).name] = \\\n                self.model.data(index, ValueRole)\n        return values\n\n    def send_report(self):\n        if not self.data:\n            return\n        self.report_domain(\"Input\", self.data.domain)\n        self.report_domain(\"Output\", self.data.domain)\n        items = []\n        values: Dict = self._get_values()\n        for var in self.data.domain.variables + self.data.domain.metas:\n            val = values.get(var.name, np.nan)\n            if var.is_primitive():\n                val = var.repr_val(val)\n            items.append([f\"{var.name}:\", val])\n        self.report_table(\"Values\", items)\n\n    @staticmethod\n    def sizeHint():\n        return QSize(600, 500)\n\n    def pack_settings(self):\n        self.values: Dict[str, Union[str, float]] = self._get_values()",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 450,
                                "end_lineno": 690,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "# pylint: disable=missing-docstring,protected-access\nfrom unittest.mock import Mock\n\nimport numpy as np\n\nfrom AnyQt.QtCore import QDateTime, QDate, QTime, QPoint, QObject\nfrom AnyQt.QtWidgets import QWidget, QLineEdit, QStyleOptionViewItem, QMenu, \\\n    QPushButton\n\nfrom orangewidget.tests.base import GuiTest\n\nfrom Orange.data import Table, ContinuousVariable, Domain, DiscreteVariable, \\\n    TimeVariable\nfrom Orange.widgets.data.owcreateinstance import OWCreateInstance, \\\n    DiscreteVariableEditor, ContinuousVariableEditor, StringVariableEditor, \\\n    TimeVariableEditor, VariableDelegate, VariableItemModel, ValueRole\nfrom Orange.widgets.tests.base import WidgetTest, datasets\n\n\nclass TestOWCreateInstance(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWCreateInstance)\n        self.data = Table(\"iris\")\n\n    def test_output(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(False)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 1)\n        self.assertEqual(output.name, \"created\")\n        self.assertEqual(output.domain, self.data.domain)\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X, array)\n\n    def test_output_append_data(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(True)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n\n        np.testing.assert_array_equal(output.X[:150], self.data.X)\n        np.testing.assert_array_equal(output.Y[:150], self.data.Y)\n        array = np.zeros((150, 1), dtype=object)\n        np.testing.assert_array_equal(output.metas[:150], array)\n\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X[150:], array)\n        np.testing.assert_array_equal(output.Y[150:], np.array([0]))\n        np.testing.assert_array_equal(output.metas[150:], np.array([[1]]))\n\n        self.assertEqual(output.domain.attributes, self.data.domain.attributes)\n        self.assertEqual(output.domain.class_vars, self.data.domain.class_vars)\n        self.assertIn(\"Source ID\", [m.name for m in output.domain.metas])\n        self.assertTupleEqual(output.domain.metas[0].values,\n                              (\"iris\", \"created\"))\n\n    def _get_init_buttons(self, widget=None):\n        if not widget:\n            widget = self.widget\n        return widget.findChild(QObject, \"buttonBox\").findChildren(QPushButton)\n\n    def test_initialize_buttons(self):\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output = self.get_output(self.widget.Outputs.data).copy()\n\n        buttons = self._get_init_buttons()\n\n        buttons[3].click()  # Input\n        output_input = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_input, self.data[:1])\n\n        buttons[0].click()  # Median\n        output_median = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_median, output)\n\n        buttons[1].click()  # Mean\n        output_mean = self.get_output(self.widget.Outputs.data)\n        with output.unlocked():\n            output.X = np.round(np.mean(self.data.X, axis=0), 1).reshape(1, 4)\n        self.assert_table_equal(output_mean, output)\n\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assertTrue((self.data.X.max(axis=0) >= output_random.X).all())\n        self.assertTrue((self.data.X.min(axis=0) <= output_random.X).all())\n\n        self.send_signal(self.widget.Inputs.data, self.data[9:10])\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, self.data[9:10])\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        buttons[3].click()  # Input\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, output)\n\n    def test_initialize_buttons_commit_once(self):\n        self.widget.commit.deferred = self.widget.commit.now = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_table(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertEqual(self.widget.view.model().rowCount(), 5)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertEqual(self.widget.view.model().rowCount(), 18)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertEqual(self.widget.view.model().rowCount(), 0)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n    def test_table_data_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        index = self.widget.model.index(0, 1)\n        self.widget.model.setData(index, 7, role=ValueRole)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(output.X[150, 0], 7)\n\n    def test_datasets(self):\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n\n    def test_missing_values(self):\n        domain = Domain([ContinuousVariable(\"c\")],\n                        class_vars=[DiscreteVariable(\"m\", (\"a\", \"b\"))])\n        data = Table(domain, np.array([[np.nan], [np.nan]]),\n                     np.array([np.nan, np.nan]))\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output, data[:1])\n        self.assertTrue(self.widget.Information.nans_removed.is_shown())\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Information.nans_removed.is_shown())\n\n    def test_missing_values_reference(self):\n        reference = self.data[:1].copy()\n        with reference.unlocked():\n            reference[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, reference)\n        output1 = self.get_output(self.widget.Outputs.data)\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_saved_workflow(self):\n        data = self.data\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        buttons = self._get_init_buttons()\n        buttons[2].click()  # Random\n        output1 = self.get_output(self.widget.Outputs.data)\n\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        widget = self.create_widget(OWCreateInstance, stored_settings=settings)\n        self.send_signal(widget.Inputs.data, data, widget=widget)\n        output2 = self.get_output(widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_commit_once(self):\n        self.widget.commit.now = self.widget.commit.deferred = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.commit.deferred.assert_called_once()\n\n        self.widget.commit.deferred.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_context_menu(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output1 = self.get_output(self.widget.Outputs.data)\n        self.widget.view.customContextMenuRequested.emit(QPoint(0, 0))\n        menu = [w for w in self.widget.children() if isinstance(w, QMenu)][0]\n        self.assertEqual(len(menu.actions()), 4)\n\n        menu.actions()[3].trigger()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        np.testing.assert_array_equal(output2.X[:, 1:], output1.X[:, 1:])\n        np.testing.assert_array_equal(output2.X[150:, :1], self.data.X[:1, :1])\n\n    def test_report(self):\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.send_report()\n\n    def test_sparse(self):\n        data = self.data.to_sparse()\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.reference, data)\n\n\nclass TestDiscreteVariableEditor(GuiTest):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        cls.parent = QWidget()\n\n    def setUp(self):\n        self.callback = Mock()\n        self.editor = DiscreteVariableEditor(\n            self.parent, [\"Foo\", \"Bar\"], self.callback\n        )\n\n    def test_init(self):\n        self.assertEqual(self.editor.value, 0)\n        self.assertEqual(self.editor._combo.currentText(), \"Foo\")\n        self.callback.assert_not_called()\n\n    def test_edit(self):\n        \"\"\" Edit combo by user. \"\"\"\n        self.editor._combo.setCurrentText(\"Bar\")\n        self.assertEqual(self.editor.value, 1)\n        self.assertEqual(self.editor._combo.currentText(), \"Bar\")\n        self.callback.assert_called_once()\n\n    def test_set_value(self):\n        \"\"\" Programmatically set combo box value. \"\"\"\n        self.editor.value = 1\n        self.assertEqual(self.editor.value, 1)\n        self.assertEqual(self.editor._combo.currentText(), \"Bar\")\n        self.callback.assert_called_once()\n\n\nclass TestContinuousVariableEditor(GuiTest):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        cls.parent = QWidget()\n\n    def setUp(self):\n        self.callback = Mock()\n        data = Table(\"iris\")\n        values = data.get_column_view(data.domain[0])[0]\n        self.min_value = np.min(values)\n        self.max_value = np.max(values)\n        self.editor = ContinuousVariableEditor(\n            self.parent, data.domain[0], self.min_value,\n            self.max_value, self.callback\n        )\n\n    def test_init(self):\n        self.assertEqual(self.editor.value, self.min_value)\n        self.assertEqual(self.editor._slider.value(), self.min_value * 10)\n        self.assertEqual(self.editor._spin.value(), self.min_value)\n        self.callback.assert_not_called()\n\n    def test_edit_slider(self):\n        \"\"\" Edit slider by user. \"\"\"\n        self.editor._slider.setValue(int(self.max_value * 10))\n        self.assertEqual(self.editor.value, self.max_value)\n        self.assertEqual(self.editor._slider.value(), self.max_value * 10)\n        self.assertEqual(self.editor._spin.value(), self.max_value)\n        self.callback.assert_called_once()\n\n        self.callback.reset_mock()\n        value = self.min_value + (self.max_value - self.min_value) / 2\n        self.editor._slider.setValue(int(value * 10))\n        self.assertEqual(self.editor.value, value)\n        self.assertEqual(self.editor._slider.value(), value * 10)\n        self.assertEqual(self.editor._spin.value(), value)\n        self.callback.assert_called_once()\n\n    def test_edit_spin(self):\n        \"\"\" Edit spin by user. \"\"\"\n        self.editor._spin.setValue(self.max_value)\n        self.assertEqual(self.editor.value, self.max_value)\n        self.assertEqual(self.editor._slider.value(), self.max_value * 10)\n        self.assertEqual(self.editor._spin.value(), self.max_value)\n        self.callback.assert_called_once()\n\n        self.callback.reset_mock()\n        self.editor._spin.setValue(self.max_value + 1)\n        self.assertEqual(self.editor.value, self.max_value + 1)\n        self.assertEqual(self.editor._slider.value(), self.max_value * 10)\n        self.assertEqual(self.editor._spin.value(), self.max_value + 1)\n        self.callback.assert_called_once()\n\n        self.callback.reset_mock()\n        value = self.min_value + (self.max_value - self.min_value) / 2\n        self.editor._spin.setValue(value)\n        self.assertEqual(self.editor.value, value)\n        self.assertEqual(self.editor._slider.value(), value * 10)\n        self.assertEqual(self.editor._spin.value(), value)\n        self.callback.assert_called_once()\n\n    def test_set_value(self):\n        \"\"\" Programmatically set slider/spin value. \"\"\"\n        self.editor.value = -2\n        self.assertEqual(self.editor._slider.value(), self.min_value * 10)\n        self.assertEqual(self.editor._spin.value(), -2)\n        self.assertEqual(self.editor.value, -2)\n        self.callback.assert_called_once()\n\n        self.callback.reset_mock()\n        value = self.min_value + (self.max_value - self.min_value) / 4\n        self.editor.value = value\n        self.assertEqual(self.editor._slider.value(), value * 10)\n        self.assertEqual(self.editor._spin.value(), value)\n        self.assertEqual(self.editor.value, value)\n        self.callback.assert_called_once()\n\n    def test_missing_values(self):\n        var = ContinuousVariable(\"var\")\n        self.assertRaises(ValueError, ContinuousVariableEditor, self.parent,\n                          var, np.nan, np.nan, Mock())\n\n    def test_overflow(self):\n        var = ContinuousVariable(\"var\", number_of_decimals=10)\n        editor = ContinuousVariableEditor(\n            self.parent, var, -100000, 1, self.callback\n        )\n        self.assertLess(editor._n_decimals, 10)\n\n    def test_spin_selection_after_init(self):\n        edit: QLineEdit = self.editor._spin.lineEdit()\n        edit.selectAll()\n        self.assertEqual(edit.selectedText(), \"\")\n        self.assertIs(self.editor.focusProxy(), edit.parent())\n\n\nclass TestStringVariableEditor(GuiTest):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        cls.parent = QWidget()\n\n    def setUp(self):\n        self.callback = Mock()\n        self.editor = StringVariableEditor(self.parent, self.callback)\n\n    def test_init(self):\n        self.assertEqual(self.editor.value, \"\")\n        self.assertEqual(self.editor._edit.text(), \"\")\n        self.callback.assert_not_called()\n\n    def test_edit(self):\n        \"\"\" Set lineedit by user. \"\"\"\n        self.editor._edit.setText(\"Foo\")\n        self.assertEqual(self.editor.value, \"Foo\")\n        self.assertEqual(self.editor._edit.text(), \"Foo\")\n        self.callback.assert_called_once()\n\n    def test_set_value(self):\n        \"\"\" Programmatically set lineedit value. \"\"\"\n        self.editor.value = \"Foo\"\n        self.assertEqual(self.editor.value, \"Foo\")\n        self.assertEqual(self.editor._edit.text(), \"Foo\")\n        self.callback.assert_called_once()\n\n\ndef _datetime(y, m, d) -> QDateTime:\n    return QDateTime(QDate(y, m, d), QTime(0, 0))\n\n\nclass TestTimeVariableEditor(GuiTest):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        cls.parent = QWidget()\n\n    def setUp(self):\n        self.callback = Mock()\n        self.editor = TimeVariableEditor(\n            self.parent, TimeVariable(\"var\", have_date=1), self.callback\n        )\n\n    def test_init(self):\n        self.assertEqual(self.editor.value, 0)\n        self.assertEqual(self.editor._edit.dateTime(), _datetime(1970, 1, 1))\n        self.callback.assert_not_called()\n\n    def test_edit(self):\n        \"\"\" Edit datetimeedit by user. \"\"\"\n        datetime = _datetime(2001, 9, 9,)\n        self.editor._edit.setDateTime(datetime)\n        self.assertEqual(self.editor.value, 999993600)\n        self.assertEqual(self.editor._edit.dateTime(), datetime)\n        self.callback.assert_called_once()\n\n    def test_set_value(self):\n        \"\"\" Programmatically set datetimeedit value. \"\"\"\n        value = 999993600\n        self.editor.value = value\n        self.assertEqual(self.editor._edit.dateTime(), _datetime(2001, 9, 9))\n        self.assertEqual(self.editor.value, value)\n        self.callback.assert_called_once()\n\n    def test_have_date_have_time(self):\n        callback = Mock()\n        editor = TimeVariableEditor(\n            self.parent, TimeVariable(\"var\", have_date=1, have_time=1),\n            callback\n        )\n        self.assertEqual(editor.value, 0)\n        self.assertEqual(self.editor._edit.dateTime(), _datetime(1970, 1, 1))\n        self.callback.assert_not_called()\n\n        datetime = QDateTime(QDate(2001, 9, 9), QTime(1, 2, 3))\n        editor._edit.setDateTime(datetime)\n        self.assertEqual(editor._edit.dateTime(), datetime)\n        self.assertEqual(editor.value, 999993600 + 3723)\n        callback.assert_called_once()\n\n    def test_have_time(self):\n        callback = Mock()\n        editor = TimeVariableEditor(\n            self.parent, TimeVariable(\"var\", have_time=1), callback\n        )\n        self.assertEqual(editor.value, 0)\n        self.assertEqual(self.editor._edit.dateTime(), _datetime(1970, 1, 1))\n        self.callback.assert_not_called()\n\n        datetime = QDateTime(QDate(1900, 1, 1), QTime(1, 2, 3))\n        editor._edit.setDateTime(datetime)\n        self.assertEqual(editor._edit.dateTime(), datetime)\n        self.assertEqual(editor.value, 3723)\n        callback.assert_called_once()\n\n    def test_no_date_no_time(self):\n        callback = Mock()\n        editor = TimeVariableEditor(self.parent, TimeVariable(\"var\"), callback)\n        self.assertEqual(editor.value, 0)\n        self.assertEqual(self.editor._edit.dateTime(), _datetime(1970, 1, 1))\n        self.callback.assert_not_called()\n\n        datetime = QDateTime(QDate(2001, 9, 9), QTime(1, 2, 3))\n        editor._edit.setDateTime(datetime)\n        self.assertEqual(editor._edit.dateTime(), datetime)\n        self.assertEqual(editor.value, 999993600 + 3723)\n        callback.assert_called_once()\n\n\nclass TestVariableDelegate(GuiTest):\n    def setUp(self):\n        self.data = Table(\"iris\")\n        self.model = model = VariableItemModel()\n        model.set_data(self.data)\n        widget = OWCreateInstance()\n        self.delegate = VariableDelegate(widget)\n        self.parent = QWidget()\n        self.opt = QStyleOptionViewItem()\n\n    def test_create_editor(self):\n        index = self.model.index(0, 1)\n        editor = self.delegate.createEditor(self.parent, self.opt, index)\n        self.assertIsInstance(editor, ContinuousVariableEditor)\n\n        index = self.model.index(4, 1)\n        editor = self.delegate.createEditor(self.parent, self.opt, index)\n        self.assertIsInstance(editor, DiscreteVariableEditor)\n\n    def test_set_editor_data(self):\n        index = self.model.index(0, 1)\n        editor = self.delegate.createEditor(self.parent, self.opt, index)\n        self.delegate.setEditorData(editor, index)\n        self.assertEqual(editor.value, np.median(self.data.X[:, 0]))\n\n    def test_set_model_data(self):\n        index = self.model.index(0, 1)\n        editor = self.delegate.createEditor(self.parent, self.opt, index)\n        editor.value = 7.5\n        self.delegate.setModelData(editor, self.model, index)\n        self.assertEqual(self.model.data(index, ValueRole), 7.5)\n\n    def test_editor_geometry(self):\n        index = self.model.index(0, 1)\n        editor = self.delegate.createEditor(self.parent, self.opt, index)\n        self.delegate.updateEditorGeometry(editor, self.opt, index)\n        self.assertGreaterEqual(editor.geometry().width(),\n                                self.opt.rect.width())\n\n        size = self.delegate.sizeHint(self.opt, index)\n        self.assertEqual(size.width(), editor.geometry().width())\n        self.assertEqual(size.height(), 40)\n\n\nif __name__ == \"__main__\":\n    import unittest\n    unittest.main()\n",
            "new_file_content": "# pylint: disable=missing-docstring,protected-access\nfrom unittest.mock import Mock\n\nimport numpy as np\n\nfrom AnyQt.QtCore import QDateTime, QDate, QTime, QPoint, QObject\nfrom AnyQt.QtWidgets import QWidget, QLineEdit, QStyleOptionViewItem, QMenu, \\\n    QPushButton\n\nfrom orangewidget.tests.base import GuiTest\n\nfrom Orange.data import Table, ContinuousVariable, Domain, DiscreteVariable, \\\n    TimeVariable\nfrom Orange.widgets.data.owcreateinstance import OWCreateInstance, \\\n    DiscreteVariableEditor, ContinuousVariableEditor, StringVariableEditor, \\\n    TimeVariableEditor, VariableDelegate, VariableItemModel, ValueRole\nfrom Orange.widgets.tests.base import WidgetTest, datasets\n\n\nclass TestOWCreateInstance(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWCreateInstance)\n        self.data = Table(\"iris\")\n\n    def test_output(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(False)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 1)\n        self.assertEqual(output.name, \"created\")\n        self.assertEqual(output.domain, self.data.domain)\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X, array)\n\n    def test_output_append_data(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(True)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n\n        np.testing.assert_array_equal(output.X[:150], self.data.X)\n        np.testing.assert_array_equal(output.Y[:150], self.data.Y)\n        array = np.zeros((150, 1), dtype=object)\n        np.testing.assert_array_equal(output.metas[:150], array)\n\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X[150:], array)\n        np.testing.assert_array_equal(output.Y[150:], np.array([0]))\n        np.testing.assert_array_equal(output.metas[150:], np.array([[1]]))\n\n        self.assertEqual(output.domain.attributes, self.data.domain.attributes)\n        self.assertEqual(output.domain.class_vars, self.data.domain.class_vars)\n        self.assertIn(\"Source ID\", [m.name for m in output.domain.metas])\n        self.assertTupleEqual(output.domain.metas[0].values,\n                              (\"iris\", \"created\"))\n        self.assertDictEqual(output.domain.metas[0].attributes,\n                             {\"__source_widget\": OWCreateInstance})\n\n    def _get_init_buttons(self, widget=None):\n        if not widget:\n            widget = self.widget\n        return widget.findChild(QObject, \"buttonBox\").findChildren(QPushButton)\n\n    def test_initialize_buttons(self):\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output = self.get_output(self.widget.Outputs.data).copy()\n\n        buttons = self._get_init_buttons()\n\n        buttons[3].click()  # Input\n        output_input = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_input, self.data[:1])\n\n        buttons[0].click()  # Median\n        output_median = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_median, output)\n\n        buttons[1].click()  # Mean\n        output_mean = self.get_output(self.widget.Outputs.data)\n        with output.unlocked():\n            output.X = np.round(np.mean(self.data.X, axis=0), 1).reshape(1, 4)\n        self.assert_table_equal(output_mean, output)\n\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assertTrue((self.data.X.max(axis=0) >= output_random.X).all())\n        self.assertTrue((self.data.X.min(axis=0) <= output_random.X).all())\n\n        self.send_signal(self.widget.Inputs.data, self.data[9:10])\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, self.data[9:10])\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        buttons[3].click()  # Input\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, output)\n\n    def test_initialize_buttons_commit_once(self):\n        self.widget.commit.deferred = self.widget.commit.now = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_table(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertEqual(self.widget.view.model().rowCount(), 5)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertEqual(self.widget.view.model().rowCount(), 18)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertEqual(self.widget.view.model().rowCount(), 0)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n    def test_table_data_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        index = self.widget.model.index(0, 1)\n        self.widget.model.setData(index, 7, role=ValueRole)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(output.X[150, 0], 7)\n\n    def test_datasets(self):\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n\n    def test_missing_values(self):\n        domain = Domain([ContinuousVariable(\"c\")],\n                        class_vars=[DiscreteVariable(\"m\", (\"a\", \"b\"))])\n        data = Table(domain, np.array([[np.nan], [np.nan]]),\n                     np.array([np.nan, np.nan]))\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output, data[:1])\n        self.assertTrue(self.widget.Information.nans_removed.is_shown())\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Information.nans_removed.is_shown())\n\n    def test_missing_values_reference(self):\n        reference = self.data[:1].copy()\n        with reference.unlocked():\n            reference[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, reference)\n        output1 = self.get_output(self.widget.Outputs.data)\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_saved_workflow(self):\n        data = self.data\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        buttons = self._get_init_buttons()\n        buttons[2].click()  # Random\n        output1 = self.get_output(self.widget.Outputs.data)\n\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        widget = self.create_widget(OWCreateInstance, stored_settings=settings)\n        self.send_signal(widget.Inputs.data, data, widget=widget)\n        output2 = self.get_output(widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_commit_once(self):\n        self.widget.commit.now = self.widget.commit.deferred = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.commit.deferred.assert_called_once()\n\n        self.widget.commit.deferred.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_context_menu(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output1 = self.get_output(self.widget.Outputs.data)\n        self.widget.view.customContextMenuRequested.emit(QPoint(0, 0))\n        menu = [w for w in self.widget.children() if isinstance(w, QMenu)][0]\n        self.assertEqual(len(menu.actions()), 4)\n\n        menu.actions()[3].trigger()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        np.testing.assert_array_equal(output2.X[:, 1:], output1.X[:, 1:])\n        np.testing.assert_array_equal(output2.X[150:, :1], self.data.X[:1, :1])\n\n    def test_report(self):\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.send_report()\n\n    def test_sparse(self):\n        data = self.data.to_sparse()\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.reference, data)\n\n    def test_cascade_widgets(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        widget = self.create_widget(OWCreateInstance)\n        self.send_signal(widget.Inputs.data, output, widget=widget)\n        output = self.get_output(widget.Outputs.data, widget=widget)\n        self.assertEqual(len(output), 152)\n        self.assertEqual(len(output.domain.metas), 1)\n        self.assertEqual(output.domain.metas[0].name, \"Source ID\")\n        self.assertTrue(all(output.metas[:150, 0] == 0))\n        self.assertTrue(all(output.metas[150:, 0] == 1))\n\n    def test_cascade_widgets_attributes(self):\n        data = self.data.copy()\n        data.domain.attributes[0].attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n    def test_cascade_widgets_class_vars(self):\n        data = self.data.copy()\n        data.domain.class_var.attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n        domain = Domain(data.domain.variables[:3], data.domain.variables[3:])\n        data = data.transform(domain)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n\nclass TestDiscreteVariableEditor(GuiTest):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        cls.parent = QWidget()\n\n    def setUp(self):\n        self.callback = Mock()\n        self.editor = DiscreteVariableEditor(\n            self.parent, [\"Foo\", \"Bar\"], self.callback\n        )\n\n    def test_init(self):\n        self.assertEqual(self.editor.value, 0)\n        self.assertEqual(self.editor._combo.currentText(), \"Foo\")\n        self.callback.assert_not_called()\n\n    def test_edit(self):\n        \"\"\" Edit combo by user. \"\"\"\n        self.editor._combo.setCurrentText(\"Bar\")\n        self.assertEqual(self.editor.value, 1)\n        self.assertEqual(self.editor._combo.currentText(), \"Bar\")\n        self.callback.assert_called_once()\n\n    def test_set_value(self):\n        \"\"\" Programmatically set combo box value. \"\"\"\n        self.editor.value = 1\n        self.assertEqual(self.editor.value, 1)\n        self.assertEqual(self.editor._combo.currentText(), \"Bar\")\n        self.callback.assert_called_once()\n\n\nclass TestContinuousVariableEditor(GuiTest):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        cls.parent = QWidget()\n\n    def setUp(self):\n        self.callback = Mock()\n        data = Table(\"iris\")\n        values = data.get_column_view(data.domain[0])[0]\n        self.min_value = np.min(values)\n        self.max_value = np.max(values)\n        self.editor = ContinuousVariableEditor(\n            self.parent, data.domain[0], self.min_value,\n            self.max_value, self.callback\n        )\n\n    def test_init(self):\n        self.assertEqual(self.editor.value, self.min_value)\n        self.assertEqual(self.editor._slider.value(), self.min_value * 10)\n        self.assertEqual(self.editor._spin.value(), self.min_value)\n        self.callback.assert_not_called()\n\n    def test_edit_slider(self):\n        \"\"\" Edit slider by user. \"\"\"\n        self.editor._slider.setValue(int(self.max_value * 10))\n        self.assertEqual(self.editor.value, self.max_value)\n        self.assertEqual(self.editor._slider.value(), self.max_value * 10)\n        self.assertEqual(self.editor._spin.value(), self.max_value)\n        self.callback.assert_called_once()\n\n        self.callback.reset_mock()\n        value = self.min_value + (self.max_value - self.min_value) / 2\n        self.editor._slider.setValue(int(value * 10))\n        self.assertEqual(self.editor.value, value)\n        self.assertEqual(self.editor._slider.value(), value * 10)\n        self.assertEqual(self.editor._spin.value(), value)\n        self.callback.assert_called_once()\n\n    def test_edit_spin(self):\n        \"\"\" Edit spin by user. \"\"\"\n        self.editor._spin.setValue(self.max_value)\n        self.assertEqual(self.editor.value, self.max_value)\n        self.assertEqual(self.editor._slider.value(), self.max_value * 10)\n        self.assertEqual(self.editor._spin.value(), self.max_value)\n        self.callback.assert_called_once()\n\n        self.callback.reset_mock()\n        self.editor._spin.setValue(self.max_value + 1)\n        self.assertEqual(self.editor.value, self.max_value + 1)\n        self.assertEqual(self.editor._slider.value(), self.max_value * 10)\n        self.assertEqual(self.editor._spin.value(), self.max_value + 1)\n        self.callback.assert_called_once()\n\n        self.callback.reset_mock()\n        value = self.min_value + (self.max_value - self.min_value) / 2\n        self.editor._spin.setValue(value)\n        self.assertEqual(self.editor.value, value)\n        self.assertEqual(self.editor._slider.value(), value * 10)\n        self.assertEqual(self.editor._spin.value(), value)\n        self.callback.assert_called_once()\n\n    def test_set_value(self):\n        \"\"\" Programmatically set slider/spin value. \"\"\"\n        self.editor.value = -2\n        self.assertEqual(self.editor._slider.value(), self.min_value * 10)\n        self.assertEqual(self.editor._spin.value(), -2)\n        self.assertEqual(self.editor.value, -2)\n        self.callback.assert_called_once()\n\n        self.callback.reset_mock()\n        value = self.min_value + (self.max_value - self.min_value) / 4\n        self.editor.value = value\n        self.assertEqual(self.editor._slider.value(), value * 10)\n        self.assertEqual(self.editor._spin.value(), value)\n        self.assertEqual(self.editor.value, value)\n        self.callback.assert_called_once()\n\n    def test_missing_values(self):\n        var = ContinuousVariable(\"var\")\n        self.assertRaises(ValueError, ContinuousVariableEditor, self.parent,\n                          var, np.nan, np.nan, Mock())\n\n    def test_overflow(self):\n        var = ContinuousVariable(\"var\", number_of_decimals=10)\n        editor = ContinuousVariableEditor(\n            self.parent, var, -100000, 1, self.callback\n        )\n        self.assertLess(editor._n_decimals, 10)\n\n    def test_spin_selection_after_init(self):\n        edit: QLineEdit = self.editor._spin.lineEdit()\n        edit.selectAll()\n        self.assertEqual(edit.selectedText(), \"\")\n        self.assertIs(self.editor.focusProxy(), edit.parent())\n\n\nclass TestStringVariableEditor(GuiTest):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        cls.parent = QWidget()\n\n    def setUp(self):\n        self.callback = Mock()\n        self.editor = StringVariableEditor(self.parent, self.callback)\n\n    def test_init(self):\n        self.assertEqual(self.editor.value, \"\")\n        self.assertEqual(self.editor._edit.text(), \"\")\n        self.callback.assert_not_called()\n\n    def test_edit(self):\n        \"\"\" Set lineedit by user. \"\"\"\n        self.editor._edit.setText(\"Foo\")\n        self.assertEqual(self.editor.value, \"Foo\")\n        self.assertEqual(self.editor._edit.text(), \"Foo\")\n        self.callback.assert_called_once()\n\n    def test_set_value(self):\n        \"\"\" Programmatically set lineedit value. \"\"\"\n        self.editor.value = \"Foo\"\n        self.assertEqual(self.editor.value, \"Foo\")\n        self.assertEqual(self.editor._edit.text(), \"Foo\")\n        self.callback.assert_called_once()\n\n\ndef _datetime(y, m, d) -> QDateTime:\n    return QDateTime(QDate(y, m, d), QTime(0, 0))\n\n\nclass TestTimeVariableEditor(GuiTest):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        cls.parent = QWidget()\n\n    def setUp(self):\n        self.callback = Mock()\n        self.editor = TimeVariableEditor(\n            self.parent, TimeVariable(\"var\", have_date=1), self.callback\n        )\n\n    def test_init(self):\n        self.assertEqual(self.editor.value, 0)\n        self.assertEqual(self.editor._edit.dateTime(), _datetime(1970, 1, 1))\n        self.callback.assert_not_called()\n\n    def test_edit(self):\n        \"\"\" Edit datetimeedit by user. \"\"\"\n        datetime = _datetime(2001, 9, 9,)\n        self.editor._edit.setDateTime(datetime)\n        self.assertEqual(self.editor.value, 999993600)\n        self.assertEqual(self.editor._edit.dateTime(), datetime)\n        self.callback.assert_called_once()\n\n    def test_set_value(self):\n        \"\"\" Programmatically set datetimeedit value. \"\"\"\n        value = 999993600\n        self.editor.value = value\n        self.assertEqual(self.editor._edit.dateTime(), _datetime(2001, 9, 9))\n        self.assertEqual(self.editor.value, value)\n        self.callback.assert_called_once()\n\n    def test_have_date_have_time(self):\n        callback = Mock()\n        editor = TimeVariableEditor(\n            self.parent, TimeVariable(\"var\", have_date=1, have_time=1),\n            callback\n        )\n        self.assertEqual(editor.value, 0)\n        self.assertEqual(self.editor._edit.dateTime(), _datetime(1970, 1, 1))\n        self.callback.assert_not_called()\n\n        datetime = QDateTime(QDate(2001, 9, 9), QTime(1, 2, 3))\n        editor._edit.setDateTime(datetime)\n        self.assertEqual(editor._edit.dateTime(), datetime)\n        self.assertEqual(editor.value, 999993600 + 3723)\n        callback.assert_called_once()\n\n    def test_have_time(self):\n        callback = Mock()\n        editor = TimeVariableEditor(\n            self.parent, TimeVariable(\"var\", have_time=1), callback\n        )\n        self.assertEqual(editor.value, 0)\n        self.assertEqual(self.editor._edit.dateTime(), _datetime(1970, 1, 1))\n        self.callback.assert_not_called()\n\n        datetime = QDateTime(QDate(1900, 1, 1), QTime(1, 2, 3))\n        editor._edit.setDateTime(datetime)\n        self.assertEqual(editor._edit.dateTime(), datetime)\n        self.assertEqual(editor.value, 3723)\n        callback.assert_called_once()\n\n    def test_no_date_no_time(self):\n        callback = Mock()\n        editor = TimeVariableEditor(self.parent, TimeVariable(\"var\"), callback)\n        self.assertEqual(editor.value, 0)\n        self.assertEqual(self.editor._edit.dateTime(), _datetime(1970, 1, 1))\n        self.callback.assert_not_called()\n\n        datetime = QDateTime(QDate(2001, 9, 9), QTime(1, 2, 3))\n        editor._edit.setDateTime(datetime)\n        self.assertEqual(editor._edit.dateTime(), datetime)\n        self.assertEqual(editor.value, 999993600 + 3723)\n        callback.assert_called_once()\n\n\nclass TestVariableDelegate(GuiTest):\n    def setUp(self):\n        self.data = Table(\"iris\")\n        self.model = model = VariableItemModel()\n        model.set_data(self.data)\n        widget = OWCreateInstance()\n        self.delegate = VariableDelegate(widget)\n        self.parent = QWidget()\n        self.opt = QStyleOptionViewItem()\n\n    def test_create_editor(self):\n        index = self.model.index(0, 1)\n        editor = self.delegate.createEditor(self.parent, self.opt, index)\n        self.assertIsInstance(editor, ContinuousVariableEditor)\n\n        index = self.model.index(4, 1)\n        editor = self.delegate.createEditor(self.parent, self.opt, index)\n        self.assertIsInstance(editor, DiscreteVariableEditor)\n\n    def test_set_editor_data(self):\n        index = self.model.index(0, 1)\n        editor = self.delegate.createEditor(self.parent, self.opt, index)\n        self.delegate.setEditorData(editor, index)\n        self.assertEqual(editor.value, np.median(self.data.X[:, 0]))\n\n    def test_set_model_data(self):\n        index = self.model.index(0, 1)\n        editor = self.delegate.createEditor(self.parent, self.opt, index)\n        editor.value = 7.5\n        self.delegate.setModelData(editor, self.model, index)\n        self.assertEqual(self.model.data(index, ValueRole), 7.5)\n\n    def test_editor_geometry(self):\n        index = self.model.index(0, 1)\n        editor = self.delegate.createEditor(self.parent, self.opt, index)\n        self.delegate.updateEditorGeometry(editor, self.opt, index)\n        self.assertGreaterEqual(editor.geometry().width(),\n                                self.opt.rect.width())\n\n        size = self.delegate.sizeHint(self.opt, index)\n        self.assertEqual(size.width(), editor.geometry().width())\n        self.assertEqual(size.height(), 40)\n\n\nif __name__ == \"__main__\":\n    import unittest\n    unittest.main()\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/data/tests/test_owcreateinstance.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "2e12876f6",
                "new_commit_hash": "5316356cf",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/data/tests/test_owcreateinstance.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/data/tests/test_owcreateinstance.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 54,
                            "length": 6
                        },
                        "new_range": {
                            "start": 54,
                            "length": 8
                        },
                        "section": "class TestOWCreateInstance(WidgetTest):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.assertIn(\"Source ID\", [m.name for m in output.domain.metas])",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertTupleEqual(output.domain.metas[0].values,",
                                "type": "context"
                            },
                            {
                                "content": "                              (\"iris\", \"created\"))",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertDictEqual(output.domain.metas[0].attributes,",
                                "type": "added"
                            },
                            {
                                "content": "                             {\"__source_widget\": OWCreateInstance})",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def _get_init_buttons(self, widget=None):",
                                "type": "context"
                            },
                            {
                                "content": "        if not widget:",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owcreateinstance.py",
                            "type": "class",
                            "name": "TestOWCreateInstance",
                            "content": "class TestOWCreateInstance(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWCreateInstance)\n        self.data = Table(\"iris\")\n\n    def test_output(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(False)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 1)\n        self.assertEqual(output.name, \"created\")\n        self.assertEqual(output.domain, self.data.domain)\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X, array)\n\n    def test_output_append_data(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(True)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n\n        np.testing.assert_array_equal(output.X[:150], self.data.X)\n        np.testing.assert_array_equal(output.Y[:150], self.data.Y)\n        array = np.zeros((150, 1), dtype=object)\n        np.testing.assert_array_equal(output.metas[:150], array)\n\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X[150:], array)\n        np.testing.assert_array_equal(output.Y[150:], np.array([0]))\n        np.testing.assert_array_equal(output.metas[150:], np.array([[1]]))\n\n        self.assertEqual(output.domain.attributes, self.data.domain.attributes)\n        self.assertEqual(output.domain.class_vars, self.data.domain.class_vars)\n        self.assertIn(\"Source ID\", [m.name for m in output.domain.metas])\n        self.assertTupleEqual(output.domain.metas[0].values,\n                              (\"iris\", \"created\"))\n        self.assertDictEqual(output.domain.metas[0].attributes,\n                             {\"__source_widget\": OWCreateInstance})\n\n    def _get_init_buttons(self, widget=None):\n        if not widget:\n            widget = self.widget\n        return widget.findChild(QObject, \"buttonBox\").findChildren(QPushButton)\n\n    def test_initialize_buttons(self):\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output = self.get_output(self.widget.Outputs.data).copy()\n\n        buttons = self._get_init_buttons()\n\n        buttons[3].click()  # Input\n        output_input = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_input, self.data[:1])\n\n        buttons[0].click()  # Median\n        output_median = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_median, output)\n\n        buttons[1].click()  # Mean\n        output_mean = self.get_output(self.widget.Outputs.data)\n        with output.unlocked():\n            output.X = np.round(np.mean(self.data.X, axis=0), 1).reshape(1, 4)\n        self.assert_table_equal(output_mean, output)\n\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assertTrue((self.data.X.max(axis=0) >= output_random.X).all())\n        self.assertTrue((self.data.X.min(axis=0) <= output_random.X).all())\n\n        self.send_signal(self.widget.Inputs.data, self.data[9:10])\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, self.data[9:10])\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        buttons[3].click()  # Input\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, output)\n\n    def test_initialize_buttons_commit_once(self):\n        self.widget.commit.deferred = self.widget.commit.now = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_table(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertEqual(self.widget.view.model().rowCount(), 5)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertEqual(self.widget.view.model().rowCount(), 18)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertEqual(self.widget.view.model().rowCount(), 0)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n    def test_table_data_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        index = self.widget.model.index(0, 1)\n        self.widget.model.setData(index, 7, role=ValueRole)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(output.X[150, 0], 7)\n\n    def test_datasets(self):\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n\n    def test_missing_values(self):\n        domain = Domain([ContinuousVariable(\"c\")],\n                        class_vars=[DiscreteVariable(\"m\", (\"a\", \"b\"))])\n        data = Table(domain, np.array([[np.nan], [np.nan]]),\n                     np.array([np.nan, np.nan]))\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output, data[:1])\n        self.assertTrue(self.widget.Information.nans_removed.is_shown())\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Information.nans_removed.is_shown())\n\n    def test_missing_values_reference(self):\n        reference = self.data[:1].copy()\n        with reference.unlocked():\n            reference[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, reference)\n        output1 = self.get_output(self.widget.Outputs.data)\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_saved_workflow(self):\n        data = self.data\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        buttons = self._get_init_buttons()\n        buttons[2].click()  # Random\n        output1 = self.get_output(self.widget.Outputs.data)\n\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        widget = self.create_widget(OWCreateInstance, stored_settings=settings)\n        self.send_signal(widget.Inputs.data, data, widget=widget)\n        output2 = self.get_output(widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_commit_once(self):\n        self.widget.commit.now = self.widget.commit.deferred = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.commit.deferred.assert_called_once()\n\n        self.widget.commit.deferred.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_context_menu(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output1 = self.get_output(self.widget.Outputs.data)\n        self.widget.view.customContextMenuRequested.emit(QPoint(0, 0))\n        menu = [w for w in self.widget.children() if isinstance(w, QMenu)][0]\n        self.assertEqual(len(menu.actions()), 4)\n\n        menu.actions()[3].trigger()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        np.testing.assert_array_equal(output2.X[:, 1:], output1.X[:, 1:])\n        np.testing.assert_array_equal(output2.X[150:, :1], self.data.X[:1, :1])\n\n    def test_report(self):\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.send_report()\n\n    def test_sparse(self):\n        data = self.data.to_sparse()\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.reference, data)\n\n    def test_cascade_widgets(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        widget = self.create_widget(OWCreateInstance)\n        self.send_signal(widget.Inputs.data, output, widget=widget)\n        output = self.get_output(widget.Outputs.data, widget=widget)\n        self.assertEqual(len(output), 152)\n        self.assertEqual(len(output.domain.metas), 1)\n        self.assertEqual(output.domain.metas[0].name, \"Source ID\")\n        self.assertTrue(all(output.metas[:150, 0] == 0))\n        self.assertTrue(all(output.metas[150:, 0] == 1))\n\n    def test_cascade_widgets_attributes(self):\n        data = self.data.copy()\n        data.domain.attributes[0].attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n    def test_cascade_widgets_class_vars(self):\n        data = self.data.copy()\n        data.domain.class_var.attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n        domain = Domain(data.domain.variables[:3], data.domain.variables[3:])\n        data = data.transform(domain)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 20,
                            "end_lineno": 257,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/widgets/data/tests/test_owcreateinstance.py",
                            "type": "method",
                            "name": "TestOWCreateInstance.test_output_append_data",
                            "content": "class TestOWCreateInstance(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWCreateInstance)\n        self.data = Table(\"iris\")\n\n    def test_output(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(False)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 1)\n        self.assertEqual(output.name, \"created\")\n        self.assertEqual(output.domain, self.data.domain)\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X, array)\n\n    def test_output_append_data(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(True)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n\n        np.testing.assert_array_equal(output.X[:150], self.data.X)\n        np.testing.assert_array_equal(output.Y[:150], self.data.Y)\n        array = np.zeros((150, 1), dtype=object)\n        np.testing.assert_array_equal(output.metas[:150], array)\n\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X[150:], array)\n        np.testing.assert_array_equal(output.Y[150:], np.array([0]))\n        np.testing.assert_array_equal(output.metas[150:], np.array([[1]]))\n\n        self.assertEqual(output.domain.attributes, self.data.domain.attributes)\n        self.assertEqual(output.domain.class_vars, self.data.domain.class_vars)\n        self.assertIn(\"Source ID\", [m.name for m in output.domain.metas])\n        self.assertTupleEqual(output.domain.metas[0].values,\n                              (\"iris\", \"created\"))\n        self.assertDictEqual(output.domain.metas[0].attributes,\n                             {\"__source_widget\": OWCreateInstance})\n\n    def _get_init_buttons(self, widget=None):\n        if not widget:\n            widget = self.widget\n        return widget.findChild(QObject, \"buttonBox\").findChildren(QPushButton)\n\n    def test_initialize_buttons(self):\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output = self.get_output(self.widget.Outputs.data).copy()\n\n        buttons = self._get_init_buttons()\n\n        buttons[3].click()  # Input\n        output_input = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_input, self.data[:1])\n\n        buttons[0].click()  # Median\n        output_median = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_median, output)\n\n        buttons[1].click()  # Mean\n        output_mean = self.get_output(self.widget.Outputs.data)\n        with output.unlocked():\n            output.X = np.round(np.mean(self.data.X, axis=0), 1).reshape(1, 4)\n        self.assert_table_equal(output_mean, output)\n\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assertTrue((self.data.X.max(axis=0) >= output_random.X).all())\n        self.assertTrue((self.data.X.min(axis=0) <= output_random.X).all())\n\n        self.send_signal(self.widget.Inputs.data, self.data[9:10])\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, self.data[9:10])\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        buttons[3].click()  # Input\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, output)\n\n    def test_initialize_buttons_commit_once(self):\n        self.widget.commit.deferred = self.widget.commit.now = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_table(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertEqual(self.widget.view.model().rowCount(), 5)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertEqual(self.widget.view.model().rowCount(), 18)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertEqual(self.widget.view.model().rowCount(), 0)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n    def test_table_data_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        index = self.widget.model.index(0, 1)\n        self.widget.model.setData(index, 7, role=ValueRole)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(output.X[150, 0], 7)\n\n    def test_datasets(self):\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n\n    def test_missing_values(self):\n        domain = Domain([ContinuousVariable(\"c\")],\n                        class_vars=[DiscreteVariable(\"m\", (\"a\", \"b\"))])\n        data = Table(domain, np.array([[np.nan], [np.nan]]),\n                     np.array([np.nan, np.nan]))\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output, data[:1])\n        self.assertTrue(self.widget.Information.nans_removed.is_shown())\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Information.nans_removed.is_shown())\n\n    def test_missing_values_reference(self):\n        reference = self.data[:1].copy()\n        with reference.unlocked():\n            reference[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, reference)\n        output1 = self.get_output(self.widget.Outputs.data)\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_saved_workflow(self):\n        data = self.data\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        buttons = self._get_init_buttons()\n        buttons[2].click()  # Random\n        output1 = self.get_output(self.widget.Outputs.data)\n\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        widget = self.create_widget(OWCreateInstance, stored_settings=settings)\n        self.send_signal(widget.Inputs.data, data, widget=widget)\n        output2 = self.get_output(widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_commit_once(self):\n        self.widget.commit.now = self.widget.commit.deferred = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.commit.deferred.assert_called_once()\n\n        self.widget.commit.deferred.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_context_menu(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output1 = self.get_output(self.widget.Outputs.data)\n        self.widget.view.customContextMenuRequested.emit(QPoint(0, 0))\n        menu = [w for w in self.widget.children() if isinstance(w, QMenu)][0]\n        self.assertEqual(len(menu.actions()), 4)\n\n        menu.actions()[3].trigger()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        np.testing.assert_array_equal(output2.X[:, 1:], output1.X[:, 1:])\n        np.testing.assert_array_equal(output2.X[150:, :1], self.data.X[:1, :1])\n\n    def test_report(self):\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.send_report()\n\n    def test_sparse(self):\n        data = self.data.to_sparse()\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.reference, data)\n\n    def test_cascade_widgets(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        widget = self.create_widget(OWCreateInstance)\n        self.send_signal(widget.Inputs.data, output, widget=widget)\n        output = self.get_output(widget.Outputs.data, widget=widget)\n        self.assertEqual(len(output), 152)\n        self.assertEqual(len(output.domain.metas), 1)\n        self.assertEqual(output.domain.metas[0].name, \"Source ID\")\n        self.assertTrue(all(output.metas[:150, 0] == 0))\n        self.assertTrue(all(output.metas[150:, 0] == 1))\n\n    def test_cascade_widgets_attributes(self):\n        data = self.data.copy()\n        data.domain.attributes[0].attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n    def test_cascade_widgets_class_vars(self):\n        data = self.data.copy()\n        data.domain.class_var.attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n        domain = Domain(data.domain.variables[:3], data.domain.variables[3:])\n        data = data.transform(domain)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 35,
                            "end_lineno": 58,
                            "parent": {
                                "file_name": "Orange/widgets/data/tests/test_owcreateinstance.py",
                                "type": "class",
                                "name": "TestOWCreateInstance",
                                "content": "class TestOWCreateInstance(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWCreateInstance)\n        self.data = Table(\"iris\")\n\n    def test_output(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(False)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 1)\n        self.assertEqual(output.name, \"created\")\n        self.assertEqual(output.domain, self.data.domain)\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X, array)\n\n    def test_output_append_data(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(True)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n\n        np.testing.assert_array_equal(output.X[:150], self.data.X)\n        np.testing.assert_array_equal(output.Y[:150], self.data.Y)\n        array = np.zeros((150, 1), dtype=object)\n        np.testing.assert_array_equal(output.metas[:150], array)\n\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X[150:], array)\n        np.testing.assert_array_equal(output.Y[150:], np.array([0]))\n        np.testing.assert_array_equal(output.metas[150:], np.array([[1]]))\n\n        self.assertEqual(output.domain.attributes, self.data.domain.attributes)\n        self.assertEqual(output.domain.class_vars, self.data.domain.class_vars)\n        self.assertIn(\"Source ID\", [m.name for m in output.domain.metas])\n        self.assertTupleEqual(output.domain.metas[0].values,\n                              (\"iris\", \"created\"))\n        self.assertDictEqual(output.domain.metas[0].attributes,\n                             {\"__source_widget\": OWCreateInstance})\n\n    def _get_init_buttons(self, widget=None):\n        if not widget:\n            widget = self.widget\n        return widget.findChild(QObject, \"buttonBox\").findChildren(QPushButton)\n\n    def test_initialize_buttons(self):\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output = self.get_output(self.widget.Outputs.data).copy()\n\n        buttons = self._get_init_buttons()\n\n        buttons[3].click()  # Input\n        output_input = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_input, self.data[:1])\n\n        buttons[0].click()  # Median\n        output_median = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_median, output)\n\n        buttons[1].click()  # Mean\n        output_mean = self.get_output(self.widget.Outputs.data)\n        with output.unlocked():\n            output.X = np.round(np.mean(self.data.X, axis=0), 1).reshape(1, 4)\n        self.assert_table_equal(output_mean, output)\n\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assertTrue((self.data.X.max(axis=0) >= output_random.X).all())\n        self.assertTrue((self.data.X.min(axis=0) <= output_random.X).all())\n\n        self.send_signal(self.widget.Inputs.data, self.data[9:10])\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, self.data[9:10])\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        buttons[3].click()  # Input\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, output)\n\n    def test_initialize_buttons_commit_once(self):\n        self.widget.commit.deferred = self.widget.commit.now = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_table(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertEqual(self.widget.view.model().rowCount(), 5)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertEqual(self.widget.view.model().rowCount(), 18)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertEqual(self.widget.view.model().rowCount(), 0)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n    def test_table_data_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        index = self.widget.model.index(0, 1)\n        self.widget.model.setData(index, 7, role=ValueRole)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(output.X[150, 0], 7)\n\n    def test_datasets(self):\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n\n    def test_missing_values(self):\n        domain = Domain([ContinuousVariable(\"c\")],\n                        class_vars=[DiscreteVariable(\"m\", (\"a\", \"b\"))])\n        data = Table(domain, np.array([[np.nan], [np.nan]]),\n                     np.array([np.nan, np.nan]))\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output, data[:1])\n        self.assertTrue(self.widget.Information.nans_removed.is_shown())\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Information.nans_removed.is_shown())\n\n    def test_missing_values_reference(self):\n        reference = self.data[:1].copy()\n        with reference.unlocked():\n            reference[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, reference)\n        output1 = self.get_output(self.widget.Outputs.data)\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_saved_workflow(self):\n        data = self.data\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        buttons = self._get_init_buttons()\n        buttons[2].click()  # Random\n        output1 = self.get_output(self.widget.Outputs.data)\n\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        widget = self.create_widget(OWCreateInstance, stored_settings=settings)\n        self.send_signal(widget.Inputs.data, data, widget=widget)\n        output2 = self.get_output(widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_commit_once(self):\n        self.widget.commit.now = self.widget.commit.deferred = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.commit.deferred.assert_called_once()\n\n        self.widget.commit.deferred.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_context_menu(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output1 = self.get_output(self.widget.Outputs.data)\n        self.widget.view.customContextMenuRequested.emit(QPoint(0, 0))\n        menu = [w for w in self.widget.children() if isinstance(w, QMenu)][0]\n        self.assertEqual(len(menu.actions()), 4)\n\n        menu.actions()[3].trigger()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        np.testing.assert_array_equal(output2.X[:, 1:], output1.X[:, 1:])\n        np.testing.assert_array_equal(output2.X[150:, :1], self.data.X[:1, :1])\n\n    def test_report(self):\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.send_report()\n\n    def test_sparse(self):\n        data = self.data.to_sparse()\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.reference, data)\n\n    def test_cascade_widgets(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        widget = self.create_widget(OWCreateInstance)\n        self.send_signal(widget.Inputs.data, output, widget=widget)\n        output = self.get_output(widget.Outputs.data, widget=widget)\n        self.assertEqual(len(output), 152)\n        self.assertEqual(len(output.domain.metas), 1)\n        self.assertEqual(output.domain.metas[0].name, \"Source ID\")\n        self.assertTrue(all(output.metas[:150, 0] == 0))\n        self.assertTrue(all(output.metas[150:, 0] == 1))\n\n    def test_cascade_widgets_attributes(self):\n        data = self.data.copy()\n        data.domain.attributes[0].attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n    def test_cascade_widgets_class_vars(self):\n        data = self.data.copy()\n        data.domain.class_var.attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n        domain = Domain(data.domain.variables[:3], data.domain.variables[3:])\n        data = data.transform(domain)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 20,
                                "end_lineno": 257,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 213,
                            "length": 6
                        },
                        "new_range": {
                            "start": 215,
                            "length": 47
                        },
                        "section": "class TestOWCreateInstance(WidgetTest):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.send_signal(self.widget.Inputs.data, data)",
                                "type": "context"
                            },
                            {
                                "content": "        self.send_signal(self.widget.Inputs.reference, data)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_cascade_widgets(self):",
                                "type": "added"
                            },
                            {
                                "content": "        self.send_signal(self.widget.Inputs.data, self.data)",
                                "type": "added"
                            },
                            {
                                "content": "        output = self.get_output(self.widget.Outputs.data)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        widget = self.create_widget(OWCreateInstance)",
                                "type": "added"
                            },
                            {
                                "content": "        self.send_signal(widget.Inputs.data, output, widget=widget)",
                                "type": "added"
                            },
                            {
                                "content": "        output = self.get_output(widget.Outputs.data, widget=widget)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(output), 152)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(output.domain.metas), 1)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(output.domain.metas[0].name, \"Source ID\")",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertTrue(all(output.metas[:150, 0] == 0))",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertTrue(all(output.metas[150:, 0] == 1))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_cascade_widgets_attributes(self):",
                                "type": "added"
                            },
                            {
                                "content": "        data = self.data.copy()",
                                "type": "added"
                            },
                            {
                                "content": "        data.domain.attributes[0].attributes = \\",
                                "type": "added"
                            },
                            {
                                "content": "            {\"__source_widget\": OWCreateInstance}",
                                "type": "added"
                            },
                            {
                                "content": "        self.send_signal(self.widget.Inputs.data, data)",
                                "type": "added"
                            },
                            {
                                "content": "        output = self.get_output(self.widget.Outputs.data)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(output), 151)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(output.domain.variables), 5)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(output.domain.metas), 0)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def test_cascade_widgets_class_vars(self):",
                                "type": "added"
                            },
                            {
                                "content": "        data = self.data.copy()",
                                "type": "added"
                            },
                            {
                                "content": "        data.domain.class_var.attributes = \\",
                                "type": "added"
                            },
                            {
                                "content": "            {\"__source_widget\": OWCreateInstance}",
                                "type": "added"
                            },
                            {
                                "content": "        self.send_signal(self.widget.Inputs.data, data)",
                                "type": "added"
                            },
                            {
                                "content": "        output = self.get_output(self.widget.Outputs.data)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(output), 151)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(output.domain.variables), 5)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(output.domain.metas), 0)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        domain = Domain(data.domain.variables[:3], data.domain.variables[3:])",
                                "type": "added"
                            },
                            {
                                "content": "        data = data.transform(domain)",
                                "type": "added"
                            },
                            {
                                "content": "        self.send_signal(self.widget.Inputs.data, data)",
                                "type": "added"
                            },
                            {
                                "content": "        output = self.get_output(self.widget.Outputs.data)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(output), 151)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(output.domain.variables), 5)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(len(output.domain.metas), 0)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "class TestDiscreteVariableEditor(GuiTest):",
                                "type": "context"
                            },
                            {
                                "content": "    @classmethod",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owcreateinstance.py",
                            "type": "class",
                            "name": "TestOWCreateInstance",
                            "content": "class TestOWCreateInstance(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWCreateInstance)\n        self.data = Table(\"iris\")\n\n    def test_output(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(False)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 1)\n        self.assertEqual(output.name, \"created\")\n        self.assertEqual(output.domain, self.data.domain)\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X, array)\n\n    def test_output_append_data(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(True)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n\n        np.testing.assert_array_equal(output.X[:150], self.data.X)\n        np.testing.assert_array_equal(output.Y[:150], self.data.Y)\n        array = np.zeros((150, 1), dtype=object)\n        np.testing.assert_array_equal(output.metas[:150], array)\n\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X[150:], array)\n        np.testing.assert_array_equal(output.Y[150:], np.array([0]))\n        np.testing.assert_array_equal(output.metas[150:], np.array([[1]]))\n\n        self.assertEqual(output.domain.attributes, self.data.domain.attributes)\n        self.assertEqual(output.domain.class_vars, self.data.domain.class_vars)\n        self.assertIn(\"Source ID\", [m.name for m in output.domain.metas])\n        self.assertTupleEqual(output.domain.metas[0].values,\n                              (\"iris\", \"created\"))\n        self.assertDictEqual(output.domain.metas[0].attributes,\n                             {\"__source_widget\": OWCreateInstance})\n\n    def _get_init_buttons(self, widget=None):\n        if not widget:\n            widget = self.widget\n        return widget.findChild(QObject, \"buttonBox\").findChildren(QPushButton)\n\n    def test_initialize_buttons(self):\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output = self.get_output(self.widget.Outputs.data).copy()\n\n        buttons = self._get_init_buttons()\n\n        buttons[3].click()  # Input\n        output_input = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_input, self.data[:1])\n\n        buttons[0].click()  # Median\n        output_median = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_median, output)\n\n        buttons[1].click()  # Mean\n        output_mean = self.get_output(self.widget.Outputs.data)\n        with output.unlocked():\n            output.X = np.round(np.mean(self.data.X, axis=0), 1).reshape(1, 4)\n        self.assert_table_equal(output_mean, output)\n\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assertTrue((self.data.X.max(axis=0) >= output_random.X).all())\n        self.assertTrue((self.data.X.min(axis=0) <= output_random.X).all())\n\n        self.send_signal(self.widget.Inputs.data, self.data[9:10])\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, self.data[9:10])\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        buttons[3].click()  # Input\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, output)\n\n    def test_initialize_buttons_commit_once(self):\n        self.widget.commit.deferred = self.widget.commit.now = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_table(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertEqual(self.widget.view.model().rowCount(), 5)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertEqual(self.widget.view.model().rowCount(), 18)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertEqual(self.widget.view.model().rowCount(), 0)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n    def test_table_data_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        index = self.widget.model.index(0, 1)\n        self.widget.model.setData(index, 7, role=ValueRole)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(output.X[150, 0], 7)\n\n    def test_datasets(self):\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n\n    def test_missing_values(self):\n        domain = Domain([ContinuousVariable(\"c\")],\n                        class_vars=[DiscreteVariable(\"m\", (\"a\", \"b\"))])\n        data = Table(domain, np.array([[np.nan], [np.nan]]),\n                     np.array([np.nan, np.nan]))\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output, data[:1])\n        self.assertTrue(self.widget.Information.nans_removed.is_shown())\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Information.nans_removed.is_shown())\n\n    def test_missing_values_reference(self):\n        reference = self.data[:1].copy()\n        with reference.unlocked():\n            reference[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, reference)\n        output1 = self.get_output(self.widget.Outputs.data)\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_saved_workflow(self):\n        data = self.data\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        buttons = self._get_init_buttons()\n        buttons[2].click()  # Random\n        output1 = self.get_output(self.widget.Outputs.data)\n\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        widget = self.create_widget(OWCreateInstance, stored_settings=settings)\n        self.send_signal(widget.Inputs.data, data, widget=widget)\n        output2 = self.get_output(widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_commit_once(self):\n        self.widget.commit.now = self.widget.commit.deferred = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.commit.deferred.assert_called_once()\n\n        self.widget.commit.deferred.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_context_menu(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output1 = self.get_output(self.widget.Outputs.data)\n        self.widget.view.customContextMenuRequested.emit(QPoint(0, 0))\n        menu = [w for w in self.widget.children() if isinstance(w, QMenu)][0]\n        self.assertEqual(len(menu.actions()), 4)\n\n        menu.actions()[3].trigger()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        np.testing.assert_array_equal(output2.X[:, 1:], output1.X[:, 1:])\n        np.testing.assert_array_equal(output2.X[150:, :1], self.data.X[:1, :1])\n\n    def test_report(self):\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.send_report()\n\n    def test_sparse(self):\n        data = self.data.to_sparse()\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.reference, data)\n\n    def test_cascade_widgets(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        widget = self.create_widget(OWCreateInstance)\n        self.send_signal(widget.Inputs.data, output, widget=widget)\n        output = self.get_output(widget.Outputs.data, widget=widget)\n        self.assertEqual(len(output), 152)\n        self.assertEqual(len(output.domain.metas), 1)\n        self.assertEqual(output.domain.metas[0].name, \"Source ID\")\n        self.assertTrue(all(output.metas[:150, 0] == 0))\n        self.assertTrue(all(output.metas[150:, 0] == 1))\n\n    def test_cascade_widgets_attributes(self):\n        data = self.data.copy()\n        data.domain.attributes[0].attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n    def test_cascade_widgets_class_vars(self):\n        data = self.data.copy()\n        data.domain.class_var.attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n        domain = Domain(data.domain.variables[:3], data.domain.variables[3:])\n        data = data.transform(domain)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 20,
                            "end_lineno": 257,
                            "parent": null
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owcreateinstance.py",
                            "type": "method",
                            "name": "TestOWCreateInstance.test_cascade_widgets",
                            "content": "class TestOWCreateInstance(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWCreateInstance)\n        self.data = Table(\"iris\")\n\n    def test_output(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(False)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 1)\n        self.assertEqual(output.name, \"created\")\n        self.assertEqual(output.domain, self.data.domain)\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X, array)\n\n    def test_output_append_data(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(True)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n\n        np.testing.assert_array_equal(output.X[:150], self.data.X)\n        np.testing.assert_array_equal(output.Y[:150], self.data.Y)\n        array = np.zeros((150, 1), dtype=object)\n        np.testing.assert_array_equal(output.metas[:150], array)\n\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X[150:], array)\n        np.testing.assert_array_equal(output.Y[150:], np.array([0]))\n        np.testing.assert_array_equal(output.metas[150:], np.array([[1]]))\n\n        self.assertEqual(output.domain.attributes, self.data.domain.attributes)\n        self.assertEqual(output.domain.class_vars, self.data.domain.class_vars)\n        self.assertIn(\"Source ID\", [m.name for m in output.domain.metas])\n        self.assertTupleEqual(output.domain.metas[0].values,\n                              (\"iris\", \"created\"))\n        self.assertDictEqual(output.domain.metas[0].attributes,\n                             {\"__source_widget\": OWCreateInstance})\n\n    def _get_init_buttons(self, widget=None):\n        if not widget:\n            widget = self.widget\n        return widget.findChild(QObject, \"buttonBox\").findChildren(QPushButton)\n\n    def test_initialize_buttons(self):\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output = self.get_output(self.widget.Outputs.data).copy()\n\n        buttons = self._get_init_buttons()\n\n        buttons[3].click()  # Input\n        output_input = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_input, self.data[:1])\n\n        buttons[0].click()  # Median\n        output_median = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_median, output)\n\n        buttons[1].click()  # Mean\n        output_mean = self.get_output(self.widget.Outputs.data)\n        with output.unlocked():\n            output.X = np.round(np.mean(self.data.X, axis=0), 1).reshape(1, 4)\n        self.assert_table_equal(output_mean, output)\n\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assertTrue((self.data.X.max(axis=0) >= output_random.X).all())\n        self.assertTrue((self.data.X.min(axis=0) <= output_random.X).all())\n\n        self.send_signal(self.widget.Inputs.data, self.data[9:10])\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, self.data[9:10])\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        buttons[3].click()  # Input\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, output)\n\n    def test_initialize_buttons_commit_once(self):\n        self.widget.commit.deferred = self.widget.commit.now = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_table(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertEqual(self.widget.view.model().rowCount(), 5)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertEqual(self.widget.view.model().rowCount(), 18)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertEqual(self.widget.view.model().rowCount(), 0)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n    def test_table_data_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        index = self.widget.model.index(0, 1)\n        self.widget.model.setData(index, 7, role=ValueRole)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(output.X[150, 0], 7)\n\n    def test_datasets(self):\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n\n    def test_missing_values(self):\n        domain = Domain([ContinuousVariable(\"c\")],\n                        class_vars=[DiscreteVariable(\"m\", (\"a\", \"b\"))])\n        data = Table(domain, np.array([[np.nan], [np.nan]]),\n                     np.array([np.nan, np.nan]))\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output, data[:1])\n        self.assertTrue(self.widget.Information.nans_removed.is_shown())\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Information.nans_removed.is_shown())\n\n    def test_missing_values_reference(self):\n        reference = self.data[:1].copy()\n        with reference.unlocked():\n            reference[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, reference)\n        output1 = self.get_output(self.widget.Outputs.data)\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_saved_workflow(self):\n        data = self.data\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        buttons = self._get_init_buttons()\n        buttons[2].click()  # Random\n        output1 = self.get_output(self.widget.Outputs.data)\n\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        widget = self.create_widget(OWCreateInstance, stored_settings=settings)\n        self.send_signal(widget.Inputs.data, data, widget=widget)\n        output2 = self.get_output(widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_commit_once(self):\n        self.widget.commit.now = self.widget.commit.deferred = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.commit.deferred.assert_called_once()\n\n        self.widget.commit.deferred.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_context_menu(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output1 = self.get_output(self.widget.Outputs.data)\n        self.widget.view.customContextMenuRequested.emit(QPoint(0, 0))\n        menu = [w for w in self.widget.children() if isinstance(w, QMenu)][0]\n        self.assertEqual(len(menu.actions()), 4)\n\n        menu.actions()[3].trigger()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        np.testing.assert_array_equal(output2.X[:, 1:], output1.X[:, 1:])\n        np.testing.assert_array_equal(output2.X[150:, :1], self.data.X[:1, :1])\n\n    def test_report(self):\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.send_report()\n\n    def test_sparse(self):\n        data = self.data.to_sparse()\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.reference, data)\n\n    def test_cascade_widgets(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        widget = self.create_widget(OWCreateInstance)\n        self.send_signal(widget.Inputs.data, output, widget=widget)\n        output = self.get_output(widget.Outputs.data, widget=widget)\n        self.assertEqual(len(output), 152)\n        self.assertEqual(len(output.domain.metas), 1)\n        self.assertEqual(output.domain.metas[0].name, \"Source ID\")\n        self.assertTrue(all(output.metas[:150, 0] == 0))\n        self.assertTrue(all(output.metas[150:, 0] == 1))\n\n    def test_cascade_widgets_attributes(self):\n        data = self.data.copy()\n        data.domain.attributes[0].attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n    def test_cascade_widgets_class_vars(self):\n        data = self.data.copy()\n        data.domain.class_var.attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n        domain = Domain(data.domain.variables[:3], data.domain.variables[3:])\n        data = data.transform(domain)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 218,
                            "end_lineno": 229,
                            "parent": {
                                "file_name": "Orange/widgets/data/tests/test_owcreateinstance.py",
                                "type": "class",
                                "name": "TestOWCreateInstance",
                                "content": "class TestOWCreateInstance(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWCreateInstance)\n        self.data = Table(\"iris\")\n\n    def test_output(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(False)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 1)\n        self.assertEqual(output.name, \"created\")\n        self.assertEqual(output.domain, self.data.domain)\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X, array)\n\n    def test_output_append_data(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(True)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n\n        np.testing.assert_array_equal(output.X[:150], self.data.X)\n        np.testing.assert_array_equal(output.Y[:150], self.data.Y)\n        array = np.zeros((150, 1), dtype=object)\n        np.testing.assert_array_equal(output.metas[:150], array)\n\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X[150:], array)\n        np.testing.assert_array_equal(output.Y[150:], np.array([0]))\n        np.testing.assert_array_equal(output.metas[150:], np.array([[1]]))\n\n        self.assertEqual(output.domain.attributes, self.data.domain.attributes)\n        self.assertEqual(output.domain.class_vars, self.data.domain.class_vars)\n        self.assertIn(\"Source ID\", [m.name for m in output.domain.metas])\n        self.assertTupleEqual(output.domain.metas[0].values,\n                              (\"iris\", \"created\"))\n        self.assertDictEqual(output.domain.metas[0].attributes,\n                             {\"__source_widget\": OWCreateInstance})\n\n    def _get_init_buttons(self, widget=None):\n        if not widget:\n            widget = self.widget\n        return widget.findChild(QObject, \"buttonBox\").findChildren(QPushButton)\n\n    def test_initialize_buttons(self):\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output = self.get_output(self.widget.Outputs.data).copy()\n\n        buttons = self._get_init_buttons()\n\n        buttons[3].click()  # Input\n        output_input = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_input, self.data[:1])\n\n        buttons[0].click()  # Median\n        output_median = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_median, output)\n\n        buttons[1].click()  # Mean\n        output_mean = self.get_output(self.widget.Outputs.data)\n        with output.unlocked():\n            output.X = np.round(np.mean(self.data.X, axis=0), 1).reshape(1, 4)\n        self.assert_table_equal(output_mean, output)\n\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assertTrue((self.data.X.max(axis=0) >= output_random.X).all())\n        self.assertTrue((self.data.X.min(axis=0) <= output_random.X).all())\n\n        self.send_signal(self.widget.Inputs.data, self.data[9:10])\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, self.data[9:10])\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        buttons[3].click()  # Input\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, output)\n\n    def test_initialize_buttons_commit_once(self):\n        self.widget.commit.deferred = self.widget.commit.now = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_table(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertEqual(self.widget.view.model().rowCount(), 5)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertEqual(self.widget.view.model().rowCount(), 18)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertEqual(self.widget.view.model().rowCount(), 0)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n    def test_table_data_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        index = self.widget.model.index(0, 1)\n        self.widget.model.setData(index, 7, role=ValueRole)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(output.X[150, 0], 7)\n\n    def test_datasets(self):\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n\n    def test_missing_values(self):\n        domain = Domain([ContinuousVariable(\"c\")],\n                        class_vars=[DiscreteVariable(\"m\", (\"a\", \"b\"))])\n        data = Table(domain, np.array([[np.nan], [np.nan]]),\n                     np.array([np.nan, np.nan]))\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output, data[:1])\n        self.assertTrue(self.widget.Information.nans_removed.is_shown())\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Information.nans_removed.is_shown())\n\n    def test_missing_values_reference(self):\n        reference = self.data[:1].copy()\n        with reference.unlocked():\n            reference[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, reference)\n        output1 = self.get_output(self.widget.Outputs.data)\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_saved_workflow(self):\n        data = self.data\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        buttons = self._get_init_buttons()\n        buttons[2].click()  # Random\n        output1 = self.get_output(self.widget.Outputs.data)\n\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        widget = self.create_widget(OWCreateInstance, stored_settings=settings)\n        self.send_signal(widget.Inputs.data, data, widget=widget)\n        output2 = self.get_output(widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_commit_once(self):\n        self.widget.commit.now = self.widget.commit.deferred = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.commit.deferred.assert_called_once()\n\n        self.widget.commit.deferred.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_context_menu(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output1 = self.get_output(self.widget.Outputs.data)\n        self.widget.view.customContextMenuRequested.emit(QPoint(0, 0))\n        menu = [w for w in self.widget.children() if isinstance(w, QMenu)][0]\n        self.assertEqual(len(menu.actions()), 4)\n\n        menu.actions()[3].trigger()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        np.testing.assert_array_equal(output2.X[:, 1:], output1.X[:, 1:])\n        np.testing.assert_array_equal(output2.X[150:, :1], self.data.X[:1, :1])\n\n    def test_report(self):\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.send_report()\n\n    def test_sparse(self):\n        data = self.data.to_sparse()\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.reference, data)\n\n    def test_cascade_widgets(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        widget = self.create_widget(OWCreateInstance)\n        self.send_signal(widget.Inputs.data, output, widget=widget)\n        output = self.get_output(widget.Outputs.data, widget=widget)\n        self.assertEqual(len(output), 152)\n        self.assertEqual(len(output.domain.metas), 1)\n        self.assertEqual(output.domain.metas[0].name, \"Source ID\")\n        self.assertTrue(all(output.metas[:150, 0] == 0))\n        self.assertTrue(all(output.metas[150:, 0] == 1))\n\n    def test_cascade_widgets_attributes(self):\n        data = self.data.copy()\n        data.domain.attributes[0].attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n    def test_cascade_widgets_class_vars(self):\n        data = self.data.copy()\n        data.domain.class_var.attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n        domain = Domain(data.domain.variables[:3], data.domain.variables[3:])\n        data = data.transform(domain)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 20,
                                "end_lineno": 257,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/data/tests/test_owcreateinstance.py",
                            "type": "method",
                            "name": "TestOWCreateInstance.test_cascade_widgets_class_vars",
                            "content": "class TestOWCreateInstance(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWCreateInstance)\n        self.data = Table(\"iris\")\n\n    def test_output(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(False)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 1)\n        self.assertEqual(output.name, \"created\")\n        self.assertEqual(output.domain, self.data.domain)\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X, array)\n\n    def test_output_append_data(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(True)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n\n        np.testing.assert_array_equal(output.X[:150], self.data.X)\n        np.testing.assert_array_equal(output.Y[:150], self.data.Y)\n        array = np.zeros((150, 1), dtype=object)\n        np.testing.assert_array_equal(output.metas[:150], array)\n\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X[150:], array)\n        np.testing.assert_array_equal(output.Y[150:], np.array([0]))\n        np.testing.assert_array_equal(output.metas[150:], np.array([[1]]))\n\n        self.assertEqual(output.domain.attributes, self.data.domain.attributes)\n        self.assertEqual(output.domain.class_vars, self.data.domain.class_vars)\n        self.assertIn(\"Source ID\", [m.name for m in output.domain.metas])\n        self.assertTupleEqual(output.domain.metas[0].values,\n                              (\"iris\", \"created\"))\n        self.assertDictEqual(output.domain.metas[0].attributes,\n                             {\"__source_widget\": OWCreateInstance})\n\n    def _get_init_buttons(self, widget=None):\n        if not widget:\n            widget = self.widget\n        return widget.findChild(QObject, \"buttonBox\").findChildren(QPushButton)\n\n    def test_initialize_buttons(self):\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output = self.get_output(self.widget.Outputs.data).copy()\n\n        buttons = self._get_init_buttons()\n\n        buttons[3].click()  # Input\n        output_input = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_input, self.data[:1])\n\n        buttons[0].click()  # Median\n        output_median = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_median, output)\n\n        buttons[1].click()  # Mean\n        output_mean = self.get_output(self.widget.Outputs.data)\n        with output.unlocked():\n            output.X = np.round(np.mean(self.data.X, axis=0), 1).reshape(1, 4)\n        self.assert_table_equal(output_mean, output)\n\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assertTrue((self.data.X.max(axis=0) >= output_random.X).all())\n        self.assertTrue((self.data.X.min(axis=0) <= output_random.X).all())\n\n        self.send_signal(self.widget.Inputs.data, self.data[9:10])\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, self.data[9:10])\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        buttons[3].click()  # Input\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, output)\n\n    def test_initialize_buttons_commit_once(self):\n        self.widget.commit.deferred = self.widget.commit.now = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_table(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertEqual(self.widget.view.model().rowCount(), 5)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertEqual(self.widget.view.model().rowCount(), 18)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertEqual(self.widget.view.model().rowCount(), 0)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n    def test_table_data_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        index = self.widget.model.index(0, 1)\n        self.widget.model.setData(index, 7, role=ValueRole)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(output.X[150, 0], 7)\n\n    def test_datasets(self):\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n\n    def test_missing_values(self):\n        domain = Domain([ContinuousVariable(\"c\")],\n                        class_vars=[DiscreteVariable(\"m\", (\"a\", \"b\"))])\n        data = Table(domain, np.array([[np.nan], [np.nan]]),\n                     np.array([np.nan, np.nan]))\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output, data[:1])\n        self.assertTrue(self.widget.Information.nans_removed.is_shown())\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Information.nans_removed.is_shown())\n\n    def test_missing_values_reference(self):\n        reference = self.data[:1].copy()\n        with reference.unlocked():\n            reference[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, reference)\n        output1 = self.get_output(self.widget.Outputs.data)\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_saved_workflow(self):\n        data = self.data\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        buttons = self._get_init_buttons()\n        buttons[2].click()  # Random\n        output1 = self.get_output(self.widget.Outputs.data)\n\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        widget = self.create_widget(OWCreateInstance, stored_settings=settings)\n        self.send_signal(widget.Inputs.data, data, widget=widget)\n        output2 = self.get_output(widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_commit_once(self):\n        self.widget.commit.now = self.widget.commit.deferred = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.commit.deferred.assert_called_once()\n\n        self.widget.commit.deferred.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_context_menu(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output1 = self.get_output(self.widget.Outputs.data)\n        self.widget.view.customContextMenuRequested.emit(QPoint(0, 0))\n        menu = [w for w in self.widget.children() if isinstance(w, QMenu)][0]\n        self.assertEqual(len(menu.actions()), 4)\n\n        menu.actions()[3].trigger()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        np.testing.assert_array_equal(output2.X[:, 1:], output1.X[:, 1:])\n        np.testing.assert_array_equal(output2.X[150:, :1], self.data.X[:1, :1])\n\n    def test_report(self):\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.send_report()\n\n    def test_sparse(self):\n        data = self.data.to_sparse()\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.reference, data)\n\n    def test_cascade_widgets(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        widget = self.create_widget(OWCreateInstance)\n        self.send_signal(widget.Inputs.data, output, widget=widget)\n        output = self.get_output(widget.Outputs.data, widget=widget)\n        self.assertEqual(len(output), 152)\n        self.assertEqual(len(output.domain.metas), 1)\n        self.assertEqual(output.domain.metas[0].name, \"Source ID\")\n        self.assertTrue(all(output.metas[:150, 0] == 0))\n        self.assertTrue(all(output.metas[150:, 0] == 1))\n\n    def test_cascade_widgets_attributes(self):\n        data = self.data.copy()\n        data.domain.attributes[0].attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n    def test_cascade_widgets_class_vars(self):\n        data = self.data.copy()\n        data.domain.class_var.attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n        domain = Domain(data.domain.variables[:3], data.domain.variables[3:])\n        data = data.transform(domain)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 241,
                            "end_lineno": 257,
                            "parent": {
                                "file_name": "Orange/widgets/data/tests/test_owcreateinstance.py",
                                "type": "class",
                                "name": "TestOWCreateInstance",
                                "content": "class TestOWCreateInstance(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWCreateInstance)\n        self.data = Table(\"iris\")\n\n    def test_output(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(False)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 1)\n        self.assertEqual(output.name, \"created\")\n        self.assertEqual(output.domain, self.data.domain)\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X, array)\n\n    def test_output_append_data(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(True)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n\n        np.testing.assert_array_equal(output.X[:150], self.data.X)\n        np.testing.assert_array_equal(output.Y[:150], self.data.Y)\n        array = np.zeros((150, 1), dtype=object)\n        np.testing.assert_array_equal(output.metas[:150], array)\n\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X[150:], array)\n        np.testing.assert_array_equal(output.Y[150:], np.array([0]))\n        np.testing.assert_array_equal(output.metas[150:], np.array([[1]]))\n\n        self.assertEqual(output.domain.attributes, self.data.domain.attributes)\n        self.assertEqual(output.domain.class_vars, self.data.domain.class_vars)\n        self.assertIn(\"Source ID\", [m.name for m in output.domain.metas])\n        self.assertTupleEqual(output.domain.metas[0].values,\n                              (\"iris\", \"created\"))\n        self.assertDictEqual(output.domain.metas[0].attributes,\n                             {\"__source_widget\": OWCreateInstance})\n\n    def _get_init_buttons(self, widget=None):\n        if not widget:\n            widget = self.widget\n        return widget.findChild(QObject, \"buttonBox\").findChildren(QPushButton)\n\n    def test_initialize_buttons(self):\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output = self.get_output(self.widget.Outputs.data).copy()\n\n        buttons = self._get_init_buttons()\n\n        buttons[3].click()  # Input\n        output_input = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_input, self.data[:1])\n\n        buttons[0].click()  # Median\n        output_median = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_median, output)\n\n        buttons[1].click()  # Mean\n        output_mean = self.get_output(self.widget.Outputs.data)\n        with output.unlocked():\n            output.X = np.round(np.mean(self.data.X, axis=0), 1).reshape(1, 4)\n        self.assert_table_equal(output_mean, output)\n\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assertTrue((self.data.X.max(axis=0) >= output_random.X).all())\n        self.assertTrue((self.data.X.min(axis=0) <= output_random.X).all())\n\n        self.send_signal(self.widget.Inputs.data, self.data[9:10])\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, self.data[9:10])\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        buttons[3].click()  # Input\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, output)\n\n    def test_initialize_buttons_commit_once(self):\n        self.widget.commit.deferred = self.widget.commit.now = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_table(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertEqual(self.widget.view.model().rowCount(), 5)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertEqual(self.widget.view.model().rowCount(), 18)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertEqual(self.widget.view.model().rowCount(), 0)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n    def test_table_data_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        index = self.widget.model.index(0, 1)\n        self.widget.model.setData(index, 7, role=ValueRole)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(output.X[150, 0], 7)\n\n    def test_datasets(self):\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n\n    def test_missing_values(self):\n        domain = Domain([ContinuousVariable(\"c\")],\n                        class_vars=[DiscreteVariable(\"m\", (\"a\", \"b\"))])\n        data = Table(domain, np.array([[np.nan], [np.nan]]),\n                     np.array([np.nan, np.nan]))\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output, data[:1])\n        self.assertTrue(self.widget.Information.nans_removed.is_shown())\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Information.nans_removed.is_shown())\n\n    def test_missing_values_reference(self):\n        reference = self.data[:1].copy()\n        with reference.unlocked():\n            reference[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, reference)\n        output1 = self.get_output(self.widget.Outputs.data)\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_saved_workflow(self):\n        data = self.data\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        buttons = self._get_init_buttons()\n        buttons[2].click()  # Random\n        output1 = self.get_output(self.widget.Outputs.data)\n\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        widget = self.create_widget(OWCreateInstance, stored_settings=settings)\n        self.send_signal(widget.Inputs.data, data, widget=widget)\n        output2 = self.get_output(widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_commit_once(self):\n        self.widget.commit.now = self.widget.commit.deferred = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.commit.deferred.assert_called_once()\n\n        self.widget.commit.deferred.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_context_menu(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output1 = self.get_output(self.widget.Outputs.data)\n        self.widget.view.customContextMenuRequested.emit(QPoint(0, 0))\n        menu = [w for w in self.widget.children() if isinstance(w, QMenu)][0]\n        self.assertEqual(len(menu.actions()), 4)\n\n        menu.actions()[3].trigger()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        np.testing.assert_array_equal(output2.X[:, 1:], output1.X[:, 1:])\n        np.testing.assert_array_equal(output2.X[150:, :1], self.data.X[:1, :1])\n\n    def test_report(self):\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.send_report()\n\n    def test_sparse(self):\n        data = self.data.to_sparse()\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.reference, data)\n\n    def test_cascade_widgets(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        widget = self.create_widget(OWCreateInstance)\n        self.send_signal(widget.Inputs.data, output, widget=widget)\n        output = self.get_output(widget.Outputs.data, widget=widget)\n        self.assertEqual(len(output), 152)\n        self.assertEqual(len(output.domain.metas), 1)\n        self.assertEqual(output.domain.metas[0].name, \"Source ID\")\n        self.assertTrue(all(output.metas[:150, 0] == 0))\n        self.assertTrue(all(output.metas[150:, 0] == 1))\n\n    def test_cascade_widgets_attributes(self):\n        data = self.data.copy()\n        data.domain.attributes[0].attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n    def test_cascade_widgets_class_vars(self):\n        data = self.data.copy()\n        data.domain.class_var.attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n        domain = Domain(data.domain.variables[:3], data.domain.variables[3:])\n        data = data.transform(domain)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 20,
                                "end_lineno": 257,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/data/tests/test_owcreateinstance.py",
                            "type": "method",
                            "name": "TestOWCreateInstance.test_cascade_widgets_attributes",
                            "content": "class TestOWCreateInstance(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWCreateInstance)\n        self.data = Table(\"iris\")\n\n    def test_output(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(False)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 1)\n        self.assertEqual(output.name, \"created\")\n        self.assertEqual(output.domain, self.data.domain)\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X, array)\n\n    def test_output_append_data(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(True)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n\n        np.testing.assert_array_equal(output.X[:150], self.data.X)\n        np.testing.assert_array_equal(output.Y[:150], self.data.Y)\n        array = np.zeros((150, 1), dtype=object)\n        np.testing.assert_array_equal(output.metas[:150], array)\n\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X[150:], array)\n        np.testing.assert_array_equal(output.Y[150:], np.array([0]))\n        np.testing.assert_array_equal(output.metas[150:], np.array([[1]]))\n\n        self.assertEqual(output.domain.attributes, self.data.domain.attributes)\n        self.assertEqual(output.domain.class_vars, self.data.domain.class_vars)\n        self.assertIn(\"Source ID\", [m.name for m in output.domain.metas])\n        self.assertTupleEqual(output.domain.metas[0].values,\n                              (\"iris\", \"created\"))\n        self.assertDictEqual(output.domain.metas[0].attributes,\n                             {\"__source_widget\": OWCreateInstance})\n\n    def _get_init_buttons(self, widget=None):\n        if not widget:\n            widget = self.widget\n        return widget.findChild(QObject, \"buttonBox\").findChildren(QPushButton)\n\n    def test_initialize_buttons(self):\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output = self.get_output(self.widget.Outputs.data).copy()\n\n        buttons = self._get_init_buttons()\n\n        buttons[3].click()  # Input\n        output_input = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_input, self.data[:1])\n\n        buttons[0].click()  # Median\n        output_median = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_median, output)\n\n        buttons[1].click()  # Mean\n        output_mean = self.get_output(self.widget.Outputs.data)\n        with output.unlocked():\n            output.X = np.round(np.mean(self.data.X, axis=0), 1).reshape(1, 4)\n        self.assert_table_equal(output_mean, output)\n\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assertTrue((self.data.X.max(axis=0) >= output_random.X).all())\n        self.assertTrue((self.data.X.min(axis=0) <= output_random.X).all())\n\n        self.send_signal(self.widget.Inputs.data, self.data[9:10])\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, self.data[9:10])\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        buttons[3].click()  # Input\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, output)\n\n    def test_initialize_buttons_commit_once(self):\n        self.widget.commit.deferred = self.widget.commit.now = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_table(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertEqual(self.widget.view.model().rowCount(), 5)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertEqual(self.widget.view.model().rowCount(), 18)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertEqual(self.widget.view.model().rowCount(), 0)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n    def test_table_data_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        index = self.widget.model.index(0, 1)\n        self.widget.model.setData(index, 7, role=ValueRole)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(output.X[150, 0], 7)\n\n    def test_datasets(self):\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n\n    def test_missing_values(self):\n        domain = Domain([ContinuousVariable(\"c\")],\n                        class_vars=[DiscreteVariable(\"m\", (\"a\", \"b\"))])\n        data = Table(domain, np.array([[np.nan], [np.nan]]),\n                     np.array([np.nan, np.nan]))\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output, data[:1])\n        self.assertTrue(self.widget.Information.nans_removed.is_shown())\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Information.nans_removed.is_shown())\n\n    def test_missing_values_reference(self):\n        reference = self.data[:1].copy()\n        with reference.unlocked():\n            reference[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, reference)\n        output1 = self.get_output(self.widget.Outputs.data)\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_saved_workflow(self):\n        data = self.data\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        buttons = self._get_init_buttons()\n        buttons[2].click()  # Random\n        output1 = self.get_output(self.widget.Outputs.data)\n\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        widget = self.create_widget(OWCreateInstance, stored_settings=settings)\n        self.send_signal(widget.Inputs.data, data, widget=widget)\n        output2 = self.get_output(widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_commit_once(self):\n        self.widget.commit.now = self.widget.commit.deferred = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.commit.deferred.assert_called_once()\n\n        self.widget.commit.deferred.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_context_menu(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output1 = self.get_output(self.widget.Outputs.data)\n        self.widget.view.customContextMenuRequested.emit(QPoint(0, 0))\n        menu = [w for w in self.widget.children() if isinstance(w, QMenu)][0]\n        self.assertEqual(len(menu.actions()), 4)\n\n        menu.actions()[3].trigger()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        np.testing.assert_array_equal(output2.X[:, 1:], output1.X[:, 1:])\n        np.testing.assert_array_equal(output2.X[150:, :1], self.data.X[:1, :1])\n\n    def test_report(self):\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.send_report()\n\n    def test_sparse(self):\n        data = self.data.to_sparse()\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.reference, data)\n\n    def test_cascade_widgets(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        widget = self.create_widget(OWCreateInstance)\n        self.send_signal(widget.Inputs.data, output, widget=widget)\n        output = self.get_output(widget.Outputs.data, widget=widget)\n        self.assertEqual(len(output), 152)\n        self.assertEqual(len(output.domain.metas), 1)\n        self.assertEqual(output.domain.metas[0].name, \"Source ID\")\n        self.assertTrue(all(output.metas[:150, 0] == 0))\n        self.assertTrue(all(output.metas[150:, 0] == 1))\n\n    def test_cascade_widgets_attributes(self):\n        data = self.data.copy()\n        data.domain.attributes[0].attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n    def test_cascade_widgets_class_vars(self):\n        data = self.data.copy()\n        data.domain.class_var.attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n        domain = Domain(data.domain.variables[:3], data.domain.variables[3:])\n        data = data.transform(domain)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 231,
                            "end_lineno": 239,
                            "parent": {
                                "file_name": "Orange/widgets/data/tests/test_owcreateinstance.py",
                                "type": "class",
                                "name": "TestOWCreateInstance",
                                "content": "class TestOWCreateInstance(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWCreateInstance)\n        self.data = Table(\"iris\")\n\n    def test_output(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(False)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 1)\n        self.assertEqual(output.name, \"created\")\n        self.assertEqual(output.domain, self.data.domain)\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X, array)\n\n    def test_output_append_data(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(True)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n\n        np.testing.assert_array_equal(output.X[:150], self.data.X)\n        np.testing.assert_array_equal(output.Y[:150], self.data.Y)\n        array = np.zeros((150, 1), dtype=object)\n        np.testing.assert_array_equal(output.metas[:150], array)\n\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X[150:], array)\n        np.testing.assert_array_equal(output.Y[150:], np.array([0]))\n        np.testing.assert_array_equal(output.metas[150:], np.array([[1]]))\n\n        self.assertEqual(output.domain.attributes, self.data.domain.attributes)\n        self.assertEqual(output.domain.class_vars, self.data.domain.class_vars)\n        self.assertIn(\"Source ID\", [m.name for m in output.domain.metas])\n        self.assertTupleEqual(output.domain.metas[0].values,\n                              (\"iris\", \"created\"))\n        self.assertDictEqual(output.domain.metas[0].attributes,\n                             {\"__source_widget\": OWCreateInstance})\n\n    def _get_init_buttons(self, widget=None):\n        if not widget:\n            widget = self.widget\n        return widget.findChild(QObject, \"buttonBox\").findChildren(QPushButton)\n\n    def test_initialize_buttons(self):\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output = self.get_output(self.widget.Outputs.data).copy()\n\n        buttons = self._get_init_buttons()\n\n        buttons[3].click()  # Input\n        output_input = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_input, self.data[:1])\n\n        buttons[0].click()  # Median\n        output_median = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_median, output)\n\n        buttons[1].click()  # Mean\n        output_mean = self.get_output(self.widget.Outputs.data)\n        with output.unlocked():\n            output.X = np.round(np.mean(self.data.X, axis=0), 1).reshape(1, 4)\n        self.assert_table_equal(output_mean, output)\n\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assertTrue((self.data.X.max(axis=0) >= output_random.X).all())\n        self.assertTrue((self.data.X.min(axis=0) <= output_random.X).all())\n\n        self.send_signal(self.widget.Inputs.data, self.data[9:10])\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, self.data[9:10])\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        buttons[3].click()  # Input\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, output)\n\n    def test_initialize_buttons_commit_once(self):\n        self.widget.commit.deferred = self.widget.commit.now = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_table(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertEqual(self.widget.view.model().rowCount(), 5)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertEqual(self.widget.view.model().rowCount(), 18)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertEqual(self.widget.view.model().rowCount(), 0)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n    def test_table_data_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        index = self.widget.model.index(0, 1)\n        self.widget.model.setData(index, 7, role=ValueRole)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(output.X[150, 0], 7)\n\n    def test_datasets(self):\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n\n    def test_missing_values(self):\n        domain = Domain([ContinuousVariable(\"c\")],\n                        class_vars=[DiscreteVariable(\"m\", (\"a\", \"b\"))])\n        data = Table(domain, np.array([[np.nan], [np.nan]]),\n                     np.array([np.nan, np.nan]))\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output, data[:1])\n        self.assertTrue(self.widget.Information.nans_removed.is_shown())\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Information.nans_removed.is_shown())\n\n    def test_missing_values_reference(self):\n        reference = self.data[:1].copy()\n        with reference.unlocked():\n            reference[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, reference)\n        output1 = self.get_output(self.widget.Outputs.data)\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_saved_workflow(self):\n        data = self.data\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        buttons = self._get_init_buttons()\n        buttons[2].click()  # Random\n        output1 = self.get_output(self.widget.Outputs.data)\n\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        widget = self.create_widget(OWCreateInstance, stored_settings=settings)\n        self.send_signal(widget.Inputs.data, data, widget=widget)\n        output2 = self.get_output(widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_commit_once(self):\n        self.widget.commit.now = self.widget.commit.deferred = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.commit.deferred.assert_called_once()\n\n        self.widget.commit.deferred.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_context_menu(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output1 = self.get_output(self.widget.Outputs.data)\n        self.widget.view.customContextMenuRequested.emit(QPoint(0, 0))\n        menu = [w for w in self.widget.children() if isinstance(w, QMenu)][0]\n        self.assertEqual(len(menu.actions()), 4)\n\n        menu.actions()[3].trigger()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        np.testing.assert_array_equal(output2.X[:, 1:], output1.X[:, 1:])\n        np.testing.assert_array_equal(output2.X[150:, :1], self.data.X[:1, :1])\n\n    def test_report(self):\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.send_report()\n\n    def test_sparse(self):\n        data = self.data.to_sparse()\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.reference, data)\n\n    def test_cascade_widgets(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        widget = self.create_widget(OWCreateInstance)\n        self.send_signal(widget.Inputs.data, output, widget=widget)\n        output = self.get_output(widget.Outputs.data, widget=widget)\n        self.assertEqual(len(output), 152)\n        self.assertEqual(len(output.domain.metas), 1)\n        self.assertEqual(output.domain.metas[0].name, \"Source ID\")\n        self.assertTrue(all(output.metas[:150, 0] == 0))\n        self.assertTrue(all(output.metas[150:, 0] == 1))\n\n    def test_cascade_widgets_attributes(self):\n        data = self.data.copy()\n        data.domain.attributes[0].attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n    def test_cascade_widgets_class_vars(self):\n        data = self.data.copy()\n        data.domain.class_var.attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n        domain = Domain(data.domain.variables[:3], data.domain.variables[3:])\n        data = data.transform(domain)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 20,
                                "end_lineno": 257,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "86555e61ce6d20da2f5e3f6e081bd80f02d6b214^",
    "new_commit_hash": "86555e61ce6d20da2f5e3f6e081bd80f02d6b214",
    "commit_message": "Merge pull request #5995 from VesnaT/create_instance_cascade\n\nCreate Instance: Unique source variable name",
    "commit_date": "2022-06-03T17:45:50+02:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "86555e61ce6d20da2f5e3f6e081bd80f02d6b214",
    "test_file_codes": [
        "# pylint: disable=missing-docstring,protected-access\nfrom unittest.mock import Mock\n\nimport numpy as np\n\nfrom AnyQt.QtCore import QDateTime, QDate, QTime, QPoint, QObject\nfrom AnyQt.QtWidgets import QWidget, QLineEdit, QStyleOptionViewItem, QMenu, \\\n    QPushButton\n\nfrom orangewidget.tests.base import GuiTest\n\nfrom Orange.data import Table, ContinuousVariable, Domain, DiscreteVariable, \\\n    TimeVariable\nfrom Orange.widgets.data.owcreateinstance import OWCreateInstance, \\\n    DiscreteVariableEditor, ContinuousVariableEditor, StringVariableEditor, \\\n    TimeVariableEditor, VariableDelegate, VariableItemModel, ValueRole\nfrom Orange.widgets.tests.base import WidgetTest, datasets\n\n\nclass TestOWCreateInstance(WidgetTest):\n    def setUp(self):\n        self.widget = self.create_widget(OWCreateInstance)\n        self.data = Table(\"iris\")\n\n    def test_output(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(False)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 1)\n        self.assertEqual(output.name, \"created\")\n        self.assertEqual(output.domain, self.data.domain)\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X, array)\n\n    def test_output_append_data(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(True)\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n\n        np.testing.assert_array_equal(output.X[:150], self.data.X)\n        np.testing.assert_array_equal(output.Y[:150], self.data.Y)\n        array = np.zeros((150, 1), dtype=object)\n        np.testing.assert_array_equal(output.metas[:150], array)\n\n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X[150:], array)\n        np.testing.assert_array_equal(output.Y[150:], np.array([0]))\n        np.testing.assert_array_equal(output.metas[150:], np.array([[1]]))\n\n        self.assertEqual(output.domain.attributes, self.data.domain.attributes)\n        self.assertEqual(output.domain.class_vars, self.data.domain.class_vars)\n        self.assertIn(\"Source ID\", [m.name for m in output.domain.metas])\n        self.assertTupleEqual(output.domain.metas[0].values,\n                              (\"iris\", \"created\"))\n        self.assertDictEqual(output.domain.metas[0].attributes,\n                             {\"__source_widget\": OWCreateInstance})\n\n    def _get_init_buttons(self, widget=None):\n        if not widget:\n            widget = self.widget\n        return widget.findChild(QObject, \"buttonBox\").findChildren(QPushButton)\n\n    def test_initialize_buttons(self):\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output = self.get_output(self.widget.Outputs.data).copy()\n\n        buttons = self._get_init_buttons()\n\n        buttons[3].click()  # Input\n        output_input = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_input, self.data[:1])\n\n        buttons[0].click()  # Median\n        output_median = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_median, output)\n\n        buttons[1].click()  # Mean\n        output_mean = self.get_output(self.widget.Outputs.data)\n        with output.unlocked():\n            output.X = np.round(np.mean(self.data.X, axis=0), 1).reshape(1, 4)\n        self.assert_table_equal(output_mean, output)\n\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assertTrue((self.data.X.max(axis=0) >= output_random.X).all())\n        self.assertTrue((self.data.X.min(axis=0) <= output_random.X).all())\n\n        self.send_signal(self.widget.Inputs.data, self.data[9:10])\n        buttons[2].click()  # Random\n        output_random = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, self.data[9:10])\n\n        self.send_signal(self.widget.Inputs.reference, None)\n        buttons[3].click()  # Input\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output_random, output)\n\n    def test_initialize_buttons_commit_once(self):\n        self.widget.commit.deferred = self.widget.commit.now = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_table(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.assertEqual(self.widget.view.model().rowCount(), 5)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        data = Table(\"zoo\")\n        self.send_signal(self.widget.Inputs.data, data)\n        self.assertEqual(self.widget.view.model().rowCount(), 18)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertEqual(self.widget.view.model().rowCount(), 0)\n        self.assertEqual(self.widget.view.horizontalHeader().count(), 2)\n\n    def test_table_data_changed(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        index = self.widget.model.index(0, 1)\n        self.widget.model.setData(index, 7, role=ValueRole)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(output.X[150, 0], 7)\n\n    def test_datasets(self):\n        for ds in datasets.datasets():\n            self.send_signal(self.widget.Inputs.data, ds)\n\n    def test_missing_values(self):\n        domain = Domain([ContinuousVariable(\"c\")],\n                        class_vars=[DiscreteVariable(\"m\", (\"a\", \"b\"))])\n        data = Table(domain, np.array([[np.nan], [np.nan]]),\n                     np.array([np.nan, np.nan]))\n        self.widget.controls.append_to_data.setChecked(False)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output, data[:1])\n        self.assertTrue(self.widget.Information.nans_removed.is_shown())\n\n        self.send_signal(self.widget.Inputs.data, None)\n        self.assertFalse(self.widget.Information.nans_removed.is_shown())\n\n    def test_missing_values_reference(self):\n        reference = self.data[:1].copy()\n        with reference.unlocked():\n            reference[:] = np.nan\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, reference)\n        output1 = self.get_output(self.widget.Outputs.data)\n        buttons = self._get_init_buttons()\n        buttons[3].click()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_saved_workflow(self):\n        data = self.data\n        with data.unlocked():\n            data.X[:, 0] = np.nan\n        self.send_signal(self.widget.Inputs.data, data)\n        buttons = self._get_init_buttons()\n        buttons[2].click()  # Random\n        output1 = self.get_output(self.widget.Outputs.data)\n\n        settings = self.widget.settingsHandler.pack_data(self.widget)\n        widget = self.create_widget(OWCreateInstance, stored_settings=settings)\n        self.send_signal(widget.Inputs.data, data, widget=widget)\n        output2 = self.get_output(widget.Outputs.data)\n        self.assert_table_equal(output1, output2)\n\n    def test_commit_once(self):\n        self.widget.commit.now = self.widget.commit.deferred = Mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.now.assert_called_once()\n\n        self.widget.commit.now.reset_mock()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.commit.deferred.assert_called_once()\n\n        self.widget.commit.deferred.reset_mock()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.commit.deferred.assert_called_once()\n\n    def test_context_menu(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.send_signal(self.widget.Inputs.reference, self.data[:1])\n        output1 = self.get_output(self.widget.Outputs.data)\n        self.widget.view.customContextMenuRequested.emit(QPoint(0, 0))\n        menu = [w for w in self.widget.children() if isinstance(w, QMenu)][0]\n        self.assertEqual(len(menu.actions()), 4)\n\n        menu.actions()[3].trigger()  # Input\n        output2 = self.get_output(self.widget.Outputs.data)\n        np.testing.assert_array_equal(output2.X[:, 1:], output1.X[:, 1:])\n        np.testing.assert_array_equal(output2.X[150:, :1], self.data.X[:1, :1])\n\n    def test_report(self):\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.send_report()\n        self.send_signal(self.widget.Inputs.data, None)\n        self.widget.send_report()\n\n    def test_sparse(self):\n        data = self.data.to_sparse()\n        self.send_signal(self.widget.Inputs.data, data)\n        self.send_signal(self.widget.Inputs.reference, data)\n\n    def test_cascade_widgets(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n\n        widget = self.create_widget(OWCreateInstance)\n        self.send_signal(widget.Inputs.data, output, widget=widget)\n        output = self.get_output(widget.Outputs.data, widget=widget)\n        self.assertEqual(len(output), 152)\n        self.assertEqual(len(output.domain.metas), 1)\n        self.assertEqual(output.domain.metas[0].name, \"Source ID\")\n        self.assertTrue(all(output.metas[:150, 0] == 0))\n        self.assertTrue(all(output.metas[150:, 0] == 1))\n\n    def test_cascade_widgets_attributes(self):\n        data = self.data.copy()\n        data.domain.attributes[0].attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n    def test_cascade_widgets_class_vars(self):\n        data = self.data.copy()\n        data.domain.class_var.attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n        domain = Domain(data.domain.variables[:3], data.domain.variables[3:])\n        data = data.transform(domain)\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n        self.assertEqual(len(output.domain.metas), 0)\n\n\nclass TestDiscreteVariableEditor(GuiTest):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        cls.parent = QWidget()\n\n    def setUp(self):\n        self.callback = Mock()\n        self.editor = DiscreteVariableEditor(\n            self.parent, [\"Foo\", \"Bar\"], self.callback\n        )\n\n    def test_init(self):\n        self.assertEqual(self.editor.value, 0)\n        self.assertEqual(self.editor._combo.currentText(), \"Foo\")\n        self.callback.assert_not_called()\n\n    def test_edit(self):\n        \"\"\" Edit combo by user. \"\"\"\n        self.editor._combo.setCurrentText(\"Bar\")\n        self.assertEqual(self.editor.value, 1)\n        self.assertEqual(self.editor._combo.currentText(), \"Bar\")\n        self.callback.assert_called_once()\n\n    def test_set_value(self):\n        \"\"\" Programmatically set combo box value. \"\"\"\n        self.editor.value = 1\n        self.assertEqual(self.editor.value, 1)\n        self.assertEqual(self.editor._combo.currentText(), \"Bar\")\n        self.callback.assert_called_once()\n\n\nclass TestContinuousVariableEditor(GuiTest):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        cls.parent = QWidget()\n\n    def setUp(self):\n        self.callback = Mock()\n        data = Table(\"iris\")\n        values = data.get_column_view(data.domain[0])[0]\n        self.min_value = np.min(values)\n        self.max_value = np.max(values)\n        self.editor = ContinuousVariableEditor(\n            self.parent, data.domain[0], self.min_value,\n            self.max_value, self.callback\n        )\n\n    def test_init(self):\n        self.assertEqual(self.editor.value, self.min_value)\n        self.assertEqual(self.editor._slider.value(), self.min_value * 10)\n        self.assertEqual(self.editor._spin.value(), self.min_value)\n        self.callback.assert_not_called()\n\n    def test_edit_slider(self):\n        \"\"\" Edit slider by user. \"\"\"\n        self.editor._slider.setValue(int(self.max_value * 10))\n        self.assertEqual(self.editor.value, self.max_value)\n        self.assertEqual(self.editor._slider.value(), self.max_value * 10)\n        self.assertEqual(self.editor._spin.value(), self.max_value)\n        self.callback.assert_called_once()\n\n        self.callback.reset_mock()\n        value = self.min_value + (self.max_value - self.min_value) / 2\n        self.editor._slider.setValue(int(value * 10))\n        self.assertEqual(self.editor.value, value)\n        self.assertEqual(self.editor._slider.value(), value * 10)\n        self.assertEqual(self.editor._spin.value(), value)\n        self.callback.assert_called_once()\n\n    def test_edit_spin(self):\n        \"\"\" Edit spin by user. \"\"\"\n        self.editor._spin.setValue(self.max_value)\n        self.assertEqual(self.editor.value, self.max_value)\n        self.assertEqual(self.editor._slider.value(), self.max_value * 10)\n        self.assertEqual(self.editor._spin.value(), self.max_value)\n        self.callback.assert_called_once()\n\n        self.callback.reset_mock()\n        self.editor._spin.setValue(self.max_value + 1)\n        self.assertEqual(self.editor.value, self.max_value + 1)\n        self.assertEqual(self.editor._slider.value(), self.max_value * 10)\n        self.assertEqual(self.editor._spin.value(), self.max_value + 1)\n        self.callback.assert_called_once()\n\n        self.callback.reset_mock()\n        value = self.min_value + (self.max_value - self.min_value) / 2\n        self.editor._spin.setValue(value)\n        self.assertEqual(self.editor.value, value)\n        self.assertEqual(self.editor._slider.value(), value * 10)\n        self.assertEqual(self.editor._spin.value(), value)\n        self.callback.assert_called_once()\n\n    def test_set_value(self):\n        \"\"\" Programmatically set slider/spin value. \"\"\"\n        self.editor.value = -2\n        self.assertEqual(self.editor._slider.value(), self.min_value * 10)\n        self.assertEqual(self.editor._spin.value(), -2)\n        self.assertEqual(self.editor.value, -2)\n        self.callback.assert_called_once()\n\n        self.callback.reset_mock()\n        value = self.min_value + (self.max_value - self.min_value) / 4\n        self.editor.value = value\n        self.assertEqual(self.editor._slider.value(), value * 10)\n        self.assertEqual(self.editor._spin.value(), value)\n        self.assertEqual(self.editor.value, value)\n        self.callback.assert_called_once()\n\n    def test_missing_values(self):\n        var = ContinuousVariable(\"var\")\n        self.assertRaises(ValueError, ContinuousVariableEditor, self.parent,\n                          var, np.nan, np.nan, Mock())\n\n    def test_overflow(self):\n        var = ContinuousVariable(\"var\", number_of_decimals=10)\n        editor = ContinuousVariableEditor(\n            self.parent, var, -100000, 1, self.callback\n        )\n        self.assertLess(editor._n_decimals, 10)\n\n    def test_spin_selection_after_init(self):\n        edit: QLineEdit = self.editor._spin.lineEdit()\n        edit.selectAll()\n        self.assertEqual(edit.selectedText(), \"\")\n        self.assertIs(self.editor.focusProxy(), edit.parent())\n\n\nclass TestStringVariableEditor(GuiTest):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        cls.parent = QWidget()\n\n    def setUp(self):\n        self.callback = Mock()\n        self.editor = StringVariableEditor(self.parent, self.callback)\n\n    def test_init(self):\n        self.assertEqual(self.editor.value, \"\")\n        self.assertEqual(self.editor._edit.text(), \"\")\n        self.callback.assert_not_called()\n\n    def test_edit(self):\n        \"\"\" Set lineedit by user. \"\"\"\n        self.editor._edit.setText(\"Foo\")\n        self.assertEqual(self.editor.value, \"Foo\")\n        self.assertEqual(self.editor._edit.text(), \"Foo\")\n        self.callback.assert_called_once()\n\n    def test_set_value(self):\n        \"\"\" Programmatically set lineedit value. \"\"\"\n        self.editor.value = \"Foo\"\n        self.assertEqual(self.editor.value, \"Foo\")\n        self.assertEqual(self.editor._edit.text(), \"Foo\")\n        self.callback.assert_called_once()\n\n\ndef _datetime(y, m, d) -> QDateTime:\n    return QDateTime(QDate(y, m, d), QTime(0, 0))\n\n\nclass TestTimeVariableEditor(GuiTest):\n    @classmethod\n    def setUpClass(cls):\n        super().setUpClass()\n        cls.parent = QWidget()\n\n    def setUp(self):\n        self.callback = Mock()\n        self.editor = TimeVariableEditor(\n            self.parent, TimeVariable(\"var\", have_date=1), self.callback\n        )\n\n    def test_init(self):\n        self.assertEqual(self.editor.value, 0)\n        self.assertEqual(self.editor._edit.dateTime(), _datetime(1970, 1, 1))\n        self.callback.assert_not_called()\n\n    def test_edit(self):\n        \"\"\" Edit datetimeedit by user. \"\"\"\n        datetime = _datetime(2001, 9, 9,)\n        self.editor._edit.setDateTime(datetime)\n        self.assertEqual(self.editor.value, 999993600)\n        self.assertEqual(self.editor._edit.dateTime(), datetime)\n        self.callback.assert_called_once()\n\n    def test_set_value(self):\n        \"\"\" Programmatically set datetimeedit value. \"\"\"\n        value = 999993600\n        self.editor.value = value\n        self.assertEqual(self.editor._edit.dateTime(), _datetime(2001, 9, 9))\n        self.assertEqual(self.editor.value, value)\n        self.callback.assert_called_once()\n\n    def test_have_date_have_time(self):\n        callback = Mock()\n        editor = TimeVariableEditor(\n            self.parent, TimeVariable(\"var\", have_date=1, have_time=1),\n            callback\n        )\n        self.assertEqual(editor.value, 0)\n        self.assertEqual(self.editor._edit.dateTime(), _datetime(1970, 1, 1))\n        self.callback.assert_not_called()\n\n        datetime = QDateTime(QDate(2001, 9, 9), QTime(1, 2, 3))\n        editor._edit.setDateTime(datetime)\n        self.assertEqual(editor._edit.dateTime(), datetime)\n        self.assertEqual(editor.value, 999993600 + 3723)\n        callback.assert_called_once()\n\n    def test_have_time(self):\n        callback = Mock()\n        editor = TimeVariableEditor(\n            self.parent, TimeVariable(\"var\", have_time=1), callback\n        )\n        self.assertEqual(editor.value, 0)\n        self.assertEqual(self.editor._edit.dateTime(), _datetime(1970, 1, 1))\n        self.callback.assert_not_called()\n\n        datetime = QDateTime(QDate(1900, 1, 1), QTime(1, 2, 3))\n        editor._edit.setDateTime(datetime)\n        self.assertEqual(editor._edit.dateTime(), datetime)\n        self.assertEqual(editor.value, 3723)\n        callback.assert_called_once()\n\n    def test_no_date_no_time(self):\n        callback = Mock()\n        editor = TimeVariableEditor(self.parent, TimeVariable(\"var\"), callback)\n        self.assertEqual(editor.value, 0)\n        self.assertEqual(self.editor._edit.dateTime(), _datetime(1970, 1, 1))\n        self.callback.assert_not_called()\n\n        datetime = QDateTime(QDate(2001, 9, 9), QTime(1, 2, 3))\n        editor._edit.setDateTime(datetime)\n        self.assertEqual(editor._edit.dateTime(), datetime)\n        self.assertEqual(editor.value, 999993600 + 3723)\n        callback.assert_called_once()\n\n\nclass TestVariableDelegate(GuiTest):\n    def setUp(self):\n        self.data = Table(\"iris\")\n        self.model = model = VariableItemModel()\n        model.set_data(self.data)\n        widget = OWCreateInstance()\n        self.delegate = VariableDelegate(widget)\n        self.parent = QWidget()\n        self.opt = QStyleOptionViewItem()\n\n    def test_create_editor(self):\n        index = self.model.index(0, 1)\n        editor = self.delegate.createEditor(self.parent, self.opt, index)\n        self.assertIsInstance(editor, ContinuousVariableEditor)\n\n        index = self.model.index(4, 1)\n        editor = self.delegate.createEditor(self.parent, self.opt, index)\n        self.assertIsInstance(editor, DiscreteVariableEditor)\n\n    def test_set_editor_data(self):\n        index = self.model.index(0, 1)\n        editor = self.delegate.createEditor(self.parent, self.opt, index)\n        self.delegate.setEditorData(editor, index)\n        self.assertEqual(editor.value, np.median(self.data.X[:, 0]))\n\n    def test_set_model_data(self):\n        index = self.model.index(0, 1)\n        editor = self.delegate.createEditor(self.parent, self.opt, index)\n        editor.value = 7.5\n        self.delegate.setModelData(editor, self.model, index)\n        self.assertEqual(self.model.data(index, ValueRole), 7.5)\n\n    def test_editor_geometry(self):\n        index = self.model.index(0, 1)\n        editor = self.delegate.createEditor(self.parent, self.opt, index)\n        self.delegate.updateEditorGeometry(editor, self.opt, index)\n        self.assertGreaterEqual(editor.geometry().width(),\n                                self.opt.rect.width())\n\n        size = self.delegate.sizeHint(self.opt, index)\n        self.assertEqual(size.width(), editor.geometry().width())\n        self.assertEqual(size.height(), 40)\n\n\nif __name__ == \"__main__\":\n    import unittest\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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.33.0.dev0+86555e6 to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214\nProcessing dependencies for Orange3==3.33.0.dev0+86555e6\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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages\nSearching for pyqtgraph==0.12.3\nBest match: pyqtgraph 0.12.3\nAdding pyqtgraph 0.12.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages\nSearching for httpx==0.24.1\nBest match: httpx 0.24.1\nAdding httpx 0.24.1 to easy-install.pth file\nInstalling httpx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling pyrcc5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling pyuic5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling jupyter-migrate script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling jupyter-troubleshoot script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling jupyter-kernelspec script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling jupyter-run script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages\nSearching for httpcore==0.17.3\nBest match: httpcore 0.17.3\nAdding httpcore 0.17.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling iptest3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling ipython script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\nInstalling ipython3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages\nSearching for h11==0.14.0\nBest match: h11 0.14.0\nAdding h11 0.14.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.33.0.dev0+86555e6\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 213ms\nPrepared 18 packages in 8ms\nInstalled 18 packages in 706ms\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 54 packages in 300ms\nInstalled 47 packages in 600ms\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.14.0\n + httpcore==0.17.3\n + httpx==0.24.1\n + idna==3.10\n + importlib-resources==5.12.0\n + jaraco-classes==3.2.3\n + jeepney==0.8.0\n + joblib==1.3.2\n + keyring==24.1.1\n + keyrings-alt==4.2.0\n + kiwisolver==1.4.5\n + matplotlib==3.5.3\n + more-itertools==9.1.0\n + networkx==2.6.3\n + openpyxl==3.1.3\n + opentsne==1.0.1\n + pandas==1.3.5\n + pillow==9.5.0\n + pip==24.0\n + pycparser==2.21\n + pyparsing==3.1.4\n + python-dateutil==2.9.0.post0\n + python-louvain==0.16\n + pytz==2024.2\n + pyyaml==6.0.1\n + requests==2.31.0\n + 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 319ms\nInstalled 38 packages in 250ms\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.3\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 11ms\nInstalled 2 packages in 24ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nResolved 19 packages in 23ms\nInstalled 5 packages in 1.05s\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 4ms\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214/.venv/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.\n  setuptools.SetuptoolsDeprecationWarning,\nwarning: no files found matching 'README*' under directory 'Orange'\nwarning: no files found matching 'LICENSE' under directory 'Orange'\nwarning: no files found matching '*.basket' under directory 'Orange/datasets'\nwarning: no files found matching '*.svg' under directory 'Orange/canvas'\nwarning: no files found matching '*.js' under directory 'Orange/widgets'\nwarning: no files found matching '*.css' under directory 'Orange/widgets'\nwarning: no files found matching '*.html' under directory 'Orange/widgets'\nwarning: no files found matching '*.svg' under directory 'distribute'\nwarning: no files found matching 'COPYING'\n",
    "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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214\nplugins: anyio-3.7.1\ncollected 46 items\n\nr2e_tests/test_1.py sss.........F.................................       [100%]\n\n=================================== FAILURES ===================================\n____________________ TestOWCreateInstance.test_minimum_size ____________________\n\nself = <r2e_tests.test_1.TestOWCreateInstance 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: 1026 not less than 800\n==================================== PASSES ====================================\n____________________ TestOWCreateInstance.test_context_menu ____________________\n----------------------------- Captured stderr call -----------------------------\nThis plugin does not support raise()\nThis plugin does not support grabbing the keyboard\n--------------------------- Captured stderr teardown ---------------------------\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_cascade_widgets\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_cascade_widgets_attributes\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_cascade_widgets_class_vars\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_commit_once\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_context_menu\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_datasets\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_image_export\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_initialize_buttons\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_initialize_buttons_commit_once\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_missing_values\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_missing_values_reference\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_output\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_output_append_data\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_report\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_saved_workflow\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_sparse\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_table\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_table_data_changed\nPASSED r2e_tests/test_1.py::TestDiscreteVariableEditor::test_edit\nPASSED r2e_tests/test_1.py::TestDiscreteVariableEditor::test_init\nPASSED r2e_tests/test_1.py::TestDiscreteVariableEditor::test_set_value\nPASSED r2e_tests/test_1.py::TestContinuousVariableEditor::test_edit_slider\nPASSED r2e_tests/test_1.py::TestContinuousVariableEditor::test_edit_spin\nPASSED r2e_tests/test_1.py::TestContinuousVariableEditor::test_init\nPASSED r2e_tests/test_1.py::TestContinuousVariableEditor::test_missing_values\nPASSED r2e_tests/test_1.py::TestContinuousVariableEditor::test_overflow\nPASSED r2e_tests/test_1.py::TestContinuousVariableEditor::test_set_value\nPASSED r2e_tests/test_1.py::TestContinuousVariableEditor::test_spin_selection_after_init\nPASSED r2e_tests/test_1.py::TestStringVariableEditor::test_edit\nPASSED r2e_tests/test_1.py::TestStringVariableEditor::test_init\nPASSED r2e_tests/test_1.py::TestStringVariableEditor::test_set_value\nPASSED r2e_tests/test_1.py::TestTimeVariableEditor::test_edit\nPASSED r2e_tests/test_1.py::TestTimeVariableEditor::test_have_date_have_time\nPASSED r2e_tests/test_1.py::TestTimeVariableEditor::test_have_time\nPASSED r2e_tests/test_1.py::TestTimeVariableEditor::test_init\nPASSED r2e_tests/test_1.py::TestTimeVariableEditor::test_no_date_no_time\nPASSED r2e_tests/test_1.py::TestTimeVariableEditor::test_set_value\nPASSED r2e_tests/test_1.py::TestVariableDelegate::test_create_editor\nPASSED r2e_tests/test_1.py::TestVariableDelegate::test_editor_geometry\nPASSED r2e_tests/test_1.py::TestVariableDelegate::test_set_editor_data\nPASSED r2e_tests/test_1.py::TestVariableDelegate::test_set_model_data\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::TestOWCreateInstance::test_minimum_size - Asserti...\n=================== 1 failed, 42 passed, 3 skipped in 6.30s ====================\nWidgets left: 0    Max widgets: 2901 \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_86555e61ce6d20da2f5e3f6e081bd80f02d6b214\nplugins: anyio-3.7.1\ncollected 46 items\n\nr2e_tests/test_1.py sssFFF......F....F............................       [100%]\n\n=================================== FAILURES ===================================\n__________________ TestOWCreateInstance.test_cascade_widgets ___________________\n\nself = <r2e_tests.test_1.TestOWCreateInstance testMethod=test_cascade_widgets>\n\n    def test_cascade_widgets(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        output = self.get_output(self.widget.Outputs.data)\n    \n        widget = self.create_widget(OWCreateInstance)\n>       self.send_signal(widget.Inputs.data, output, widget=widget)\n\nr2e_tests/test_1.py:223: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n.venv/lib/python3.7/site-packages/orangewidget/tests/base.py:446: in send_signal\n    widget=widget, wait=wait)\n.venv/lib/python3.7/site-packages/orangewidget/tests/base.py:471: in send_signals\n    self._send_signal(widget, input, value, *args)\n.venv/lib/python3.7/site-packages/orangewidget/tests/base.py:490: in _send_signal\n    notify_input_helper(input, widget, value, *args, **kwargs)\n../../../../.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/lib/python3.7/functools.py:840: in wrapper\n    return dispatch(args[0].__class__)(*args, **kw)\n.venv/lib/python3.7/site-packages/orangewidget/utils/signals.py:735: in set_input_helper\n    handler(*args)\n.venv/lib/python3.7/site-packages/orangewidget/utils/signals.py:208: in summarize_wrapper\n    method(widget, value)\nOrange/widgets/data/owcreateinstance.py:605: in set_data\n    self.commit.now()\n.venv/lib/python3.7/site-packages/orangewidget/gui.py:2007: in do_commit\n    commit.call()\n.venv/lib/python3.7/site-packages/orangewidget/gui.py:1872: in call\n    acting_func(instance)\nOrange/widgets/data/owcreateinstance.py:630: in commit\n    output_data = self._append_to_data(output_data)\nOrange/widgets/data/owcreateinstance.py:656: in _append_to_data\n    data.domain.metas + (var,))\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <[AttributeError(\"'Domain' object has no attribute 'attributes'\") raised in repr()] Domain object at 0x7c7044b65310>\nattributes = [ContinuousVariable(name='sepal length', number_of_decimals=1), ContinuousVariable(name='sepal width', number_of_decim...nuousVariable(name='petal length', number_of_decimals=1), ContinuousVariable(name='petal width', number_of_decimals=1)]\nclass_vars = [DiscreteVariable(name='iris', values=('Iris-setosa', 'Iris-versicolor', 'Iris-virginica'))]\nmetas = [DiscreteVariable(name='Source ID', values=('iris', 'created')), DiscreteVariable(name='Source ID', values=('iris', 'created'))]\nsource = None\n\n    def __init__(self, attributes, class_vars=None, metas=None, source=None):\n        \"\"\"\n        Initialize a new domain descriptor. Arguments give the features and\n        the class attribute(s). They can be described by descriptors (instances\n        of :class:`Variable`), or by indices or names if the source domain is\n        given.\n    \n        :param attributes: a list of attributes\n        :type attributes: list of :class:`Variable`\n        :param class_vars: target variable or a list of target variables\n        :type class_vars: :class:`Variable` or list of :class:`Variable`\n        :param metas: a list of meta attributes\n        :type metas: list of :class:`Variable`\n        :param source: the source domain for attributes\n        :type source: Orange.data.Domain\n        :return: a new domain\n        :rtype: :class:`Domain`\n        \"\"\"\n    \n        if class_vars is None:\n            class_vars = []\n        elif isinstance(class_vars, (Variable, Integral, str)):\n            class_vars = [class_vars]\n        elif isinstance(class_vars, Iterable):\n            class_vars = list(class_vars)\n    \n        if not isinstance(attributes, list):\n            attributes = list(attributes)\n        metas = list(metas) if metas else []\n    \n        # Replace str's and int's with descriptors if 'source' is given;\n        # complain otherwise\n        for lst in (attributes, class_vars, metas):\n            for i, var in enumerate(lst):\n                if not isinstance(var, Variable):\n                    if source is not None and isinstance(var, (str, int)):\n                        lst[i] = source[var]\n                    else:\n                        raise TypeError(\n                            \"descriptors must be instances of Variable, \"\n                            \"not '%s'\" % type(var).__name__)\n    \n        names = [var.name for var in chain(attributes, class_vars, metas)]\n        if len(names) != len(set(names)):\n>           raise Exception('All variables in the domain should have'\n                            ' unique names.')\nE           Exception: All variables in the domain should have unique names.\n\nOrange/data/domain.py:154: Exception\n_____________ TestOWCreateInstance.test_cascade_widgets_attributes _____________\n\nself = <r2e_tests.test_1.TestOWCreateInstance testMethod=test_cascade_widgets_attributes>\n\n    def test_cascade_widgets_attributes(self):\n        data = self.data.copy()\n        data.domain.attributes[0].attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n>       self.assertEqual(len(output.domain.metas), 0)\nE       AssertionError: 1 != 0\n\nr2e_tests/test_1.py:239: AssertionError\n_____________ TestOWCreateInstance.test_cascade_widgets_class_vars _____________\n\nself = <r2e_tests.test_1.TestOWCreateInstance testMethod=test_cascade_widgets_class_vars>\n\n    def test_cascade_widgets_class_vars(self):\n        data = self.data.copy()\n        data.domain.class_var.attributes = \\\n            {\"__source_widget\": OWCreateInstance}\n        self.send_signal(self.widget.Inputs.data, data)\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n        self.assertEqual(len(output.domain.variables), 5)\n>       self.assertEqual(len(output.domain.metas), 0)\nE       AssertionError: 1 != 0\n\nr2e_tests/test_1.py:249: AssertionError\n____________________ TestOWCreateInstance.test_minimum_size ____________________\n\nself = <r2e_tests.test_1.TestOWCreateInstance 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: 1026 not less than 800\n_________________ TestOWCreateInstance.test_output_append_data _________________\n\nself = <r2e_tests.test_1.TestOWCreateInstance testMethod=test_output_append_data>\n\n    def test_output_append_data(self):\n        self.send_signal(self.widget.Inputs.data, self.data)\n        self.widget.controls.append_to_data.setChecked(True)\n    \n        output = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(output), 151)\n    \n        np.testing.assert_array_equal(output.X[:150], self.data.X)\n        np.testing.assert_array_equal(output.Y[:150], self.data.Y)\n        array = np.zeros((150, 1), dtype=object)\n        np.testing.assert_array_equal(output.metas[:150], array)\n    \n        array = np.round(np.median(self.data.X, axis=0), 1).reshape(1, 4)\n        np.testing.assert_array_equal(output.X[150:], array)\n        np.testing.assert_array_equal(output.Y[150:], np.array([0]))\n        np.testing.assert_array_equal(output.metas[150:], np.array([[1]]))\n    \n        self.assertEqual(output.domain.attributes, self.data.domain.attributes)\n        self.assertEqual(output.domain.class_vars, self.data.domain.class_vars)\n        self.assertIn(\"Source ID\", [m.name for m in output.domain.metas])\n        self.assertTupleEqual(output.domain.metas[0].values,\n                              (\"iris\", \"created\"))\n        self.assertDictEqual(output.domain.metas[0].attributes,\n>                            {\"__source_widget\": OWCreateInstance})\nE       AssertionError: {} != {'__source_widget': <class 'Orange.widgets[37 chars]ce'>}\nE       - {}\nE       + {'__source_widget': <class 'Orange.widgets.data.owcreateinstance.OWCreateInstance'>}\n\nr2e_tests/test_1.py:58: AssertionError\n==================================== PASSES ====================================\n____________________ TestOWCreateInstance.test_context_menu ____________________\n----------------------------- Captured stderr call -----------------------------\nThis plugin does not support raise()\nThis plugin does not support grabbing the keyboard\n--------------------------- Captured stderr teardown ---------------------------\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\nThis plugin does not support grabbing the keyboard\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_commit_once\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_context_menu\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_datasets\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_image_export\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_initialize_buttons\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_initialize_buttons_commit_once\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_missing_values\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_missing_values_reference\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_output\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_report\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_saved_workflow\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_sparse\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_table\nPASSED r2e_tests/test_1.py::TestOWCreateInstance::test_table_data_changed\nPASSED r2e_tests/test_1.py::TestDiscreteVariableEditor::test_edit\nPASSED r2e_tests/test_1.py::TestDiscreteVariableEditor::test_init\nPASSED r2e_tests/test_1.py::TestDiscreteVariableEditor::test_set_value\nPASSED r2e_tests/test_1.py::TestContinuousVariableEditor::test_edit_slider\nPASSED r2e_tests/test_1.py::TestContinuousVariableEditor::test_edit_spin\nPASSED r2e_tests/test_1.py::TestContinuousVariableEditor::test_init\nPASSED r2e_tests/test_1.py::TestContinuousVariableEditor::test_missing_values\nPASSED r2e_tests/test_1.py::TestContinuousVariableEditor::test_overflow\nPASSED r2e_tests/test_1.py::TestContinuousVariableEditor::test_set_value\nPASSED r2e_tests/test_1.py::TestContinuousVariableEditor::test_spin_selection_after_init\nPASSED r2e_tests/test_1.py::TestStringVariableEditor::test_edit\nPASSED r2e_tests/test_1.py::TestStringVariableEditor::test_init\nPASSED r2e_tests/test_1.py::TestStringVariableEditor::test_set_value\nPASSED r2e_tests/test_1.py::TestTimeVariableEditor::test_edit\nPASSED r2e_tests/test_1.py::TestTimeVariableEditor::test_have_date_have_time\nPASSED r2e_tests/test_1.py::TestTimeVariableEditor::test_have_time\nPASSED r2e_tests/test_1.py::TestTimeVariableEditor::test_init\nPASSED r2e_tests/test_1.py::TestTimeVariableEditor::test_no_date_no_time\nPASSED r2e_tests/test_1.py::TestTimeVariableEditor::test_set_value\nPASSED r2e_tests/test_1.py::TestVariableDelegate::test_create_editor\nPASSED r2e_tests/test_1.py::TestVariableDelegate::test_editor_geometry\nPASSED r2e_tests/test_1.py::TestVariableDelegate::test_set_editor_data\nPASSED r2e_tests/test_1.py::TestVariableDelegate::test_set_model_data\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::TestOWCreateInstance::test_cascade_widgets - Exce...\nFAILED r2e_tests/test_1.py::TestOWCreateInstance::test_cascade_widgets_attributes\nFAILED r2e_tests/test_1.py::TestOWCreateInstance::test_cascade_widgets_class_vars\nFAILED r2e_tests/test_1.py::TestOWCreateInstance::test_minimum_size - Asserti...\nFAILED r2e_tests/test_1.py::TestOWCreateInstance::test_output_append_data - A...\n=================== 5 failed, 38 passed, 3 skipped in 4.89s ====================\nWidgets left: 0    Max widgets: 2853 \n\n",
    "old_commit_res_stderr": ""
}
Orange/widgets/data/owcreateinstance.py Orange/widgets/data/tests/test_owcreateinstance.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** AttributeError and Incorrect Meta Variables When Creating Instance Cascade

**Description:**
When using the `OWCreateInstance` widget to create an instance cascade, an `AttributeError` is raised because the `Domain` object lacks the `attributes` attribute. Additionally, the number of meta variables does not match the expected count, leading to inconsistencies in data processing.

**Example Code:**
```python
data = Table('iris')
widget = OWCreateInstance()
widget.send_signal('data', data)
output = widget.get_output('data')
# Expected: output.domain.metas has 0 meta variables
# Actual: AttributeError and metas count is 1
```

**Expected Behavior:**
Creating an instance cascade should correctly manage the `Domain`'s attributes, ensuring unique source variable names without raising errors. The number of meta variables should align with expectations, maintaining data integrity.

**Actual Behavior:**
An `AttributeError` is raised stating that the `'Domain' object has no attribute 'attributes'`. Additionally, the meta variables count does not match the expected number, causing assertion failures during tests.
[/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/owcreateinstance.py
from typing import Optional, Callable, List, Union, Dict
from collections import namedtuple
from functools import singledispatch

import numpy as np

from AnyQt.QtCore import Qt, QSortFilterProxyModel, QSize, QDateTime, \
    QModelIndex, Signal, QPoint, QRect, QEvent
from AnyQt.QtGui import QStandardItemModel, QStandardItem, QIcon, QPainter, \
    QColor
from AnyQt.QtWidgets import QLineEdit, QTableView, QSlider, \
    QComboBox, QStyledItemDelegate, QWidget, QDateTimeEdit, QHBoxLayout, \
    QDoubleSpinBox, QSizePolicy, QStyleOptionViewItem, QLabel, QMenu, QAction

from orangewidget.gui import Slider

from Orange.data import DiscreteVariable, ContinuousVariable, \
    TimeVariable, Table, StringVariable, Variable, Domain
from Orange.widgets import gui
from Orange.widgets.utils.itemmodels import TableModel
from Orange.widgets.settings import Setting
from Orange.widgets.utils.widgetpreview import WidgetPreview
from Orange.widgets.widget import OWWidget, Input, Output, Msg

VariableRole = next(gui.OrangeUserRole)
ValuesRole = next(gui.OrangeUserRole)
ValueRole = next(gui.OrangeUserRole)


class VariableEditor(QWidget):
    valueChanged = Signal(float)

    def __init__(self, parent: QWidget, callback: Callable):
        super().__init__(parent)
        layout = QHBoxLayout()
        layout.setContentsMargins(6, 0, 6, 0)
        layout.setAlignment(Qt.AlignLeft)
        self.setLayout(layout)
        self.valueChanged.connect(callback)

    @property
    def value(self) -> Union[int, float, str]:
        return NotImplemented

    @value.setter
    def value(self, value: Union[float, str]):
        raise NotImplementedError

    def sizeHint(self):
        return QSize(super().sizeHint().width(), 40)


class DiscreteVariableEditor(VariableEditor):
    valueChanged = Signal(int)

    def __init__(self, parent: QWidget, items: List[str], callback: Callable):
        super().__init__(parent, callback)
        self._combo = QComboBox(
            parent,
            maximumWidth=180,
            sizePolicy=QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        )
        self._combo.addItems(items)
        self._combo.currentIndexChanged.connect(self.valueChanged)
        self.layout().addWidget(self._combo)

    @property
    def value(self) -> int:
        return self._combo.currentIndex()

    @value.setter
    def value(self, value: float):
        assert value == int(value)
        self._combo.setCurrentIndex(int(value))


class ContinuousVariableEditor(VariableEditor):
    MAX_FLOAT = 2147483647

    def __init__(self, parent: QWidget, variable: ContinuousVariable,
                 min_value: float, max_value: float, callback: Callable):
        super().__init__(parent, callback)

        if np.isnan(min_value) or np.isnan(max_value):
            raise ValueError("Min/Max cannot be NaN.")

        n_decimals = variable.number_of_decimals
        abs_max = max(abs(min_value), max_value)
        if abs_max * 10 ** n_decimals > self.MAX_FLOAT:
            n_decimals = int(np.log10(self.MAX_FLOAT / abs_max))

        self._value: float = min_value
        self._n_decimals: int = n_decimals
        self._min_value: float = self.__round_value(min_value)
        self._max_value: float = self.__round_value(max_value)

        sp_spin = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        sp_spin.setHorizontalStretch(1)
        sp_slider = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        sp_slider.setHorizontalStretch(5)
        sp_edit = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        sp_edit.setHorizontalStretch(1)

        class DoubleSpinBox(QDoubleSpinBox):
            def sizeHint(self) -> QSize:
                size: QSize = super().sizeHint()
                return QSize(size.width(), size.height() + 2)

        self._spin = DoubleSpinBox(
            parent,
            value=self._min_value,
            minimum=-np.inf,
            maximum=np.inf,
            singleStep=10 ** (-self._n_decimals),
            decimals=self._n_decimals,
            minimumWidth=70,
            sizePolicy=sp_spin,
        )
        self._slider = Slider(
            parent,
            minimum=self.__map_to_slider(self._min_value),
            maximum=self.__map_to_slider(self._max_value),
            singleStep=1,
            orientation=Qt.Horizontal,
            sizePolicy=sp_slider,
        )
        self._label_min = QLabel(
            parent,
            text=variable.repr_val(min_value),
            alignment=Qt.AlignRight,
            minimumWidth=60,
            sizePolicy=sp_edit,
        )
        self._label_max = QLabel(
            parent,
            text=variable.repr_val(max_value),
            alignment=Qt.AlignLeft,
            minimumWidth=60,
            sizePolicy=sp_edit,
        )

        self._slider.valueChanged.connect(self._apply_slider_value)
        self._spin.valueChanged.connect(self._apply_spin_value)

        self.layout().addWidget(self._spin)
        self.layout().addWidget(self._label_min)
        self.layout().addWidget(self._slider)
        self.layout().addWidget(self._label_max)

        self.setFocusProxy(self._spin)

        def deselect():
            self._spin.lineEdit().deselect()
            try:
                self._spin.lineEdit().selectionChanged.disconnect(deselect)
            except TypeError:
                pass

        # Invoking self.setFocusProxy(self._spin), causes the
        # self._spin.lineEdit()s to have selected texts (focus is set to
        # provide keyboard functionality, i.e.: pressing ESC after changing
        # spinbox value). Since the spin text is selected only after the
        # delegate draws it, it cannot be deselected during initialization.
        # Therefore connect the deselect() function to
        # self._spin.lineEdit().selectionChanged only for editor creation.
        self._spin.lineEdit().selectionChanged.connect(deselect)

        self._slider.installEventFilter(self)
        self._spin.installEventFilter(self)

    @property
    def value(self) -> float:
        return self.__round_value(self._value)

    @value.setter
    def value(self, value: float):
        if self._value is None or self.__round_value(value) != self.value:
            self._value = value
            self.valueChanged.emit(self.value)
            self._spin.setValue(self.value)
            # prevent emitting self.valueChanged again, due to slider change
            slider_value = self.__map_to_slider(self.value)
            self._value = self.__map_from_slider(slider_value)
            self._slider.setValue(slider_value)
            self._value = value

    def _apply_slider_value(self):
        self.value = self.__map_from_slider(self._slider.value())

    def _apply_spin_value(self):
        self.value = self._spin.value()

    def __round_value(self, value):
        return round(value, self._n_decimals)

    def __map_to_slider(self, value: float) -> int:
        value = min(self._max_value, max(self._min_value, value))
        return round(value * 10 ** self._n_decimals)

    def __map_from_slider(self, value: int) -> float:
        return value * 10 ** (-self._n_decimals)

    def eventFilter(self, obj: Union[QSlider, QDoubleSpinBox], event: QEvent) \
            -> bool:
        if event.type() == QEvent.Wheel:
            return True
        return super().eventFilter(obj, event)


class StringVariableEditor(VariableEditor):
    valueChanged = Signal()

    def __init__(self, parent: QWidget, callback: Callable):
        super().__init__(parent, callback)
        self._edit = QLineEdit(
            parent,
            sizePolicy=QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        )
        self._edit.textChanged.connect(self.valueChanged)
        self.layout().addWidget(self._edit)
        self.setFocusProxy(self._edit)

    @property
    def value(self) -> str:
        return self._edit.text()

    @value.setter
    def value(self, value: str):
        self._edit.setText(value)


class TimeVariableEditor(VariableEditor):
    DATE_FORMAT = "yyyy-MM-dd"
    TIME_FORMAT = "hh:mm:ss"

    def __init__(self, parent: QWidget, variable: TimeVariable,
                 callback: Callable):
        super().__init__(parent, callback)
        self._value: float = 0
        self._variable: TimeVariable = variable

        if variable.have_date and not variable.have_time:
            self._format = TimeVariableEditor.DATE_FORMAT
        elif not variable.have_date and variable.have_time:
            self._format = TimeVariableEditor.TIME_FORMAT
        else:
            self._format = f"{TimeVariableEditor.DATE_FORMAT} " \
                           f"{TimeVariableEditor.TIME_FORMAT}"

        class DateTimeEdit(QDateTimeEdit):
            def sizeHint(self) -> QSize:
                size: QSize = super().sizeHint()
                return QSize(size.width(), size.height() + 2)

        self._edit = DateTimeEdit(
            parent,
            dateTime=self.__map_to_datetime(self._value),
            displayFormat=self._format,
            sizePolicy=QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        )
        self._edit.dateTimeChanged.connect(self._apply_edit_value)

        self.layout().addWidget(self._edit)
        self.setFocusProxy(self._edit)

        self._edit.installEventFilter(self)

    @property
    def value(self) -> float:
        return self._value

    @value.setter
    def value(self, value: float):
        if value != self.value:
            self._value = value
            self.valueChanged.emit(self.value)
            self._edit.setDateTime(self.__map_to_datetime(self.value))

    def _apply_edit_value(self):
        self.value = self.__map_from_datetime(self._edit.dateTime())

    def __map_from_datetime(self, date_time: QDateTime) -> float:
        return self._variable.to_val(date_time.toString(self._format))

    def __map_to_datetime(self, value: float) -> QDateTime:
        return QDateTime.fromString(self._variable.repr_val(value),
                                    self._format)

    def eventFilter(self, obj: QDateTimeEdit, event: QEvent) -> bool:
        if event.type() == QEvent.Wheel:
            return True
        return super().eventFilter(obj, event)


class VariableDelegate(QStyledItemDelegate):
    def paint(self, painter: QPainter, option: QStyleOptionViewItem,
              index: QModelIndex):
        self.parent().view.openPersistentEditor(index)
        super().paint(painter, option, index)

    def createEditor(self, parent: QWidget, _: QStyleOptionViewItem,
                     index: QModelIndex) -> VariableEditor:
        variable = index.data(VariableRole)
        values = index.data(ValuesRole)
        return _create_editor(variable, values, parent, self._commit_data)

    def _commit_data(self):
        editor = self.sender()
        assert isinstance(editor, VariableEditor)
        self.commitData.emit(editor)

    # pylint: disable=no-self-use
    def setEditorData(self, editor: VariableEditor, index: QModelIndex):
        editor.value = index.model().data(index, ValueRole)

    # pylint: disable=no-self-use
    def setModelData(self, editor: VariableEditor,
                     model: QSortFilterProxyModel, index: QModelIndex):
        model.setData(index, editor.value, ValueRole)

    # pylint: disable=no-self-use
    def updateEditorGeometry(self, editor: VariableEditor,
                             option: QStyleOptionViewItem, _: QModelIndex):
        rect: QRect = option.rect
        if isinstance(editor, ContinuousVariableEditor):
            width = editor.sizeHint().width()
            if width > rect.width():
                rect.setWidth(width)
        editor.setGeometry(rect)

    # pylint: disable=no-self-use
    def sizeHint(self, _: QStyleOptionViewItem, index: QModelIndex) -> QSize:
        return _create_editor(index.data(role=VariableRole), np.array([0]),
                              None, lambda: 1).sizeHint()


@singledispatch
def _create_editor(*_) -> VariableEditor:
    raise NotImplementedError


@_create_editor.register(DiscreteVariable)
def _(variable: DiscreteVariable, _: np.ndarray,
      parent: QWidget, callback: Callable) -> DiscreteVariableEditor:
    return DiscreteVariableEditor(parent, variable.values, callback)


@_create_editor.register(ContinuousVariable)
def _(variable: ContinuousVariable, values: np.ndarray,
      parent: QWidget, callback: Callable) -> ContinuousVariableEditor:
    return ContinuousVariableEditor(parent, variable, np.nanmin(values),
                                    np.nanmax(values), callback)


@_create_editor.register(StringVariable)
def _(_: StringVariable, __: np.ndarray, parent: QWidget,
      callback: Callable) -> StringVariableEditor:
    return StringVariableEditor(parent, callback)


@_create_editor.register(TimeVariable)
def _(variable: TimeVariable, _: np.ndarray,
      parent: QWidget, callback: Callable) -> TimeVariableEditor:
    return TimeVariableEditor(parent, variable, callback)


def majority(values: np.ndarray) -> int:
    return np.bincount(values[~np.isnan(values)].astype(int)).argmax()


def disc_random(values: np.ndarray) -> int:
    return np.random.randint(low=np.nanmin(values), high=np.nanmax(values) + 1)


def cont_random(values: np.ndarray) -> float:
    return np.random.uniform(low=np.nanmin(values), high=np.nanmax(values))


class VariableItemModel(QStandardItemModel):
    dataHasNanColumn = Signal()

    # pylint: disable=dangerous-default-value
    def set_data(self, data: Table, saved_values={}):
        domain = data.domain
        variables = [(TableModel.Attribute, a) for a in domain.attributes] + \
                    [(TableModel.ClassVar, c) for c in domain.class_vars] + \
                    [(TableModel.Meta, m) for m in domain.metas]
        for place, variable in variables:
            if variable.is_primitive():
                values = data.get_column_view(variable)[0].astype(float)
                if all(np.isnan(values)):
                    self.dataHasNanColumn.emit()
                    continue
            else:
                values = np.array([])
            color = TableModel.ColorForRole.get(place)
            self._add_row(variable, values, color,
                          saved_values.get(variable.name))

    def _add_row(self, variable: Variable, values: np.ndarray, color: QColor,
                 saved_value: Optional[Union[int, float, str]]):
        var_item = QStandardItem()
        var_item.setData(variable.name, Qt.DisplayRole)
        var_item.setToolTip(variable.name)
        var_item.setIcon(self._variable_icon(variable))
        var_item.setEditable(False)
        if color:
            var_item.setBackground(color)

        control_item = QStandardItem()
        control_item.setData(variable, VariableRole)
        control_item.setData(values, ValuesRole)
        if color:
            control_item.setBackground(color)

        value = self._default_for_variable(variable, values)
        if saved_value is not None and not \
                (variable.is_discrete and saved_value >= len(variable.values)):
            value = saved_value
        control_item.setData(value, ValueRole)

        self.appendRow([var_item, control_item])

    @staticmethod
    def _default_for_variable(variable: Variable, values: np.ndarray) \
            -> Union[float, int, str]:
        if variable.is_continuous:
            return round(np.nanmedian(values), variable.number_of_decimals)
        elif variable.is_discrete:
            return majority(values)
        elif variable.is_string:
            return ""
        else:
            raise NotImplementedError

    @staticmethod
    def _variable_icon(variable: Variable) -> QIcon:
        if variable.is_discrete:
            return gui.attributeIconDict[1]
        elif variable.is_time:
            return gui.attributeIconDict[4]
        elif variable.is_continuous:
            return gui.attributeIconDict[2]
        elif variable.is_string:
            return gui.attributeIconDict[3]
        else:
            return gui.attributeIconDict[-1]


class OWCreateInstance(OWWidget):
    name = "Create Instance"
    description = "Interactively create a data instance from sample dataset."
    icon = "icons/CreateInstance.svg"
    category = "Transform"
    keywords = ["simulator"]
    priority = 2310

    class Inputs:
        data = Input("Data", Table)
        reference = Input("Reference", Table)

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

    class Information(OWWidget.Information):
        nans_removed = Msg("Variables with only missing values were "
                           "removed from the list.")

    want_main_area = False
    ACTIONS = ["median", "mean", "random", "input"]
    HEADER = [["name", "Variable"],
              ["variable", "Value"]]
    Header = namedtuple(
        "header", [tag for tag, _ in HEADER]
    )(*range(len(HEADER)))

    values: Dict[str, Union[float, str]] = Setting({}, schema_only=True)
    append_to_data = Setting(True)
    auto_commit = Setting(True)

    def __init__(self):
        super().__init__()
        self.data: Optional[Table] = None
        self.reference: Optional[Table] = None

        self.filter_edit = QLineEdit(textChanged=self.__filter_edit_changed,
                                     placeholderText="Filter...")
        self.view = QTableView(sortingEnabled=True,
                               contextMenuPolicy=Qt.CustomContextMenu,
                               selectionMode=QTableView.NoSelection)
        self.view.customContextMenuRequested.connect(self.__menu_requested)
        self.view.setItemDelegateForColumn(
            self.Header.variable, VariableDelegate(self)
        )
        self.view.verticalHeader().hide()
        self.view.horizontalHeader().setStretchLastSection(True)
        self.view.horizontalHeader().setMaximumSectionSize(350)

        self.model = VariableItemModel(self)
        self.model.setHorizontalHeaderLabels([x for _, x in self.HEADER])
        self.model.dataChanged.connect(self.__table_data_changed)
        self.model.dataHasNanColumn.connect(self.Information.nans_removed)
        self.proxy_model = QSortFilterProxyModel()
        self.proxy_model.setFilterKeyColumn(-1)
        self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive)
        self.proxy_model.setSourceModel(self.model)
        self.view.setModel(self.proxy_model)

        vbox = gui.vBox(self.controlArea, box=True)
        vbox.layout().addWidget(self.filter_edit)
        vbox.layout().addWidget(self.view)

        box = gui.hBox(vbox, objectName="buttonBox")
        gui.rubber(box)
        for name in self.ACTIONS:
            gui.button(
                box, self, name.capitalize(),
                lambda *args, fun=name: self._initialize_values(fun),
                autoDefault=False
            )
        gui.rubber(box)

        gui.checkBox(self.buttonsArea, self, "append_to_data",
                     "Append this instance to input data",
                     callback=self.commit.deferred)
        gui.rubber(self.buttonsArea)
        gui.auto_apply(self.buttonsArea, self, "auto_commit")

        self.settingsAboutToBePacked.connect(self.pack_settings)

    def __filter_edit_changed(self):
        self.proxy_model.setFilterFixedString(self.filter_edit.text().strip())

    def __table_data_changed(self):
        self.commit.deferred()

    def __menu_requested(self, point: QPoint):
        index = self.view.indexAt(point)
        model: QSortFilterProxyModel = index.model()
        source_index = model.mapToSource(index)
        menu = QMenu(self)
        for action in self._create_actions(source_index):
            menu.addAction(action)
        menu.popup(self.view.viewport().mapToGlobal(point))

    def _create_actions(self, index: QModelIndex) -> List[QAction]:
        actions = []
        for name in self.ACTIONS:
            action = QAction(name.capitalize(), self)
            action.triggered.connect(
                lambda *args, fun=name: self._initialize_values(fun, [index])
            )
            actions.append(action)
        return actions

    def _initialize_values(self, fun: str, indices: List[QModelIndex] = None):
        cont_fun = {"median": np.nanmedian,
                    "mean": np.nanmean,
                    "random": cont_random,
                    "input": np.nanmean}.get(fun, NotImplemented)
        disc_fun = {"median": majority,
                    "mean": majority,
                    "random": disc_random,
                    "input": majority}.get(fun, NotImplemented)

        if not self.data or fun == "input" and not self.reference:
            return

        self.model.dataChanged.disconnect(self.__table_data_changed)
        rows = range(self.proxy_model.rowCount()) if indices is None else \
            [index.row() for index in indices]
        for row in rows:
            index = self.model.index(row, self.Header.variable)
            variable = self.model.data(index, VariableRole)

            if fun == "input":
                if variable not in self.reference.domain:
                    continue
                values = self.reference.get_column_view(variable)[0]
                if variable.is_primitive():
                    values = values.astype(float)
                    if all(np.isnan(values)):
                        continue
            else:
                values = self.model.data(index, ValuesRole)

            if variable.is_continuous:
                value = cont_fun(values)
                value = round(value, variable.number_of_decimals)
            elif variable.is_discrete:
                value = disc_fun(values)
            elif variable.is_string:
                value = ""
            else:
                raise NotImplementedError

            self.model.setData(index, value, ValueRole)
        self.model.dataChanged.connect(self.__table_data_changed)
        self.commit.deferred()

    @Inputs.data
    def set_data(self, data: Table):
        self.data = data
        self._set_model_data()
        self.commit.now()

    def _set_model_data(self):
        self.Information.nans_removed.clear()
        self.model.removeRows(0, self.model.rowCount())
        if not self.data:
            return

        self.model.set_data(self.data, self.values)
        self.values = {}
        self.view.horizontalHeader().setStretchLastSection(False)
        self.view.resizeColumnsToContents()
        self.view.resizeRowsToContents()
        self.view.horizontalHeader().setStretchLastSection(True)

    @Inputs.reference
    def set_reference(self, data: Table):
        self.reference = data

    @gui.deferred
    def commit(self):
        output_data = None
        if self.data:
            output_data = self._create_data_from_values()
            if self.append_to_data:
                output_data = self._append_to_data(output_data)
        self.Outputs.data.send(output_data)

    def _create_data_from_values(self) -> Table:
        data = Table.from_domain(self.data.domain, 1)
        with data.unlocked():
            data.name = "created"
            if data.X.size:
                data.X[:] = np.nan
            if data.Y.size:
                data.Y[:] = np.nan
            for i, m in enumerate(self.data.domain.metas):
                data.metas[:, i] = "" if m.is_string else np.nan

            values = self._get_values()
            for var_name, value in values.items():
                data[:, var_name] = value
        return data

    def _append_to_data(self, data: Table) -> Table:
        assert self.data
        assert len(data) == 1

        var = DiscreteVariable("Source ID", values=(self.data.name, data.name))
        data = Table.concatenate([self.data, data], axis=0)
        domain = Domain(data.domain.attributes, data.domain.class_vars,
                        data.domain.metas + (var,))
        data = data.transform(domain)
        with data.unlocked(data.metas):
            data.metas[: len(self.data), -1] = 0
            data.metas[len(self.data):, -1] = 1
        return data

    def _get_values(self) -> Dict[str, Union[str, float]]:
        values = {}
        for row in range(self.model.rowCount()):
            index = self.model.index(row, self.Header.variable)
            values[self.model.data(index, VariableRole).name] = \
                self.model.data(index, ValueRole)
        return values

    def send_report(self):
        if not self.data:
            return
        self.report_domain("Input", self.data.domain)
        self.report_domain("Output", self.data.domain)
        items = []
        values: Dict = self._get_values()
        for var in self.data.domain.variables + self.data.domain.metas:
            val = values.get(var.name, np.nan)
            if var.is_primitive():
                val = var.repr_val(val)
            items.append([f"{var.name}:", val])
        self.report_table("Values", items)

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

    def pack_settings(self):
        self.values: Dict[str, Union[str, float]] = self._get_values()


if __name__ == "__main__":  # pragma: no cover
    table = Table("housing")
    WidgetPreview(OWCreateInstance).run(set_data=table,
                                        set_reference=table[:1])

```
--- 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:** AttributeError and Incorrect Meta Variables When Creating Instance Cascade

**Description:**
When using the `OWCreateInstance` widget to create an instance cascade, an `AttributeError` is raised because the `Domain` object lacks the `attributes` attribute. Additionally, the number of meta variables does not match the expected count, leading to inconsistencies in data processing.

**Example Code:**
```python
data = Table('iris')
widget = OWCreateInstance()
widget.send_signal('data', data)
output = widget.get_output('data')
# Expected: output.domain.metas has 0 meta variables
# Actual: AttributeError and metas count is 1
```

**Expected Behavior:**
Creating an instance cascade should correctly manage the `Domain`'s attributes, ensuring unique source variable names without raising errors. The number of meta variables should align with expectations, maintaining data integrity.

**Actual Behavior:**
An `AttributeError` is raised stating that the `'Domain' object has no attribute 'attributes'`. Additionally, the meta variables count does not match the expected number, causing assertion failures during tests.
[/ISSUE]
{
    "TestOWCreateInstance.test_cascade_widgets": "PASSED",
    "TestOWCreateInstance.test_cascade_widgets_attributes": "PASSED",
    "TestOWCreateInstance.test_cascade_widgets_class_vars": "PASSED",
    "TestOWCreateInstance.test_commit_once": "PASSED",
    "TestOWCreateInstance.test_context_menu": "PASSED",
    "TestOWCreateInstance.test_datasets": "PASSED",
    "TestOWCreateInstance.test_image_export": "PASSED",
    "TestOWCreateInstance.test_initialize_buttons": "PASSED",
    "TestOWCreateInstance.test_initialize_buttons_commit_once": "PASSED",
    "TestOWCreateInstance.test_missing_values": "PASSED",
    "TestOWCreateInstance.test_missing_values_reference": "PASSED",
    "TestOWCreateInstance.test_msg_base_class": "PASSED",
    "TestOWCreateInstance.test_output": "PASSED",
    "TestOWCreateInstance.test_output_append_data": "PASSED",
    "TestOWCreateInstance.test_report": "PASSED",
    "TestOWCreateInstance.test_saved_workflow": "PASSED",
    "TestOWCreateInstance.test_sparse": "PASSED",
    "TestOWCreateInstance.test_table": "PASSED",
    "TestOWCreateInstance.test_table_data_changed": "PASSED",
    "TestDiscreteVariableEditor.test_edit": "PASSED",
    "TestDiscreteVariableEditor.test_init": "PASSED",
    "TestDiscreteVariableEditor.test_set_value": "PASSED",
    "TestContinuousVariableEditor.test_edit_slider": "PASSED",
    "TestContinuousVariableEditor.test_edit_spin": "PASSED",
    "TestContinuousVariableEditor.test_init": "PASSED",
    "TestContinuousVariableEditor.test_missing_values": "PASSED",
    "TestContinuousVariableEditor.test_overflow": "PASSED",
    "TestContinuousVariableEditor.test_set_value": "PASSED",
    "TestContinuousVariableEditor.test_spin_selection_after_init": "PASSED",
    "TestStringVariableEditor.test_edit": "PASSED",
    "TestStringVariableEditor.test_init": "PASSED",
    "TestStringVariableEditor.test_set_value": "PASSED",
    "TestTimeVariableEditor.test_edit": "PASSED",
    "TestTimeVariableEditor.test_have_date_have_time": "PASSED",
    "TestTimeVariableEditor.test_have_time": "PASSED",
    "TestTimeVariableEditor.test_init": "PASSED",
    "TestTimeVariableEditor.test_no_date_no_time": "PASSED",
    "TestTimeVariableEditor.test_set_value": "PASSED",
    "TestVariableDelegate.test_create_editor": "PASSED",
    "TestVariableDelegate.test_editor_geometry": "PASSED",
    "TestVariableDelegate.test_set_editor_data": "PASSED",
    "TestVariableDelegate.test_set_model_data": "PASSED",
    "TestOWCreateInstance.test_minimum_size": "FAILED"
}
diff --git a/Orange/widgets/data/owcreateinstance.py b/Orange/widgets/data/owcreateinstance.py
index d2fc8db97..53bb1e311 100644
--- a/Orange/widgets/data/owcreateinstance.py
+++ b/Orange/widgets/data/owcreateinstance.py
@@ -16,6 +16,7 @@ from orangewidget.gui import Slider
 
 from Orange.data import DiscreteVariable, ContinuousVariable, \
     TimeVariable, Table, StringVariable, Variable, Domain
+from Orange.data.util import get_unique_names
 from Orange.widgets import gui
 from Orange.widgets.utils.itemmodels import TableModel
 from Orange.widgets.settings import Setting
@@ -646,12 +647,21 @@ class OWCreateInstance(OWWidget):
                 data[:, var_name] = value
         return data
 
-    def _append_to_data(self, data: Table) -> Table:
+    def _append_to_data(self, instance: Table) -> Table:
         assert self.data
-        assert len(data) == 1
+        assert len(instance) == 1
+        source_label = "__source_widget"
 
-        var = DiscreteVariable("Source ID", values=(self.data.name, data.name))
-        data = Table.concatenate([self.data, data], axis=0)
+        data = Table.concatenate([self.data, instance], axis=0)
+        for var in self.data.domain.variables + self.data.domain.metas:
+            if var.attributes.get(source_label) == OWCreateInstance:
+                with data.unlocked():
+                    data.get_column_view(var)[0][-1] = 1
+                return data
+
+        name = get_unique_names(self.data.domain, "Source ID")
+        var = DiscreteVariable(name, values=(self.data.name, instance.name))
+        var.attributes[source_label] = OWCreateInstance
         domain = Domain(data.domain.attributes, data.domain.class_vars,
                         data.domain.metas + (var,))
         data = data.transform(domain)

{"Orange/widgets/data/owcreateinstance.py": "from typing import Optional, Callable, List, Union, Dict\nfrom collections import namedtuple\nfrom functools import singledispatch\n\nimport numpy as np\n\nfrom AnyQt.QtCore import Qt, QSortFilterProxyModel, QSize, QDateTime, \\\n    QModelIndex, Signal, QPoint, QRect, QEvent\nfrom AnyQt.QtGui import QStandardItemModel, QStandardItem, QIcon, QPainter, \\\n    QColor\nfrom AnyQt.QtWidgets import QLineEdit, QTableView, QSlider, \\\n    QComboBox, QStyledItemDelegate, QWidget, QDateTimeEdit, QHBoxLayout, \\\n    QDoubleSpinBox, QSizePolicy, QStyleOptionViewItem, QLabel, QMenu, QAction\n\nfrom orangewidget.gui import Slider\n\nfrom Orange.data import DiscreteVariable, ContinuousVariable, \\\n    TimeVariable, Table, StringVariable, Variable, Domain\nfrom Orange.widgets import gui\nfrom Orange.widgets.utils.itemmodels import TableModel\nfrom Orange.widgets.settings import Setting\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\nfrom Orange.widgets.widget import OWWidget, Input, Output, Msg\n\nVariableRole = next(gui.OrangeUserRole)\nValuesRole = next(gui.OrangeUserRole)\nValueRole = next(gui.OrangeUserRole)\n\n\nclass VariableEditor(QWidget):\n    valueChanged = Signal(float)\n\n    def __init__(self, parent: QWidget, callback: Callable):\n        super().__init__(parent)\n        layout = QHBoxLayout()\n        layout.setContentsMargins(6, 0, 6, 0)\n        layout.setAlignment(Qt.AlignLeft)\n        self.setLayout(layout)\n        self.valueChanged.connect(callback)\n\n    @property\n    def value(self) -> Union[int, float, str]:\n        return NotImplemented\n\n    @value.setter\n    def value(self, value: Union[float, str]):\n        raise NotImplementedError\n\n    def sizeHint(self):\n        return QSize(super().sizeHint().width(), 40)\n\n\nclass DiscreteVariableEditor(VariableEditor):\n    valueChanged = Signal(int)\n\n    def __init__(self, parent: QWidget, items: List[str], callback: Callable):\n        super().__init__(parent, callback)\n        self._combo = QComboBox(\n            parent,\n            maximumWidth=180,\n            sizePolicy=QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)\n        )\n        self._combo.addItems(items)\n        self._combo.currentIndexChanged.connect(self.valueChanged)\n        self.layout().addWidget(self._combo)\n\n    @property\n    def value(self) -> int:\n        return self._combo.currentIndex()\n\n    @value.setter\n    def value(self, value: float):\n        assert value == int(value)\n        self._combo.setCurrentIndex(int(value))\n\n\nclass ContinuousVariableEditor(VariableEditor):\n    MAX_FLOAT = 2147483647\n\n    def __init__(self, parent: QWidget, variable: ContinuousVariable,\n                 min_value: float, max_value: float, callback: Callable):\n        super().__init__(parent, callback)\n\n        if np.isnan(min_value) or np.isnan(max_value):\n            raise ValueError(\"Min/Max cannot be NaN.\")\n\n        n_decimals = variable.number_of_decimals\n        abs_max = max(abs(min_value), max_value)\n        if abs_max * 10 ** n_decimals > self.MAX_FLOAT:\n            n_decimals = int(np.log10(self.MAX_FLOAT / abs_max))\n\n        self._value: float = min_value\n        self._n_decimals: int = n_decimals\n        self._min_value: float = self.__round_value(min_value)\n        self._max_value: float = self.__round_value(max_value)\n\n        sp_spin = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)\n        sp_spin.setHorizontalStretch(1)\n        sp_slider = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)\n        sp_slider.setHorizontalStretch(5)\n        sp_edit = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)\n        sp_edit.setHorizontalStretch(1)\n\n        class DoubleSpinBox(QDoubleSpinBox):\n            def sizeHint(self) -> QSize:\n                size: QSize = super().sizeHint()\n                return QSize(size.width(), size.height() + 2)\n\n        self._spin = DoubleSpinBox(\n            parent,\n            value=self._min_value,\n            minimum=-np.inf,\n            maximum=np.inf,\n            singleStep=10 ** (-self._n_decimals),\n            decimals=self._n_decimals,\n            minimumWidth=70,\n            sizePolicy=sp_spin,\n        )\n        self._slider = Slider(\n            parent,\n            minimum=self.__map_to_slider(self._min_value),\n            maximum=self.__map_to_slider(self._max_value),\n            singleStep=1,\n            orientation=Qt.Horizontal,\n            sizePolicy=sp_slider,\n        )\n        self._label_min = QLabel(\n            parent,\n            text=variable.repr_val(min_value),\n            alignment=Qt.AlignRight,\n            minimumWidth=60,\n            sizePolicy=sp_edit,\n        )\n        self._label_max = QLabel(\n            parent,\n            text=variable.repr_val(max_value),\n            alignment=Qt.AlignLeft,\n            minimumWidth=60,\n            sizePolicy=sp_edit,\n        )\n\n        self._slider.valueChanged.connect(self._apply_slider_value)\n        self._spin.valueChanged.connect(self._apply_spin_value)\n\n        self.layout().addWidget(self._spin)\n        self.layout().addWidget(self._label_min)\n        self.layout().addWidget(self._slider)\n        self.layout().addWidget(self._label_max)\n\n        self.setFocusProxy(self._spin)\n\n        def deselect():\n            self._spin.lineEdit().deselect()\n            try:\n                self._spin.lineEdit().selectionChanged.disconnect(deselect)\n            except TypeError:\n                pass\n\n        # Invoking self.setFocusProxy(self._spin), causes the\n        # self._spin.lineEdit()s to have selected texts (focus is set to\n        # provide keyboard functionality, i.e.: pressing ESC after changing\n        # spinbox value). Since the spin text is selected only after the\n        # delegate draws it, it cannot be deselected during initialization.\n        # Therefore connect the deselect() function to\n        # self._spin.lineEdit().selectionChanged only for editor creation.\n        self._spin.lineEdit().selectionChanged.connect(deselect)\n\n        self._slider.installEventFilter(self)\n        self._spin.installEventFilter(self)\n\n    @property\n    def value(self) -> float:\n        return self.__round_value(self._value)\n\n    @value.setter\n    def value(self, value: float):\n        if self._value is None or self.__round_value(value) != self.value:\n            self._value = value\n            self.valueChanged.emit(self.value)\n            self._spin.setValue(self.value)\n            # prevent emitting self.valueChanged again, due to slider change\n            slider_value = self.__map_to_slider(self.value)\n            self._value = self.__map_from_slider(slider_value)\n            self._slider.setValue(slider_value)\n            self._value = value\n\n    def _apply_slider_value(self):\n        self.value = self.__map_from_slider(self._slider.value())\n\n    def _apply_spin_value(self):\n        self.value = self._spin.value()\n\n    def __round_value(self, value):\n        return round(value, self._n_decimals)\n\n    def __map_to_slider(self, value: float) -> int:\n        value = min(self._max_value, max(self._min_value, value))\n        return round(value * 10 ** self._n_decimals)\n\n    def __map_from_slider(self, value: int) -> float:\n        return value * 10 ** (-self._n_decimals)\n\n    def eventFilter(self, obj: Union[QSlider, QDoubleSpinBox], event: QEvent) \\\n            -> bool:\n        if event.type() == QEvent.Wheel:\n            return True\n        return super().eventFilter(obj, event)\n\n\nclass StringVariableEditor(VariableEditor):\n    valueChanged = Signal()\n\n    def __init__(self, parent: QWidget, callback: Callable):\n        super().__init__(parent, callback)\n        self._edit = QLineEdit(\n            parent,\n            sizePolicy=QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)\n        )\n        self._edit.textChanged.connect(self.valueChanged)\n        self.layout().addWidget(self._edit)\n        self.setFocusProxy(self._edit)\n\n    @property\n    def value(self) -> str:\n        return self._edit.text()\n\n    @value.setter\n    def value(self, value: str):\n        self._edit.setText(value)\n\n\nclass TimeVariableEditor(VariableEditor):\n    DATE_FORMAT = \"yyyy-MM-dd\"\n    TIME_FORMAT = \"hh:mm:ss\"\n\n    def __init__(self, parent: QWidget, variable: TimeVariable,\n                 callback: Callable):\n        super().__init__(parent, callback)\n        self._value: float = 0\n        self._variable: TimeVariable = variable\n\n        if variable.have_date and not variable.have_time:\n            self._format = TimeVariableEditor.DATE_FORMAT\n        elif not variable.have_date and variable.have_time:\n            self._format = TimeVariableEditor.TIME_FORMAT\n        else:\n            self._format = f\"{TimeVariableEditor.DATE_FORMAT} \" \\\n                           f\"{TimeVariableEditor.TIME_FORMAT}\"\n\n        class DateTimeEdit(QDateTimeEdit):\n            def sizeHint(self) -> QSize:\n                size: QSize = super().sizeHint()\n                return QSize(size.width(), size.height() + 2)\n\n        self._edit = DateTimeEdit(\n            parent,\n            dateTime=self.__map_to_datetime(self._value),\n            displayFormat=self._format,\n            sizePolicy=QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)\n        )\n        self._edit.dateTimeChanged.connect(self._apply_edit_value)\n\n        self.layout().addWidget(self._edit)\n        self.setFocusProxy(self._edit)\n\n        self._edit.installEventFilter(self)\n\n    @property\n    def value(self) -> float:\n        return self._value\n\n    @value.setter\n    def value(self, value: float):\n        if value != self.value:\n            self._value = value\n            self.valueChanged.emit(self.value)\n            self._edit.setDateTime(self.__map_to_datetime(self.value))\n\n    def _apply_edit_value(self):\n        self.value = self.__map_from_datetime(self._edit.dateTime())\n\n    def __map_from_datetime(self, date_time: QDateTime) -> float:\n        return self._variable.to_val(date_time.toString(self._format))\n\n    def __map_to_datetime(self, value: float) -> QDateTime:\n        return QDateTime.fromString(self._variable.repr_val(value),\n                                    self._format)\n\n    def eventFilter(self, obj: QDateTimeEdit, event: QEvent) -> bool:\n        if event.type() == QEvent.Wheel:\n            return True\n        return super().eventFilter(obj, event)\n\n\nclass VariableDelegate(QStyledItemDelegate):\n    def paint(self, painter: QPainter, option: QStyleOptionViewItem,\n              index: QModelIndex):\n        self.parent().view.openPersistentEditor(index)\n        super().paint(painter, option, index)\n\n    def createEditor(self, parent: QWidget, _: QStyleOptionViewItem,\n                     index: QModelIndex) -> VariableEditor:\n        variable = index.data(VariableRole)\n        values = index.data(ValuesRole)\n        return _create_editor(variable, values, parent, self._commit_data)\n\n    def _commit_data(self):\n        editor = self.sender()\n        assert isinstance(editor, VariableEditor)\n        self.commitData.emit(editor)\n\n    # pylint: disable=no-self-use\n    def setEditorData(self, editor: VariableEditor, index: QModelIndex):\n        editor.value = index.model().data(index, ValueRole)\n\n    # pylint: disable=no-self-use\n    def setModelData(self, editor: VariableEditor,\n                     model: QSortFilterProxyModel, index: QModelIndex):\n        model.setData(index, editor.value, ValueRole)\n\n    # pylint: disable=no-self-use\n    def updateEditorGeometry(self, editor: VariableEditor,\n                             option: QStyleOptionViewItem, _: QModelIndex):\n        rect: QRect = option.rect\n        if isinstance(editor, ContinuousVariableEditor):\n            width = editor.sizeHint().width()\n            if width > rect.width():\n                rect.setWidth(width)\n        editor.setGeometry(rect)\n\n    # pylint: disable=no-self-use\n    def sizeHint(self, _: QStyleOptionViewItem, index: QModelIndex) -> QSize:\n        return _create_editor(index.data(role=VariableRole), np.array([0]),\n                              None, lambda: 1).sizeHint()\n\n\n@singledispatch\ndef _create_editor(*_) -> VariableEditor:\n    raise NotImplementedError\n\n\n@_create_editor.register(DiscreteVariable)\ndef _(variable: DiscreteVariable, _: np.ndarray,\n      parent: QWidget, callback: Callable) -> DiscreteVariableEditor:\n    return DiscreteVariableEditor(parent, variable.values, callback)\n\n\n@_create_editor.register(ContinuousVariable)\ndef _(variable: ContinuousVariable, values: np.ndarray,\n      parent: QWidget, callback: Callable) -> ContinuousVariableEditor:\n    return ContinuousVariableEditor(parent, variable, np.nanmin(values),\n                                    np.nanmax(values), callback)\n\n\n@_create_editor.register(StringVariable)\ndef _(_: StringVariable, __: np.ndarray, parent: QWidget,\n      callback: Callable) -> StringVariableEditor:\n    return StringVariableEditor(parent, callback)\n\n\n@_create_editor.register(TimeVariable)\ndef _(variable: TimeVariable, _: np.ndarray,\n      parent: QWidget, callback: Callable) -> TimeVariableEditor:\n    return TimeVariableEditor(parent, variable, callback)\n\n\ndef majority(values: np.ndarray) -> int:\n    return np.bincount(values[~np.isnan(values)].astype(int)).argmax()\n\n\ndef disc_random(values: np.ndarray) -> int:\n    return np.random.randint(low=np.nanmin(values), high=np.nanmax(values) + 1)\n\n\ndef cont_random(values: np.ndarray) -> float:\n    return np.random.uniform(low=np.nanmin(values), high=np.nanmax(values))\n\n\nclass VariableItemModel(QStandardItemModel):\n    dataHasNanColumn = Signal()\n\n    # pylint: disable=dangerous-default-value\n    def set_data(self, data: Table, saved_values={}):\n        domain = data.domain\n        variables = [(TableModel.Attribute, a) for a in domain.attributes] + \\\n                    [(TableModel.ClassVar, c) for c in domain.class_vars] + \\\n                    [(TableModel.Meta, m) for m in domain.metas]\n        for place, variable in variables:\n            if variable.is_primitive():\n                values = data.get_column_view(variable)[0].astype(float)\n                if all(np.isnan(values)):\n                    self.dataHasNanColumn.emit()\n                    continue\n            else:\n                values = np.array([])\n            color = TableModel.ColorForRole.get(place)\n            self._add_row(variable, values, color,\n                          saved_values.get(variable.name))\n\n    def _add_row(self, variable: Variable, values: np.ndarray, color: QColor,\n                 saved_value: Optional[Union[int, float, str]]):\n        var_item = QStandardItem()\n        var_item.setData(variable.name, Qt.DisplayRole)\n        var_item.setToolTip(variable.name)\n        var_item.setIcon(self._variable_icon(variable))\n        var_item.setEditable(False)\n        if color:\n            var_item.setBackground(color)\n\n        control_item = QStandardItem()\n        control_item.setData(variable, VariableRole)\n        control_item.setData(values, ValuesRole)\n        if color:\n            control_item.setBackground(color)\n\n        value = self._default_for_variable(variable, values)\n        if saved_value is not None and not \\\n                (variable.is_discrete and saved_value >= len(variable.values)):\n            value = saved_value\n        control_item.setData(value, ValueRole)\n\n        self.appendRow([var_item, control_item])\n\n    @staticmethod\n    def _default_for_variable(variable: Variable, values: np.ndarray) \\\n            -> Union[float, int, str]:\n        if variable.is_continuous:\n            return round(np.nanmedian(values), variable.number_of_decimals)\n        elif variable.is_discrete:\n            return majority(values)\n        elif variable.is_string:\n            return \"\"\n        else:\n            raise NotImplementedError\n\n    @staticmethod\n    def _variable_icon(variable: Variable) -> QIcon:\n        if variable.is_discrete:\n            return gui.attributeIconDict[1]\n        elif variable.is_time:\n            return gui.attributeIconDict[4]\n        elif variable.is_continuous:\n            return gui.attributeIconDict[2]\n        elif variable.is_string:\n            return gui.attributeIconDict[3]\n        else:\n            return gui.attributeIconDict[-1]\n\n\nclass OWCreateInstance(OWWidget):\n    name = \"Create Instance\"\n    description = \"Interactively create a data instance from sample dataset.\"\n    icon = \"icons/CreateInstance.svg\"\n    category = \"Transform\"\n    keywords = [\"simulator\"]\n    priority = 2310\n\n    class Inputs:\n        data = Input(\"Data\", Table)\n        reference = Input(\"Reference\", Table)\n\n    class Outputs:\n        data = Output(\"Data\", Table)\n\n    class Information(OWWidget.Information):\n        nans_removed = Msg(\"Variables with only missing values were \"\n                           \"removed from the list.\")\n\n    want_main_area = False\n    ACTIONS = [\"median\", \"mean\", \"random\", \"input\"]\n    HEADER = [[\"name\", \"Variable\"],\n              [\"variable\", \"Value\"]]\n    Header = namedtuple(\n        \"header\", [tag for tag, _ in HEADER]\n    )(*range(len(HEADER)))\n\n    values: Dict[str, Union[float, str]] = Setting({}, schema_only=True)\n    append_to_data = Setting(True)\n    auto_commit = Setting(True)\n\n    def __init__(self):\n        super().__init__()\n        self.data: Optional[Table] = None\n        self.reference: Optional[Table] = None\n\n        self.filter_edit = QLineEdit(textChanged=self.__filter_edit_changed,\n                                     placeholderText=\"Filter...\")\n        self.view = QTableView(sortingEnabled=True,\n                               contextMenuPolicy=Qt.CustomContextMenu,\n                               selectionMode=QTableView.NoSelection)\n        self.view.customContextMenuRequested.connect(self.__menu_requested)\n        self.view.setItemDelegateForColumn(\n            self.Header.variable, VariableDelegate(self)\n        )\n        self.view.verticalHeader().hide()\n        self.view.horizontalHeader().setStretchLastSection(True)\n        self.view.horizontalHeader().setMaximumSectionSize(350)\n\n        self.model = VariableItemModel(self)\n        self.model.setHorizontalHeaderLabels([x for _, x in self.HEADER])\n        self.model.dataChanged.connect(self.__table_data_changed)\n        self.model.dataHasNanColumn.connect(self.Information.nans_removed)\n        self.proxy_model = QSortFilterProxyModel()\n        self.proxy_model.setFilterKeyColumn(-1)\n        self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive)\n        self.proxy_model.setSourceModel(self.model)\n        self.view.setModel(self.proxy_model)\n\n        vbox = gui.vBox(self.controlArea, box=True)\n        vbox.layout().addWidget(self.filter_edit)\n        vbox.layout().addWidget(self.view)\n\n        box = gui.hBox(vbox, objectName=\"buttonBox\")\n        gui.rubber(box)\n        for name in self.ACTIONS:\n            gui.button(\n                box, self, name.capitalize(),\n                lambda *args, fun=name: self._initialize_values(fun),\n                autoDefault=False\n            )\n        gui.rubber(box)\n\n        gui.checkBox(self.buttonsArea, self, \"append_to_data\",\n                     \"Append this instance to input data\",\n                     callback=self.commit.deferred)\n        gui.rubber(self.buttonsArea)\n        gui.auto_apply(self.buttonsArea, self, \"auto_commit\")\n\n        self.settingsAboutToBePacked.connect(self.pack_settings)\n\n    def __filter_edit_changed(self):\n        self.proxy_model.setFilterFixedString(self.filter_edit.text().strip())\n\n    def __table_data_changed(self):\n        self.commit.deferred()\n\n    def __menu_requested(self, point: QPoint):\n        index = self.view.indexAt(point)\n        model: QSortFilterProxyModel = index.model()\n        source_index = model.mapToSource(index)\n        menu = QMenu(self)\n        for action in self._create_actions(source_index):\n            menu.addAction(action)\n        menu.popup(self.view.viewport().mapToGlobal(point))\n\n    def _create_actions(self, index: QModelIndex) -> List[QAction]:\n        actions = []\n        for name in self.ACTIONS:\n            action = QAction(name.capitalize(), self)\n            action.triggered.connect(\n                lambda *args, fun=name: self._initialize_values(fun, [index])\n            )\n            actions.append(action)\n        return actions\n\n    def _initialize_values(self, fun: str, indices: List[QModelIndex] = None):\n        cont_fun = {\"median\": np.nanmedian,\n                    \"mean\": np.nanmean,\n                    \"random\": cont_random,\n                    \"input\": np.nanmean}.get(fun, NotImplemented)\n        disc_fun = {\"median\": majority,\n                    \"mean\": majority,\n                    \"random\": disc_random,\n                    \"input\": majority}.get(fun, NotImplemented)\n\n        if not self.data or fun == \"input\" and not self.reference:\n            return\n\n        self.model.dataChanged.disconnect(self.__table_data_changed)\n        rows = range(self.proxy_model.rowCount()) if indices is None else \\\n            [index.row() for index in indices]\n        for row in rows:\n            index = self.model.index(row, self.Header.variable)\n            variable = self.model.data(index, VariableRole)\n\n            if fun == \"input\":\n                if variable not in self.reference.domain:\n                    continue\n                values = self.reference.get_column_view(variable)[0]\n                if variable.is_primitive():\n                    values = values.astype(float)\n                    if all(np.isnan(values)):\n                        continue\n            else:\n                values = self.model.data(index, ValuesRole)\n\n            if variable.is_continuous:\n                value = cont_fun(values)\n                value = round(value, variable.number_of_decimals)\n            elif variable.is_discrete:\n                value = disc_fun(values)\n            elif variable.is_string:\n                value = \"\"\n            else:\n                raise NotImplementedError\n\n            self.model.setData(index, value, ValueRole)\n        self.model.dataChanged.connect(self.__table_data_changed)\n        self.commit.deferred()\n\n    @Inputs.data\n    def set_data(self, data: Table):\n        self.data = data\n        self._set_model_data()\n        self.commit.now()\n\n    def _set_model_data(self):\n        self.Information.nans_removed.clear()\n        self.model.removeRows(0, self.model.rowCount())\n        if not self.data:\n            return\n\n        self.model.set_data(self.data, self.values)\n        self.values = {}\n        self.view.horizontalHeader().setStretchLastSection(False)\n        self.view.resizeColumnsToContents()\n        self.view.resizeRowsToContents()\n        self.view.horizontalHeader().setStretchLastSection(True)\n\n    @Inputs.reference\n    def set_reference(self, data: Table):\n        self.reference = data\n\n    @gui.deferred\n    def commit(self):\n        output_data = None\n        if self.data:\n            output_data = self._create_data_from_values()\n            if self.append_to_data:\n                output_data = self._append_to_data(output_data)\n        self.Outputs.data.send(output_data)\n\n    def _create_data_from_values(self) -> Table:\n        data = Table.from_domain(self.data.domain, 1)\n        with data.unlocked():\n            data.name = \"created\"\n            if data.X.size:\n                data.X[:] = np.nan\n            if data.Y.size:\n                data.Y[:] = np.nan\n            for i, m in enumerate(self.data.domain.metas):\n                data.metas[:, i] = \"\" if m.is_string else np.nan\n\n            values = self._get_values()\n            for var_name, value in values.items():\n                data[:, var_name] = value\n        return data\n\n    def _append_to_data(self, data: Table) -> Table:\n        assert self.data\n        assert len(data) == 1\n\n        var = DiscreteVariable(\"Source ID\", values=(self.data.name, data.name))\n        data = Table.concatenate([self.data, data], axis=0)\n        domain = Domain(data.domain.attributes, data.domain.class_vars,\n                        data.domain.metas + (var,))\n        data = data.transform(domain)\n        with data.unlocked(data.metas):\n            data.metas[: len(self.data), -1] = 0\n            data.metas[len(self.data):, -1] = 1\n        return data\n\n    def _get_values(self) -> Dict[str, Union[str, float]]:\n        values = {}\n        for row in range(self.model.rowCount()):\n            index = self.model.index(row, self.Header.variable)\n            values[self.model.data(index, VariableRole).name] = \\\n                self.model.data(index, ValueRole)\n        return values\n\n    def send_report(self):\n        if not self.data:\n            return\n        self.report_domain(\"Input\", self.data.domain)\n        self.report_domain(\"Output\", self.data.domain)\n        items = []\n        values: Dict = self._get_values()\n        for var in self.data.domain.variables + self.data.domain.metas:\n            val = values.get(var.name, np.nan)\n            if var.is_primitive():\n                val = var.repr_val(val)\n            items.append([f\"{var.name}:\", val])\n        self.report_table(\"Values\", items)\n\n    @staticmethod\n    def sizeHint():\n        return QSize(600, 500)\n\n    def pack_settings(self):\n        self.values: Dict[str, Union[str, float]] = self._get_values()\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    table = Table(\"housing\")\n    WidgetPreview(OWCreateInstance).run(set_data=table,\n                                        set_reference=table[:1])\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:** AttributeError and Incorrect Meta Variables When Creating Instance Cascade

**Description:**
When using the `OWCreateInstance` widget to create an instance cascade, an `AttributeError` is raised because the `Domain` object lacks the `attributes` attribute. Additionally, the number of meta variables does not match the expected count, leading to inconsistencies in data processing.

**Example Code:**
```python
data = Table('iris')
widget = OWCreateInstance()
widget.send_signal('data', data)
output = widget.get_output('data')
# Expected: output.domain.metas has 0 meta variables
# Actual: AttributeError and metas count is 1
```

**Expected Behavior:**
Creating an instance cascade should correctly manage the `Domain`'s attributes, ensuring unique source variable names without raising errors. The number of meta variables should align with expectations, maintaining data integrity.

**Actual Behavior:**
An `AttributeError` is raised stating that the `'Domain' object has no attribute 'attributes'`. Additionally, the meta variables count does not match the expected number, causing assertion failures during tests.
[/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/owcreateinstance.py
from typing import Optional, Callable, List, Union, Dict
from collections import namedtuple
from functools import singledispatch

import numpy as np

from AnyQt.QtCore import Qt, QSortFilterProxyModel, QSize, QDateTime, \
    QModelIndex, Signal, QPoint, QRect, QEvent
from AnyQt.QtGui import QStandardItemModel, QStandardItem, QIcon, QPainter, \
    QColor
from AnyQt.QtWidgets import QLineEdit, QTableView, QSlider, \
    QComboBox, QStyledItemDelegate, QWidget, QDateTimeEdit, QHBoxLayout, \
    QDoubleSpinBox, QSizePolicy, QStyleOptionViewItem, QLabel, QMenu, QAction

from orangewidget.gui import Slider

from Orange.data import DiscreteVariable, ContinuousVariable, \
    TimeVariable, Table, StringVariable, Variable, Domain
from Orange.widgets import gui
from Orange.widgets.utils.itemmodels import TableModel
from Orange.widgets.settings import Setting
from Orange.widgets.utils.widgetpreview import WidgetPreview
from Orange.widgets.widget import OWWidget, Input, Output, Msg

VariableRole = next(gui.OrangeUserRole)
ValuesRole = next(gui.OrangeUserRole)
ValueRole = next(gui.OrangeUserRole)


class VariableEditor(QWidget):
    valueChanged = Signal(float)

    def __init__(self, parent: QWidget, callback: Callable):
        super().__init__(parent)
        layout = QHBoxLayout()
        layout.setContentsMargins(6, 0, 6, 0)
        layout.setAlignment(Qt.AlignLeft)
        self.setLayout(layout)
        self.valueChanged.connect(callback)

    @property
    def value(self) -> Union[int, float, str]:
        return NotImplemented

    @value.setter
    def value(self, value: Union[float, str]):
        raise NotImplementedError

    def sizeHint(self):
        return QSize(super().sizeHint().width(), 40)


class DiscreteVariableEditor(VariableEditor):
    valueChanged = Signal(int)

    def __init__(self, parent: QWidget, items: List[str], callback: Callable):
        super().__init__(parent, callback)
        self._combo = QComboBox(
            parent,
            maximumWidth=180,
            sizePolicy=QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        )
        self._combo.addItems(items)
        self._combo.currentIndexChanged.connect(self.valueChanged)
        self.layout().addWidget(self._combo)

    @property
    def value(self) -> int:
        return self._combo.currentIndex()

    @value.setter
    def value(self, value: float):
        assert value == int(value)
        self._combo.setCurrentIndex(int(value))


class ContinuousVariableEditor(VariableEditor):
    MAX_FLOAT = 2147483647

    def __init__(self, parent: QWidget, variable: ContinuousVariable,
                 min_value: float, max_value: float, callback: Callable):
        super().__init__(parent, callback)

        if np.isnan(min_value) or np.isnan(max_value):
            raise ValueError("Min/Max cannot be NaN.")

        n_decimals = variable.number_of_decimals
        abs_max = max(abs(min_value), max_value)
        if abs_max * 10 ** n_decimals > self.MAX_FLOAT:
            n_decimals = int(np.log10(self.MAX_FLOAT / abs_max))

        self._value: float = min_value
        self._n_decimals: int = n_decimals
        self._min_value: float = self.__round_value(min_value)
        self._max_value: float = self.__round_value(max_value)

        sp_spin = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        sp_spin.setHorizontalStretch(1)
        sp_slider = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        sp_slider.setHorizontalStretch(5)
        sp_edit = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        sp_edit.setHorizontalStretch(1)

        class DoubleSpinBox(QDoubleSpinBox):
            def sizeHint(self) -> QSize:
                size: QSize = super().sizeHint()
                return QSize(size.width(), size.height() + 2)

        self._spin = DoubleSpinBox(
            parent,
            value=self._min_value,
            minimum=-np.inf,
            maximum=np.inf,
            singleStep=10 ** (-self._n_decimals),
            decimals=self._n_decimals,
            minimumWidth=70,
            sizePolicy=sp_spin,
        )
        self._slider = Slider(
            parent,
            minimum=self.__map_to_slider(self._min_value),
            maximum=self.__map_to_slider(self._max_value),
            singleStep=1,
            orientation=Qt.Horizontal,
            sizePolicy=sp_slider,
        )
        self._label_min = QLabel(
            parent,
            text=variable.repr_val(min_value),
            alignment=Qt.AlignRight,
            minimumWidth=60,
            sizePolicy=sp_edit,
        )
        self._label_max = QLabel(
            parent,
            text=variable.repr_val(max_value),
            alignment=Qt.AlignLeft,
            minimumWidth=60,
            sizePolicy=sp_edit,
        )

        self._slider.valueChanged.connect(self._apply_slider_value)
        self._spin.valueChanged.connect(self._apply_spin_value)

        self.layout().addWidget(self._spin)
        self.layout().addWidget(self._label_min)
        self.layout().addWidget(self._slider)
        self.layout().addWidget(self._label_max)

        self.setFocusProxy(self._spin)

        def deselect():
            self._spin.lineEdit().deselect()
            try:
                self._spin.lineEdit().selectionChanged.disconnect(deselect)
            except TypeError:
                pass

        # Invoking self.setFocusProxy(self._spin), causes the
        # self._spin.lineEdit()s to have selected texts (focus is set to
        # provide keyboard functionality, i.e.: pressing ESC after changing
        # spinbox value). Since the spin text is selected only after the
        # delegate draws it, it cannot be deselected during initialization.
        # Therefore connect the deselect() function to
        # self._spin.lineEdit().selectionChanged only for editor creation.
        self._spin.lineEdit().selectionChanged.connect(deselect)

        self._slider.installEventFilter(self)
        self._spin.installEventFilter(self)

    @property
    def value(self) -> float:
        return self.__round_value(self._value)

    @value.setter
    def value(self, value: float):
        if self._value is None or self.__round_value(value) != self.value:
            self._value = value
            self.valueChanged.emit(self.value)
            self._spin.setValue(self.value)
            # prevent emitting self.valueChanged again, due to slider change
            slider_value = self.__map_to_slider(self.value)
            self._value = self.__map_from_slider(slider_value)
            self._slider.setValue(slider_value)
            self._value = value

    def _apply_slider_value(self):
        self.value = self.__map_from_slider(self._slider.value())

    def _apply_spin_value(self):
        self.value = self._spin.value()

    def __round_value(self, value):
        return round(value, self._n_decimals)

    def __map_to_slider(self, value: float) -> int:
        value = min(self._max_value, max(self._min_value, value))
        return round(value * 10 ** self._n_decimals)

    def __map_from_slider(self, value: int) -> float:
        return value * 10 ** (-self._n_decimals)

    def eventFilter(self, obj: Union[QSlider, QDoubleSpinBox], event: QEvent) \
            -> bool:
        if event.type() == QEvent.Wheel:
            return True
        return super().eventFilter(obj, event)


class StringVariableEditor(VariableEditor):
    valueChanged = Signal()

    def __init__(self, parent: QWidget, callback: Callable):
        super().__init__(parent, callback)
        self._edit = QLineEdit(
            parent,
            sizePolicy=QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        )
        self._edit.textChanged.connect(self.valueChanged)
        self.layout().addWidget(self._edit)
        self.setFocusProxy(self._edit)

    @property
    def value(self) -> str:
        return self._edit.text()

    @value.setter
    def value(self, value: str):
        self._edit.setText(value)


class TimeVariableEditor(VariableEditor):
    DATE_FORMAT = "yyyy-MM-dd"
    TIME_FORMAT = "hh:mm:ss"

    def __init__(self, parent: QWidget, variable: TimeVariable,
                 callback: Callable):
        super().__init__(parent, callback)
        self._value: float = 0
        self._variable: TimeVariable = variable

        if variable.have_date and not variable.have_time:
            self._format = TimeVariableEditor.DATE_FORMAT
        elif not variable.have_date and variable.have_time:
            self._format = TimeVariableEditor.TIME_FORMAT
        else:
            self._format = f"{TimeVariableEditor.DATE_FORMAT} " \
                           f"{TimeVariableEditor.TIME_FORMAT}"

        class DateTimeEdit(QDateTimeEdit):
            def sizeHint(self) -> QSize:
                size: QSize = super().sizeHint()
                return QSize(size.width(), size.height() + 2)

        self._edit = DateTimeEdit(
            parent,
            dateTime=self.__map_to_datetime(self._value),
            displayFormat=self._format,
            sizePolicy=QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        )
        self._edit.dateTimeChanged.connect(self._apply_edit_value)

        self.layout().addWidget(self._edit)
        self.setFocusProxy(self._edit)

        self._edit.installEventFilter(self)

    @property
    def value(self) -> float:
        return self._value

    @value.setter
    def value(self, value: float):
        if value != self.value:
            self._value = value
            self.valueChanged.emit(self.value)
            self._edit.setDateTime(self.__map_to_datetime(self.value))

    def _apply_edit_value(self):
        self.value = self.__map_from_datetime(self._edit.dateTime())

    def __map_from_datetime(self, date_time: QDateTime) -> float:
        return self._variable.to_val(date_time.toString(self._format))

    def __map_to_datetime(self, value: float) -> QDateTime:
        return QDateTime.fromString(self._variable.repr_val(value),
                                    self._format)

    def eventFilter(self, obj: QDateTimeEdit, event: QEvent) -> bool:
        if event.type() == QEvent.Wheel:
            return True
        return super().eventFilter(obj, event)


class VariableDelegate(QStyledItemDelegate):
    def paint(self, painter: QPainter, option: QStyleOptionViewItem,
              index: QModelIndex):
        self.parent().view.openPersistentEditor(index)
        super().paint(painter, option, index)

    def createEditor(self, parent: QWidget, _: QStyleOptionViewItem,
                     index: QModelIndex) -> VariableEditor:
        variable = index.data(VariableRole)
        values = index.data(ValuesRole)
        return _create_editor(variable, values, parent, self._commit_data)

    def _commit_data(self):
        editor = self.sender()
        assert isinstance(editor, VariableEditor)
        self.commitData.emit(editor)

    # pylint: disable=no-self-use
    def setEditorData(self, editor: VariableEditor, index: QModelIndex):
        editor.value = index.model().data(index, ValueRole)

    # pylint: disable=no-self-use
    def setModelData(self, editor: VariableEditor,
                     model: QSortFilterProxyModel, index: QModelIndex):
        model.setData(index, editor.value, ValueRole)

    # pylint: disable=no-self-use
    def updateEditorGeometry(self, editor: VariableEditor,
                             option: QStyleOptionViewItem, _: QModelIndex):
        rect: QRect = option.rect
        if isinstance(editor, ContinuousVariableEditor):
            width = editor.sizeHint().width()
            if width > rect.width():
                rect.setWidth(width)
        editor.setGeometry(rect)

    # pylint: disable=no-self-use
    def sizeHint(self, _: QStyleOptionViewItem, index: QModelIndex) -> QSize:
        return _create_editor(index.data(role=VariableRole), np.array([0]),
                              None, lambda: 1).sizeHint()


@singledispatch
def _create_editor(*_) -> VariableEditor:
    raise NotImplementedError


@_create_editor.register(DiscreteVariable)
def _(variable: DiscreteVariable, _: np.ndarray,
      parent: QWidget, callback: Callable) -> DiscreteVariableEditor:
    return DiscreteVariableEditor(parent, variable.values, callback)


@_create_editor.register(ContinuousVariable)
def _(variable: ContinuousVariable, values: np.ndarray,
      parent: QWidget, callback: Callable) -> ContinuousVariableEditor:
    return ContinuousVariableEditor(parent, variable, np.nanmin(values),
                                    np.nanmax(values), callback)


@_create_editor.register(StringVariable)
def _(_: StringVariable, __: np.ndarray, parent: QWidget,
      callback: Callable) -> StringVariableEditor:
    return StringVariableEditor(parent, callback)


@_create_editor.register(TimeVariable)
def _(variable: TimeVariable, _: np.ndarray,
      parent: QWidget, callback: Callable) -> TimeVariableEditor:
    return TimeVariableEditor(parent, variable, callback)


def majority(values: np.ndarray) -> int:
    return np.bincount(values[~np.isnan(values)].astype(int)).argmax()


def disc_random(values: np.ndarray) -> int:
    return np.random.randint(low=np.nanmin(values), high=np.nanmax(values) + 1)


def cont_random(values: np.ndarray) -> float:
    return np.random.uniform(low=np.nanmin(values), high=np.nanmax(values))


class VariableItemModel(QStandardItemModel):
    dataHasNanColumn = Signal()

    # pylint: disable=dangerous-default-value
    def set_data(self, data: Table, saved_values={}):
        domain = data.domain
        variables = [(TableModel.Attribute, a) for a in domain.attributes] + \
                    [(TableModel.ClassVar, c) for c in domain.class_vars] + \
                    [(TableModel.Meta, m) for m in domain.metas]
        for place, variable in variables:
            if variable.is_primitive():
                values = data.get_column_view(variable)[0].astype(float)
                if all(np.isnan(values)):
                    self.dataHasNanColumn.emit()
                    continue
            else:
                values = np.array([])
            color = TableModel.ColorForRole.get(place)
            self._add_row(variable, values, color,
                          saved_values.get(variable.name))

    def _add_row(self, variable: Variable, values: np.ndarray, color: QColor,
                 saved_value: Optional[Union[int, float, str]]):
        var_item = QStandardItem()
        var_item.setData(variable.name, Qt.DisplayRole)
        var_item.setToolTip(variable.name)
        var_item.setIcon(self._variable_icon(variable))
        var_item.setEditable(False)
        if color:
            var_item.setBackground(color)

        control_item = QStandardItem()
        control_item.setData(variable, VariableRole)
        control_item.setData(values, ValuesRole)
        if color:
            control_item.setBackground(color)

        value = self._default_for_variable(variable, values)
        if saved_value is not None and not \
                (variable.is_discrete and saved_value >= len(variable.values)):
            value = saved_value
        control_item.setData(value, ValueRole)

        self.appendRow([var_item, control_item])

    @staticmethod
    def _default_for_variable(variable: Variable, values: np.ndarray) \
            -> Union[float, int, str]:
        if variable.is_continuous:
            return round(np.nanmedian(values), variable.number_of_decimals)
        elif variable.is_discrete:
            return majority(values)
        elif variable.is_string:
            return ""
        else:
            raise NotImplementedError

    @staticmethod
    def _variable_icon(variable: Variable) -> QIcon:
        if variable.is_discrete:
            return gui.attributeIconDict[1]
        elif variable.is_time:
            return gui.attributeIconDict[4]
        elif variable.is_continuous:
            return gui.attributeIconDict[2]
        elif variable.is_string:
            return gui.attributeIconDict[3]
        else:
            return gui.attributeIconDict[-1]


class OWCreateInstance(OWWidget):
    name = "Create Instance"
    description = "Interactively create a data instance from sample dataset."
    icon = "icons/CreateInstance.svg"
    category = "Transform"
    keywords = ["simulator"]
    priority = 2310

    class Inputs:
        data = Input("Data", Table)
        reference = Input("Reference", Table)

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

    class Information(OWWidget.Information):
        nans_removed = Msg("Variables with only missing values were "
                           "removed from the list.")

    want_main_area = False
    ACTIONS = ["median", "mean", "random", "input"]
    HEADER = [["name", "Variable"],
              ["variable", "Value"]]
    Header = namedtuple(
        "header", [tag for tag, _ in HEADER]
    )(*range(len(HEADER)))

    values: Dict[str, Union[float, str]] = Setting({}, schema_only=True)
    append_to_data = Setting(True)
    auto_commit = Setting(True)

    def __init__(self):
        super().__init__()
        self.data: Optional[Table] = None
        self.reference: Optional[Table] = None

        self.filter_edit = QLineEdit(textChanged=self.__filter_edit_changed,
                                     placeholderText="Filter...")
        self.view = QTableView(sortingEnabled=True,
                               contextMenuPolicy=Qt.CustomContextMenu,
                               selectionMode=QTableView.NoSelection)
        self.view.customContextMenuRequested.connect(self.__menu_requested)
        self.view.setItemDelegateForColumn(
            self.Header.variable, VariableDelegate(self)
        )
        self.view.verticalHeader().hide()
        self.view.horizontalHeader().setStretchLastSection(True)
        self.view.horizontalHeader().setMaximumSectionSize(350)

        self.model = VariableItemModel(self)
        self.model.setHorizontalHeaderLabels([x for _, x in self.HEADER])
        self.model.dataChanged.connect(self.__table_data_changed)
        self.model.dataHasNanColumn.connect(self.Information.nans_removed)
        self.proxy_model = QSortFilterProxyModel()
        self.proxy_model.setFilterKeyColumn(-1)
        self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive)
        self.proxy_model.setSourceModel(self.model)
        self.view.setModel(self.proxy_model)

        vbox = gui.vBox(self.controlArea, box=True)
        vbox.layout().addWidget(self.filter_edit)
        vbox.layout().addWidget(self.view)

        box = gui.hBox(vbox, objectName="buttonBox")
        gui.rubber(box)
        for name in self.ACTIONS:
            gui.button(
                box, self, name.capitalize(),
                lambda *args, fun=name: self._initialize_values(fun),
                autoDefault=False
            )
        gui.rubber(box)

        gui.checkBox(self.buttonsArea, self, "append_to_data",
                     "Append this instance to input data",
                     callback=self.commit.deferred)
        gui.rubber(self.buttonsArea)
        gui.auto_apply(self.buttonsArea, self, "auto_commit")

        self.settingsAboutToBePacked.connect(self.pack_settings)

    def __filter_edit_changed(self):
        self.proxy_model.setFilterFixedString(self.filter_edit.text().strip())

    def __table_data_changed(self):
        self.commit.deferred()

    def __menu_requested(self, point: QPoint):
        index = self.view.indexAt(point)
        model: QSortFilterProxyModel = index.model()
        source_index = model.mapToSource(index)
        menu = QMenu(self)
        for action in self._create_actions(source_index):
            menu.addAction(action)
        menu.popup(self.view.viewport().mapToGlobal(point))

    def _create_actions(self, index: QModelIndex) -> List[QAction]:
        actions = []
        for name in self.ACTIONS:
            action = QAction(name.capitalize(), self)
            action.triggered.connect(
                lambda *args, fun=name: self._initialize_values(fun, [index])
            )
            actions.append(action)
        return actions

    def _initialize_values(self, fun: str, indices: List[QModelIndex] = None):
        cont_fun = {"median": np.nanmedian,
                    "mean": np.nanmean,
                    "random": cont_random,
                    "input": np.nanmean}.get(fun, NotImplemented)
        disc_fun = {"median": majority,
                    "mean": majority,
                    "random": disc_random,
                    "input": majority}.get(fun, NotImplemented)

        if not self.data or fun == "input" and not self.reference:
            return

        self.model.dataChanged.disconnect(self.__table_data_changed)
        rows = range(self.proxy_model.rowCount()) if indices is None else \
            [index.row() for index in indices]
        for row in rows:
            index = self.model.index(row, self.Header.variable)
            variable = self.model.data(index, VariableRole)

            if fun == "input":
                if variable not in self.reference.domain:
                    continue
                values = self.reference.get_column_view(variable)[0]
                if variable.is_primitive():
                    values = values.astype(float)
                    if all(np.isnan(values)):
                        continue
            else:
                values = self.model.data(index, ValuesRole)

            if variable.is_continuous:
                value = cont_fun(values)
                value = round(value, variable.number_of_decimals)
            elif variable.is_discrete:
                value = disc_fun(values)
            elif variable.is_string:
                value = ""
            else:
                raise NotImplementedError

            self.model.setData(index, value, ValueRole)
        self.model.dataChanged.connect(self.__table_data_changed)
        self.commit.deferred()

    @Inputs.data
    def set_data(self, data: Table):
        self.data = data
        self._set_model_data()
        self.commit.now()

    def _set_model_data(self):
        self.Information.nans_removed.clear()
        self.model.removeRows(0, self.model.rowCount())
        if not self.data:
            return

        self.model.set_data(self.data, self.values)
        self.values = {}
        self.view.horizontalHeader().setStretchLastSection(False)
        self.view.resizeColumnsToContents()
        self.view.resizeRowsToContents()
        self.view.horizontalHeader().setStretchLastSection(True)

    @Inputs.reference
    def set_reference(self, data: Table):
        self.reference = data

    @gui.deferred
    def commit(self):
        output_data = None
        if self.data:
            output_data = self._create_data_from_values()
            if self.append_to_data:
                output_data = self._append_to_data(output_data)
        self.Outputs.data.send(output_data)

    def _create_data_from_values(self) -> Table:
        data = Table.from_domain(self.data.domain, 1)
        with data.unlocked():
            data.name = "created"
            if data.X.size:
                data.X[:] = np.nan
            if data.Y.size:
                data.Y[:] = np.nan
            for i, m in enumerate(self.data.domain.metas):
                data.metas[:, i] = "" if m.is_string else np.nan

            values = self._get_values()
            for var_name, value in values.items():
                data[:, var_name] = value
        return data

    def _append_to_data(self, data: Table) -> Table:
        assert self.data
        assert len(data) == 1

        var = DiscreteVariable("Source ID", values=(self.data.name, data.name))
        data = Table.concatenate([self.data, data], axis=0)
        domain = Domain(data.domain.attributes, data.domain.class_vars,
                        data.domain.metas + (var,))
        data = data.transform(domain)
        with data.unlocked(data.metas):
            data.metas[: len(self.data), -1] = 0
            data.metas[len(self.data):, -1] = 1
        return data

    def _get_values(self) -> Dict[str, Union[str, float]]:
        values = {}
        for row in range(self.model.rowCount()):
            index = self.model.index(row, self.Header.variable)
            values[self.model.data(index, VariableRole).name] = \
                self.model.data(index, ValueRole)
        return values

    def send_report(self):
        if not self.data:
            return
        self.report_domain("Input", self.data.domain)
        self.report_domain("Output", self.data.domain)
        items = []
        values: Dict = self._get_values()
        for var in self.data.domain.variables + self.data.domain.metas:
            val = values.get(var.name, np.nan)
            if var.is_primitive():
                val = var.repr_val(val)
            items.append([f"{var.name}:", val])
        self.report_table("Values", items)

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

    def pack_settings(self):
        self.values: Dict[str, Union[str, float]] = self._get_values()


if __name__ == "__main__":  # pragma: no cover
    table = Table("housing")
    WidgetPreview(OWCreateInstance).run(set_data=table,
                                        set_reference=table[:1])

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