{
    "file_diffs": [
        {
            "old_file_content": "import os\nimport logging\nfrom itertools import chain\nfrom warnings import catch_warnings\nfrom urllib.parse import urlparse\nfrom typing import List\n\nimport numpy as np\nfrom AnyQt.QtWidgets import \\\n    QStyle, QComboBox, QMessageBox, QGridLayout, QLabel, \\\n    QLineEdit, QSizePolicy as Policy, QCompleter\nfrom AnyQt.QtCore import Qt, QTimer, QSize\n\nfrom Orange.data.table import Table, get_sample_datasets_dir\nfrom Orange.data.io import FileFormat, UrlReader, class_from_qualified_name\nfrom Orange.widgets import widget, gui\nfrom Orange.widgets.settings import Setting, ContextSetting, \\\n    PerfectDomainContextHandler, SettingProvider\nfrom Orange.widgets.utils.domaineditor import DomainEditor\nfrom Orange.widgets.utils.itemmodels import PyListModel\nfrom Orange.widgets.utils.filedialogs import RecentPathsWComboMixin, \\\n    open_filename_dialog\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\nfrom Orange.widgets.utils.state_summary import format_summary_details\nfrom Orange.widgets.widget import Output, Msg\n\n# Backward compatibility: class RecentPath used to be defined in this module,\n# and it is used in saved (pickled) settings. It must be imported into the\n# module's namespace so that old saved settings still work\nfrom Orange.widgets.utils.filedialogs import RecentPath\n\n\nlog = logging.getLogger(__name__)\n\n\ndef add_origin(examples, filename):\n    \"\"\"\n    Adds attribute with file location to each string variable\n    Used for relative filenames stored in string variables (e.g. pictures)\n    TODO: we should consider a cleaner solution (special variable type, ...)\n    \"\"\"\n    if not filename:\n        return\n    strings = [var\n               for var in examples.domain.variables + examples.domain.metas\n               if var.is_string]\n    dir_name, _ = os.path.split(filename)\n    for var in strings:\n        if \"type\" in var.attributes and \"origin\" not in var.attributes:\n            var.attributes[\"origin\"] = dir_name\n\n\nclass NamedURLModel(PyListModel):\n    def __init__(self, mapping):\n        self.mapping = mapping\n        super().__init__()\n\n    def data(self, index, role=Qt.DisplayRole):\n        data = super().data(index, role)\n        if role == Qt.DisplayRole:\n            return self.mapping.get(data, data)\n        return data\n\n    def add_name(self, url, name):\n        self.mapping[url] = name\n        self.modelReset.emit()\n\n\nclass LineEditSelectOnFocus(QLineEdit):\n    def focusInEvent(self, event):\n        super().focusInEvent(event)\n        # If selectAll is called directly, placing the cursor unselects the text\n        QTimer.singleShot(0, self.selectAll)\n\n\nclass OWFile(widget.OWWidget, RecentPathsWComboMixin):\n    name = \"File\"\n    id = \"orange.widgets.data.file\"\n    description = \"Read data from an input file or network \" \\\n                  \"and send a data table to the output.\"\n    icon = \"icons/File.svg\"\n    priority = 10\n    category = \"Data\"\n    keywords = [\"file\", \"load\", \"read\", \"open\"]\n\n    class Outputs:\n        data = Output(\"Data\", Table,\n                      doc=\"Attribute-valued dataset read from the input file.\")\n\n    want_main_area = False\n    buttons_area_orientation = None\n\n    SEARCH_PATHS = [(\"sample-datasets\", get_sample_datasets_dir())]\n    SIZE_LIMIT = 1e7\n    LOCAL_FILE, URL = range(2)\n\n    settingsHandler = PerfectDomainContextHandler(\n        match_values=PerfectDomainContextHandler.MATCH_VALUES_ALL\n    )\n\n    # pylint seems to want declarations separated from definitions\n    recent_paths: List[RecentPath]\n    recent_urls: List[str]\n    variables: list\n\n    # Overload RecentPathsWidgetMixin.recent_paths to set defaults\n    recent_paths = Setting([\n        RecentPath(\"\", \"sample-datasets\", \"iris.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"titanic.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"housing.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"heart_disease.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"brown-selected.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"zoo.tab\"),\n    ])\n    recent_urls = Setting([])\n    source = Setting(LOCAL_FILE)\n    sheet_names = Setting({})\n    url = Setting(\"\")\n\n    variables = ContextSetting([])\n\n    domain_editor = SettingProvider(DomainEditor)\n\n    class Warning(widget.OWWidget.Warning):\n        file_too_big = Msg(\"The file is too large to load automatically.\"\n                           \" Press Reload to load.\")\n        load_warning = Msg(\"Read warning:\\n{}\")\n        performance_warning = Msg(\n            \"Categorical variables with >100 values may decrease performance.\")\n        renamed_vars = Msg(\"Some variables have been renamed \"\n                           \"to avoid duplicates.\\n{}\")\n        multiple_targets = Msg(\"Most widgets do not support multiple targets\")\n\n    class Error(widget.OWWidget.Error):\n        file_not_found = Msg(\"File not found.\")\n        missing_reader = Msg(\"Missing reader.\")\n        sheet_error = Msg(\"Error listing available sheets.\")\n        unknown = Msg(\"Read error:\\n{}\")\n\n    class NoFileSelected:\n        pass\n\n    UserAdviceMessages = [\n        widget.Message(\n            \"Use CSV File Import widget for advanced options \"\n            \"for comma-separated files\",\n            \"use-csv-file-import\"),\n        widget.Message(\n            \"This widget loads only tabular data. Use other widgets to load \"\n            \"other data types like models, distance matrices and networks.\",\n            \"other-data-types\"\n        )\n    ]\n\n    def __init__(self):\n        super().__init__()\n        RecentPathsWComboMixin.__init__(self)\n        self.domain = None\n        self.data = None\n        self.loaded_file = \"\"\n        self.reader = None\n\n        layout = QGridLayout()\n        layout.setSpacing(4)\n        gui.widgetBox(self.controlArea, orientation=layout, box='Source')\n        vbox = gui.radioButtons(None, self, \"source\", box=True,\n                                callback=self.load_data, addToLayout=False)\n\n        rb_button = gui.appendRadioButton(vbox, \"File:\", addToLayout=False)\n        layout.addWidget(rb_button, 0, 0, Qt.AlignVCenter)\n\n        box = gui.hBox(None, addToLayout=False, margin=0)\n        box.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)\n        self.file_combo.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)\n        self.file_combo.activated[int].connect(self.select_file)\n        box.layout().addWidget(self.file_combo)\n        layout.addWidget(box, 0, 1)\n\n        file_button = gui.button(\n            None, self, '...', callback=self.browse_file, autoDefault=False)\n        file_button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))\n        file_button.setSizePolicy(Policy.Maximum, Policy.Fixed)\n        layout.addWidget(file_button, 0, 2)\n\n        reload_button = gui.button(\n            None, self, \"Reload\", callback=self.load_data, autoDefault=False)\n        reload_button.setIcon(self.style().standardIcon(\n            QStyle.SP_BrowserReload))\n        reload_button.setSizePolicy(Policy.Fixed, Policy.Fixed)\n        layout.addWidget(reload_button, 0, 3)\n\n        self.sheet_box = gui.hBox(None, addToLayout=False, margin=0)\n        self.sheet_combo = QComboBox()\n        self.sheet_combo.activated[str].connect(self.select_sheet)\n        self.sheet_combo.setSizePolicy(\n            Policy.MinimumExpanding, Policy.Fixed)\n        self.sheet_label = QLabel()\n        self.sheet_label.setText('Sheet')\n        self.sheet_label.setSizePolicy(\n            Policy.MinimumExpanding, Policy.Fixed)\n        self.sheet_box.layout().addWidget(\n            self.sheet_label, Qt.AlignLeft)\n        self.sheet_box.layout().addWidget(\n            self.sheet_combo, Qt.AlignVCenter)\n        layout.addWidget(self.sheet_box, 2, 1)\n        self.sheet_box.hide()\n\n        rb_button = gui.appendRadioButton(vbox, \"URL:\", addToLayout=False)\n        layout.addWidget(rb_button, 3, 0, Qt.AlignVCenter)\n\n        self.url_combo = url_combo = QComboBox()\n        url_model = NamedURLModel(self.sheet_names)\n        url_model.wrap(self.recent_urls)\n        url_combo.setLineEdit(LineEditSelectOnFocus())\n        url_combo.setModel(url_model)\n        url_combo.setSizePolicy(Policy.Ignored, Policy.Fixed)\n        url_combo.setEditable(True)\n        url_combo.setInsertPolicy(url_combo.InsertAtTop)\n        url_edit = url_combo.lineEdit()\n        l, t, r, b = url_edit.getTextMargins()\n        url_edit.setTextMargins(l + 5, t, r, b)\n        layout.addWidget(url_combo, 3, 1, 1, 3)\n        url_combo.activated.connect(self._url_set)\n        # whit completer we set that combo box is case sensitive when\n        # matching the history\n        completer = QCompleter()\n        completer.setCaseSensitivity(Qt.CaseSensitive)\n        url_combo.setCompleter(completer)\n\n        box = gui.vBox(self.controlArea, \"Info\")\n        self.infolabel = gui.widgetLabel(box, 'No data loaded.')\n        self.warnings = gui.widgetLabel(box, '')\n\n        box = gui.widgetBox(self.controlArea, \"Columns (Double click to edit)\")\n        self.domain_editor = DomainEditor(self)\n        self.editor_model = self.domain_editor.model()\n        box.layout().addWidget(self.domain_editor)\n\n        box = gui.hBox(box)\n        gui.button(\n            box, self, \"Reset\", callback=self.reset_domain_edit,\n            autoDefault=False\n        )\n        gui.rubber(box)\n        self.apply_button = gui.button(\n            box, self, \"Apply\", callback=self.apply_domain_edit)\n        self.apply_button.setEnabled(False)\n        self.apply_button.setFixedWidth(170)\n        self.editor_model.dataChanged.connect(\n            lambda: self.apply_button.setEnabled(True))\n\n        hBox = gui.hBox(self.controlArea)\n        gui.rubber(hBox)\n        gui.button(\n            hBox, self, \"Browse documentation datasets\",\n            callback=lambda: self.browse_file(True), autoDefault=False)\n        gui.rubber(hBox)\n\n        self.info.set_output_summary(self.info.NoOutput)\n\n        self.set_file_list()\n        # Must not call open_file from within __init__. open_file\n        # explicitly re-enters the event loop (by a progress bar)\n\n        self.setAcceptDrops(True)\n\n        if self.source == self.LOCAL_FILE:\n            last_path = self.last_path()\n            if last_path and os.path.exists(last_path) and \\\n                    os.path.getsize(last_path) > self.SIZE_LIMIT:\n                self.Warning.file_too_big()\n                return\n\n        QTimer.singleShot(0, self.load_data)\n\n    @staticmethod\n    def sizeHint():\n        return QSize(600, 550)\n\n    def select_file(self, n):\n        assert n < len(self.recent_paths)\n        super().select_file(n)\n        if self.recent_paths:\n            self.source = self.LOCAL_FILE\n            self.load_data()\n            self.set_file_list()\n\n    def select_sheet(self):\n        self.recent_paths[0].sheet = self.sheet_combo.currentText()\n        self.load_data()\n\n    def _url_set(self):\n        url = self.url_combo.currentText()\n        pos = self.recent_urls.index(url)\n        url = url.strip()\n\n        if not urlparse(url).scheme:\n            url = 'http://' + url\n            self.url_combo.setItemText(pos, url)\n            self.recent_urls[pos] = url\n\n        self.source = self.URL\n        self.load_data()\n\n    def browse_file(self, in_demos=False):\n        if in_demos:\n            start_file = get_sample_datasets_dir()\n            if not os.path.exists(start_file):\n                QMessageBox.information(\n                    None, \"File\",\n                    \"Cannot find the directory with documentation datasets\")\n                return\n        else:\n            start_file = self.last_path() or os.path.expanduser(\"~/\")\n\n        readers = [f for f in FileFormat.formats\n                   if getattr(f, 'read', None)\n                   and getattr(f, \"EXTENSIONS\", None)]\n        filename, reader, _ = open_filename_dialog(start_file, None, readers)\n        if not filename:\n            return\n        self.add_path(filename)\n        if reader is not None:\n            self.recent_paths[0].file_format = reader.qualified_name()\n\n        self.source = self.LOCAL_FILE\n        self.load_data()\n\n    # Open a file, create data from it and send it over the data channel\n    def load_data(self):\n        # We need to catch any exception type since anything can happen in\n        # file readers\n        self.closeContext()\n        self.domain_editor.set_domain(None)\n        self.apply_button.setEnabled(False)\n        self.clear_messages()\n        self.set_file_list()\n\n        error = self._try_load()\n        if error:\n            error()\n            self.data = None\n            self.sheet_box.hide()\n            self.Outputs.data.send(None)\n            self.infolabel.setText(\"No data.\")\n            self.info.set_output_summary(self.info.NoOutput)\n\n    def _try_load(self):\n        # pylint: disable=broad-except\n        if self.last_path() and not os.path.exists(self.last_path()):\n            return self.Error.file_not_found\n\n        try:\n            self.reader = self._get_reader()\n            assert self.reader is not None\n        except Exception:\n            return self.Error.missing_reader\n\n        if self.reader is self.NoFileSelected:\n            self.Outputs.data.send(None)\n            self.info.set_output_summary(self.info.NoOutput)\n            return None\n\n        try:\n            self._update_sheet_combo()\n        except Exception:\n            return self.Error.sheet_error\n\n        with catch_warnings(record=True) as warnings:\n            try:\n                data = self.reader.read()\n            except Exception as ex:\n                log.exception(ex)\n                return lambda x=ex: self.Error.unknown(str(x))\n            if warnings:\n                self.Warning.load_warning(warnings[-1].message.args[0])\n\n        self.infolabel.setText(self._describe(data))\n\n        self.loaded_file = self.last_path()\n        add_origin(data, self.loaded_file)\n        self.data = data\n        self.openContext(data.domain)\n        self.apply_domain_edit()  # sends data\n        return None\n\n    def _get_reader(self) -> FileFormat:\n        if self.source == self.LOCAL_FILE:\n            path = self.last_path()\n            if path is None:\n                return self.NoFileSelected\n            if self.recent_paths and self.recent_paths[0].file_format:\n                qname = self.recent_paths[0].file_format\n                reader_class = class_from_qualified_name(qname)\n                reader = reader_class(path)\n            else:\n                reader = FileFormat.get_reader(path)\n            if self.recent_paths and self.recent_paths[0].sheet:\n                reader.select_sheet(self.recent_paths[0].sheet)\n            return reader\n        else:\n            url = self.url_combo.currentText().strip()\n            if url:\n                return UrlReader(url)\n            else:\n                return self.NoFileSelected\n\n    def _update_sheet_combo(self):\n        if len(self.reader.sheets) < 2:\n            self.sheet_box.hide()\n            self.reader.select_sheet(None)\n            return\n\n        self.sheet_combo.clear()\n        self.sheet_combo.addItems(self.reader.sheets)\n        self._select_active_sheet()\n        self.sheet_box.show()\n\n    def _select_active_sheet(self):\n        try:\n            idx = self.reader.sheets.index(self.reader.sheet)\n            self.sheet_combo.setCurrentIndex(idx)\n        except ValueError:\n            # Requested sheet does not exist in this file\n            self.reader.select_sheet(None)\n            self.sheet_combo.setCurrentIndex(0)\n\n    @staticmethod\n    def _describe(table):\n        def missing_prop(prop):\n            if prop:\n                return f\"({prop * 100:.1f}% missing values)\"\n            else:\n                return \"(no missing values)\"\n\n        domain = table.domain\n        text = \"\"\n\n        attrs = getattr(table, \"attributes\", {})\n        descs = [attrs[desc]\n                 for desc in (\"Name\", \"Description\") if desc in attrs]\n        if len(descs) == 2:\n            descs[0] = f\"<b>{descs[0]}</b>\"\n        if descs:\n            text += f\"<p>{'<br/>'.join(descs)}</p>\"\n\n        text += f\"<p>{len(table)} instance(s)\"\n\n        missing_in_attr = missing_prop(table.has_missing_attribute()\n                                       and table.get_nan_frequency_attribute())\n        missing_in_class = missing_prop(table.has_missing_class()\n                                        and table.get_nan_frequency_class())\n        text += f\"<br/>{len(domain.attributes)} feature(s) {missing_in_attr}\"\n        if domain.has_continuous_class:\n            text += f\"<br/>Regression; numerical class {missing_in_class}\"\n        elif domain.has_discrete_class:\n            text += \"<br/>Classification; categorical class \" \\\n                f\"with {len(domain.class_var.values)} values {missing_in_class}\"\n        elif table.domain.class_vars:\n            text += \"<br/>Multi-target; \" \\\n                f\"{len(table.domain.class_vars)} target variables \" \\\n                f\"{missing_in_class}\"\n        else:\n            text += \"<br/>Data has no target variable.\"\n        text += f\"<br/>{len(domain.metas)} meta attribute(s)\"\n        text += \"</p>\"\n\n        if 'Timestamp' in table.domain:\n            # Google Forms uses this header to timestamp responses\n            text += f\"<p>First entry: {table[0, 'Timestamp']}<br/>\" \\\n                f\"Last entry: {table[-1, 'Timestamp']}</p>\"\n        return text\n\n    def storeSpecificSettings(self):\n        self.current_context.modified_variables = self.variables[:]\n\n    def retrieveSpecificSettings(self):\n        if hasattr(self.current_context, \"modified_variables\"):\n            self.variables[:] = self.current_context.modified_variables\n\n    def reset_domain_edit(self):\n        self.domain_editor.reset_domain()\n        self.apply_domain_edit()\n\n    def _inspect_discrete_variables(self, domain):\n        for var in chain(domain.variables, domain.metas):\n            if var.is_discrete and len(var.values) > 100:\n                self.Warning.performance_warning()\n\n    def apply_domain_edit(self):\n        self.Warning.performance_warning.clear()\n        self.Warning.renamed_vars.clear()\n        if self.data is None:\n            table = None\n        else:\n            domain, cols, renamed = \\\n                self.domain_editor.get_domain(self.data.domain, self.data,\n                                              deduplicate=True)\n            if not (domain.variables or domain.metas):\n                table = None\n            elif domain is self.data.domain:\n                table = self.data\n            else:\n                X, y, m = cols\n                table = Table.from_numpy(domain, X, y, m, self.data.W)\n                table.name = self.data.name\n                table.ids = np.array(self.data.ids)\n                table.attributes = getattr(self.data, 'attributes', {})\n                self._inspect_discrete_variables(domain)\n            if renamed:\n                self.Warning.renamed_vars(f\"Renamed: {', '.join(renamed)}\")\n\n        self.Warning.multiple_targets(\n            shown=table is not None and len(table.domain.class_vars) > 1)\n        summary = len(table) if table else self.info.NoOutput\n        details = format_summary_details(table) if table else \"\"\n        self.info.set_output_summary(summary, details)\n        self.Outputs.data.send(table)\n        self.apply_button.setEnabled(False)\n\n    def get_widget_name_extension(self):\n        _, name = os.path.split(self.loaded_file)\n        return os.path.splitext(name)[0]\n\n    def send_report(self):\n        def get_ext_name(filename):\n            try:\n                return FileFormat.names[os.path.splitext(filename)[1]]\n            except KeyError:\n                return \"unknown\"\n\n        if self.data is None:\n            self.report_paragraph(\"File\", \"No file.\")\n            return\n\n        if self.source == self.LOCAL_FILE:\n            home = os.path.expanduser(\"~\")\n            if self.loaded_file.startswith(home):\n                # os.path.join does not like ~\n                name = \"~\" + os.path.sep + \\\n                       self.loaded_file[len(home):].lstrip(\"/\").lstrip(\"\\\\\")\n            else:\n                name = self.loaded_file\n            if self.sheet_combo.isVisible():\n                name += f\" ({self.sheet_combo.currentText()})\"\n            self.report_items(\"File\", [(\"File name\", name),\n                                       (\"Format\", get_ext_name(name))])\n        else:\n            self.report_items(\"Data\", [(\"Resource\", self.url),\n                                       (\"Format\", get_ext_name(self.url))])\n\n        self.report_data(\"Data\", self.data)\n\n    @staticmethod\n    def dragEnterEvent(event):\n        \"\"\"Accept drops of valid file urls\"\"\"\n        urls = event.mimeData().urls()\n        if urls:\n            try:\n                FileFormat.get_reader(urls[0].toLocalFile())\n                event.acceptProposedAction()\n            except IOError:\n                pass\n\n    def dropEvent(self, event):\n        \"\"\"Handle file drops\"\"\"\n        urls = event.mimeData().urls()\n        if urls:\n            self.add_path(urls[0].toLocalFile())  # add first file\n            self.source = self.LOCAL_FILE\n            self.load_data()\n\n    def workflowEnvChanged(self, key, value, oldvalue):\n        \"\"\"\n        Function called when environment changes (e.g. while saving the scheme)\n        It make sure that all environment connected values are modified\n        (e.g. relative file paths are changed)\n        \"\"\"\n        self.update_file_list(key, value, oldvalue)\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    WidgetPreview(OWFile).run()\n",
            "new_file_content": "import os\nimport logging\nfrom itertools import chain\nfrom urllib.parse import urlparse\nfrom typing import List\n\nimport numpy as np\nfrom AnyQt.QtWidgets import \\\n    QStyle, QComboBox, QMessageBox, QGridLayout, QLabel, \\\n    QLineEdit, QSizePolicy as Policy, QCompleter\nfrom AnyQt.QtCore import Qt, QTimer, QSize\n\nfrom Orange.data.table import Table, get_sample_datasets_dir\nfrom Orange.data.io import FileFormat, UrlReader, class_from_qualified_name\nfrom Orange.util import log_warnings\nfrom Orange.widgets import widget, gui\nfrom Orange.widgets.settings import Setting, ContextSetting, \\\n    PerfectDomainContextHandler, SettingProvider\nfrom Orange.widgets.utils.domaineditor import DomainEditor\nfrom Orange.widgets.utils.itemmodels import PyListModel\nfrom Orange.widgets.utils.filedialogs import RecentPathsWComboMixin, \\\n    open_filename_dialog\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\nfrom Orange.widgets.utils.state_summary import format_summary_details\nfrom Orange.widgets.widget import Output, Msg\n\n# Backward compatibility: class RecentPath used to be defined in this module,\n# and it is used in saved (pickled) settings. It must be imported into the\n# module's namespace so that old saved settings still work\nfrom Orange.widgets.utils.filedialogs import RecentPath\n\n\nlog = logging.getLogger(__name__)\n\n\ndef add_origin(examples, filename):\n    \"\"\"\n    Adds attribute with file location to each string variable\n    Used for relative filenames stored in string variables (e.g. pictures)\n    TODO: we should consider a cleaner solution (special variable type, ...)\n    \"\"\"\n    if not filename:\n        return\n    strings = [var\n               for var in examples.domain.variables + examples.domain.metas\n               if var.is_string]\n    dir_name, _ = os.path.split(filename)\n    for var in strings:\n        if \"type\" in var.attributes and \"origin\" not in var.attributes:\n            var.attributes[\"origin\"] = dir_name\n\n\nclass NamedURLModel(PyListModel):\n    def __init__(self, mapping):\n        self.mapping = mapping\n        super().__init__()\n\n    def data(self, index, role=Qt.DisplayRole):\n        data = super().data(index, role)\n        if role == Qt.DisplayRole:\n            return self.mapping.get(data, data)\n        return data\n\n    def add_name(self, url, name):\n        self.mapping[url] = name\n        self.modelReset.emit()\n\n\nclass LineEditSelectOnFocus(QLineEdit):\n    def focusInEvent(self, event):\n        super().focusInEvent(event)\n        # If selectAll is called directly, placing the cursor unselects the text\n        QTimer.singleShot(0, self.selectAll)\n\n\nclass OWFile(widget.OWWidget, RecentPathsWComboMixin):\n    name = \"File\"\n    id = \"orange.widgets.data.file\"\n    description = \"Read data from an input file or network \" \\\n                  \"and send a data table to the output.\"\n    icon = \"icons/File.svg\"\n    priority = 10\n    category = \"Data\"\n    keywords = [\"file\", \"load\", \"read\", \"open\"]\n\n    class Outputs:\n        data = Output(\"Data\", Table,\n                      doc=\"Attribute-valued dataset read from the input file.\")\n\n    want_main_area = False\n    buttons_area_orientation = None\n\n    SEARCH_PATHS = [(\"sample-datasets\", get_sample_datasets_dir())]\n    SIZE_LIMIT = 1e7\n    LOCAL_FILE, URL = range(2)\n\n    settingsHandler = PerfectDomainContextHandler(\n        match_values=PerfectDomainContextHandler.MATCH_VALUES_ALL\n    )\n\n    # pylint seems to want declarations separated from definitions\n    recent_paths: List[RecentPath]\n    recent_urls: List[str]\n    variables: list\n\n    # Overload RecentPathsWidgetMixin.recent_paths to set defaults\n    recent_paths = Setting([\n        RecentPath(\"\", \"sample-datasets\", \"iris.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"titanic.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"housing.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"heart_disease.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"brown-selected.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"zoo.tab\"),\n    ])\n    recent_urls = Setting([])\n    source = Setting(LOCAL_FILE)\n    sheet_names = Setting({})\n    url = Setting(\"\")\n\n    variables = ContextSetting([])\n\n    domain_editor = SettingProvider(DomainEditor)\n\n    class Warning(widget.OWWidget.Warning):\n        file_too_big = Msg(\"The file is too large to load automatically.\"\n                           \" Press Reload to load.\")\n        load_warning = Msg(\"Read warning:\\n{}\")\n        performance_warning = Msg(\n            \"Categorical variables with >100 values may decrease performance.\")\n        renamed_vars = Msg(\"Some variables have been renamed \"\n                           \"to avoid duplicates.\\n{}\")\n        multiple_targets = Msg(\"Most widgets do not support multiple targets\")\n\n    class Error(widget.OWWidget.Error):\n        file_not_found = Msg(\"File not found.\")\n        missing_reader = Msg(\"Missing reader.\")\n        sheet_error = Msg(\"Error listing available sheets.\")\n        unknown = Msg(\"Read error:\\n{}\")\n\n    class NoFileSelected:\n        pass\n\n    UserAdviceMessages = [\n        widget.Message(\n            \"Use CSV File Import widget for advanced options \"\n            \"for comma-separated files\",\n            \"use-csv-file-import\"),\n        widget.Message(\n            \"This widget loads only tabular data. Use other widgets to load \"\n            \"other data types like models, distance matrices and networks.\",\n            \"other-data-types\"\n        )\n    ]\n\n    def __init__(self):\n        super().__init__()\n        RecentPathsWComboMixin.__init__(self)\n        self.domain = None\n        self.data = None\n        self.loaded_file = \"\"\n        self.reader = None\n\n        layout = QGridLayout()\n        layout.setSpacing(4)\n        gui.widgetBox(self.controlArea, orientation=layout, box='Source')\n        vbox = gui.radioButtons(None, self, \"source\", box=True,\n                                callback=self.load_data, addToLayout=False)\n\n        rb_button = gui.appendRadioButton(vbox, \"File:\", addToLayout=False)\n        layout.addWidget(rb_button, 0, 0, Qt.AlignVCenter)\n\n        box = gui.hBox(None, addToLayout=False, margin=0)\n        box.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)\n        self.file_combo.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)\n        self.file_combo.activated[int].connect(self.select_file)\n        box.layout().addWidget(self.file_combo)\n        layout.addWidget(box, 0, 1)\n\n        file_button = gui.button(\n            None, self, '...', callback=self.browse_file, autoDefault=False)\n        file_button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))\n        file_button.setSizePolicy(Policy.Maximum, Policy.Fixed)\n        layout.addWidget(file_button, 0, 2)\n\n        reload_button = gui.button(\n            None, self, \"Reload\", callback=self.load_data, autoDefault=False)\n        reload_button.setIcon(self.style().standardIcon(\n            QStyle.SP_BrowserReload))\n        reload_button.setSizePolicy(Policy.Fixed, Policy.Fixed)\n        layout.addWidget(reload_button, 0, 3)\n\n        self.sheet_box = gui.hBox(None, addToLayout=False, margin=0)\n        self.sheet_combo = QComboBox()\n        self.sheet_combo.activated[str].connect(self.select_sheet)\n        self.sheet_combo.setSizePolicy(\n            Policy.MinimumExpanding, Policy.Fixed)\n        self.sheet_label = QLabel()\n        self.sheet_label.setText('Sheet')\n        self.sheet_label.setSizePolicy(\n            Policy.MinimumExpanding, Policy.Fixed)\n        self.sheet_box.layout().addWidget(\n            self.sheet_label, Qt.AlignLeft)\n        self.sheet_box.layout().addWidget(\n            self.sheet_combo, Qt.AlignVCenter)\n        layout.addWidget(self.sheet_box, 2, 1)\n        self.sheet_box.hide()\n\n        rb_button = gui.appendRadioButton(vbox, \"URL:\", addToLayout=False)\n        layout.addWidget(rb_button, 3, 0, Qt.AlignVCenter)\n\n        self.url_combo = url_combo = QComboBox()\n        url_model = NamedURLModel(self.sheet_names)\n        url_model.wrap(self.recent_urls)\n        url_combo.setLineEdit(LineEditSelectOnFocus())\n        url_combo.setModel(url_model)\n        url_combo.setSizePolicy(Policy.Ignored, Policy.Fixed)\n        url_combo.setEditable(True)\n        url_combo.setInsertPolicy(url_combo.InsertAtTop)\n        url_edit = url_combo.lineEdit()\n        l, t, r, b = url_edit.getTextMargins()\n        url_edit.setTextMargins(l + 5, t, r, b)\n        layout.addWidget(url_combo, 3, 1, 1, 3)\n        url_combo.activated.connect(self._url_set)\n        # whit completer we set that combo box is case sensitive when\n        # matching the history\n        completer = QCompleter()\n        completer.setCaseSensitivity(Qt.CaseSensitive)\n        url_combo.setCompleter(completer)\n\n        box = gui.vBox(self.controlArea, \"Info\")\n        self.infolabel = gui.widgetLabel(box, 'No data loaded.')\n        self.warnings = gui.widgetLabel(box, '')\n\n        box = gui.widgetBox(self.controlArea, \"Columns (Double click to edit)\")\n        self.domain_editor = DomainEditor(self)\n        self.editor_model = self.domain_editor.model()\n        box.layout().addWidget(self.domain_editor)\n\n        box = gui.hBox(box)\n        gui.button(\n            box, self, \"Reset\", callback=self.reset_domain_edit,\n            autoDefault=False\n        )\n        gui.rubber(box)\n        self.apply_button = gui.button(\n            box, self, \"Apply\", callback=self.apply_domain_edit)\n        self.apply_button.setEnabled(False)\n        self.apply_button.setFixedWidth(170)\n        self.editor_model.dataChanged.connect(\n            lambda: self.apply_button.setEnabled(True))\n\n        hBox = gui.hBox(self.controlArea)\n        gui.rubber(hBox)\n        gui.button(\n            hBox, self, \"Browse documentation datasets\",\n            callback=lambda: self.browse_file(True), autoDefault=False)\n        gui.rubber(hBox)\n\n        self.info.set_output_summary(self.info.NoOutput)\n\n        self.set_file_list()\n        # Must not call open_file from within __init__. open_file\n        # explicitly re-enters the event loop (by a progress bar)\n\n        self.setAcceptDrops(True)\n\n        if self.source == self.LOCAL_FILE:\n            last_path = self.last_path()\n            if last_path and os.path.exists(last_path) and \\\n                    os.path.getsize(last_path) > self.SIZE_LIMIT:\n                self.Warning.file_too_big()\n                return\n\n        QTimer.singleShot(0, self.load_data)\n\n    @staticmethod\n    def sizeHint():\n        return QSize(600, 550)\n\n    def select_file(self, n):\n        assert n < len(self.recent_paths)\n        super().select_file(n)\n        if self.recent_paths:\n            self.source = self.LOCAL_FILE\n            self.load_data()\n            self.set_file_list()\n\n    def select_sheet(self):\n        self.recent_paths[0].sheet = self.sheet_combo.currentText()\n        self.load_data()\n\n    def _url_set(self):\n        url = self.url_combo.currentText()\n        pos = self.recent_urls.index(url)\n        url = url.strip()\n\n        if not urlparse(url).scheme:\n            url = 'http://' + url\n            self.url_combo.setItemText(pos, url)\n            self.recent_urls[pos] = url\n\n        self.source = self.URL\n        self.load_data()\n\n    def browse_file(self, in_demos=False):\n        if in_demos:\n            start_file = get_sample_datasets_dir()\n            if not os.path.exists(start_file):\n                QMessageBox.information(\n                    None, \"File\",\n                    \"Cannot find the directory with documentation datasets\")\n                return\n        else:\n            start_file = self.last_path() or os.path.expanduser(\"~/\")\n\n        readers = [f for f in FileFormat.formats\n                   if getattr(f, 'read', None)\n                   and getattr(f, \"EXTENSIONS\", None)]\n        filename, reader, _ = open_filename_dialog(start_file, None, readers)\n        if not filename:\n            return\n        self.add_path(filename)\n        if reader is not None:\n            self.recent_paths[0].file_format = reader.qualified_name()\n\n        self.source = self.LOCAL_FILE\n        self.load_data()\n\n    # Open a file, create data from it and send it over the data channel\n    def load_data(self):\n        # We need to catch any exception type since anything can happen in\n        # file readers\n        self.closeContext()\n        self.domain_editor.set_domain(None)\n        self.apply_button.setEnabled(False)\n        self.clear_messages()\n        self.set_file_list()\n\n        error = self._try_load()\n        if error:\n            error()\n            self.data = None\n            self.sheet_box.hide()\n            self.Outputs.data.send(None)\n            self.infolabel.setText(\"No data.\")\n            self.info.set_output_summary(self.info.NoOutput)\n\n    def _try_load(self):\n        # pylint: disable=broad-except\n        if self.last_path() and not os.path.exists(self.last_path()):\n            return self.Error.file_not_found\n\n        try:\n            self.reader = self._get_reader()\n            assert self.reader is not None\n        except Exception:\n            return self.Error.missing_reader\n\n        if self.reader is self.NoFileSelected:\n            self.Outputs.data.send(None)\n            self.info.set_output_summary(self.info.NoOutput)\n            return None\n\n        try:\n            self._update_sheet_combo()\n        except Exception:\n            return self.Error.sheet_error\n\n        with log_warnings() as warnings:\n            try:\n                data = self.reader.read()\n            except Exception as ex:\n                log.exception(ex)\n                return lambda x=ex: self.Error.unknown(str(x))\n            if warnings:\n                self.Warning.load_warning(warnings[-1].message.args[0])\n\n        self.infolabel.setText(self._describe(data))\n\n        self.loaded_file = self.last_path()\n        add_origin(data, self.loaded_file)\n        self.data = data\n        self.openContext(data.domain)\n        self.apply_domain_edit()  # sends data\n        return None\n\n    def _get_reader(self) -> FileFormat:\n        if self.source == self.LOCAL_FILE:\n            path = self.last_path()\n            if path is None:\n                return self.NoFileSelected\n            if self.recent_paths and self.recent_paths[0].file_format:\n                qname = self.recent_paths[0].file_format\n                reader_class = class_from_qualified_name(qname)\n                reader = reader_class(path)\n            else:\n                reader = FileFormat.get_reader(path)\n            if self.recent_paths and self.recent_paths[0].sheet:\n                reader.select_sheet(self.recent_paths[0].sheet)\n            return reader\n        else:\n            url = self.url_combo.currentText().strip()\n            if url:\n                return UrlReader(url)\n            else:\n                return self.NoFileSelected\n\n    def _update_sheet_combo(self):\n        if len(self.reader.sheets) < 2:\n            self.sheet_box.hide()\n            self.reader.select_sheet(None)\n            return\n\n        self.sheet_combo.clear()\n        self.sheet_combo.addItems(self.reader.sheets)\n        self._select_active_sheet()\n        self.sheet_box.show()\n\n    def _select_active_sheet(self):\n        try:\n            idx = self.reader.sheets.index(self.reader.sheet)\n            self.sheet_combo.setCurrentIndex(idx)\n        except ValueError:\n            # Requested sheet does not exist in this file\n            self.reader.select_sheet(None)\n            self.sheet_combo.setCurrentIndex(0)\n\n    @staticmethod\n    def _describe(table):\n        def missing_prop(prop):\n            if prop:\n                return f\"({prop * 100:.1f}% missing values)\"\n            else:\n                return \"(no missing values)\"\n\n        domain = table.domain\n        text = \"\"\n\n        attrs = getattr(table, \"attributes\", {})\n        descs = [attrs[desc]\n                 for desc in (\"Name\", \"Description\") if desc in attrs]\n        if len(descs) == 2:\n            descs[0] = f\"<b>{descs[0]}</b>\"\n        if descs:\n            text += f\"<p>{'<br/>'.join(descs)}</p>\"\n\n        text += f\"<p>{len(table)} instance(s)\"\n\n        missing_in_attr = missing_prop(table.has_missing_attribute()\n                                       and table.get_nan_frequency_attribute())\n        missing_in_class = missing_prop(table.has_missing_class()\n                                        and table.get_nan_frequency_class())\n        text += f\"<br/>{len(domain.attributes)} feature(s) {missing_in_attr}\"\n        if domain.has_continuous_class:\n            text += f\"<br/>Regression; numerical class {missing_in_class}\"\n        elif domain.has_discrete_class:\n            text += \"<br/>Classification; categorical class \" \\\n                f\"with {len(domain.class_var.values)} values {missing_in_class}\"\n        elif table.domain.class_vars:\n            text += \"<br/>Multi-target; \" \\\n                f\"{len(table.domain.class_vars)} target variables \" \\\n                f\"{missing_in_class}\"\n        else:\n            text += \"<br/>Data has no target variable.\"\n        text += f\"<br/>{len(domain.metas)} meta attribute(s)\"\n        text += \"</p>\"\n\n        if 'Timestamp' in table.domain:\n            # Google Forms uses this header to timestamp responses\n            text += f\"<p>First entry: {table[0, 'Timestamp']}<br/>\" \\\n                f\"Last entry: {table[-1, 'Timestamp']}</p>\"\n        return text\n\n    def storeSpecificSettings(self):\n        self.current_context.modified_variables = self.variables[:]\n\n    def retrieveSpecificSettings(self):\n        if hasattr(self.current_context, \"modified_variables\"):\n            self.variables[:] = self.current_context.modified_variables\n\n    def reset_domain_edit(self):\n        self.domain_editor.reset_domain()\n        self.apply_domain_edit()\n\n    def _inspect_discrete_variables(self, domain):\n        for var in chain(domain.variables, domain.metas):\n            if var.is_discrete and len(var.values) > 100:\n                self.Warning.performance_warning()\n\n    def apply_domain_edit(self):\n        self.Warning.performance_warning.clear()\n        self.Warning.renamed_vars.clear()\n        if self.data is None:\n            table = None\n        else:\n            domain, cols, renamed = \\\n                self.domain_editor.get_domain(self.data.domain, self.data,\n                                              deduplicate=True)\n            if not (domain.variables or domain.metas):\n                table = None\n            elif domain is self.data.domain:\n                table = self.data\n            else:\n                X, y, m = cols\n                table = Table.from_numpy(domain, X, y, m, self.data.W)\n                table.name = self.data.name\n                table.ids = np.array(self.data.ids)\n                table.attributes = getattr(self.data, 'attributes', {})\n                self._inspect_discrete_variables(domain)\n            if renamed:\n                self.Warning.renamed_vars(f\"Renamed: {', '.join(renamed)}\")\n\n        self.Warning.multiple_targets(\n            shown=table is not None and len(table.domain.class_vars) > 1)\n        summary = len(table) if table else self.info.NoOutput\n        details = format_summary_details(table) if table else \"\"\n        self.info.set_output_summary(summary, details)\n        self.Outputs.data.send(table)\n        self.apply_button.setEnabled(False)\n\n    def get_widget_name_extension(self):\n        _, name = os.path.split(self.loaded_file)\n        return os.path.splitext(name)[0]\n\n    def send_report(self):\n        def get_ext_name(filename):\n            try:\n                return FileFormat.names[os.path.splitext(filename)[1]]\n            except KeyError:\n                return \"unknown\"\n\n        if self.data is None:\n            self.report_paragraph(\"File\", \"No file.\")\n            return\n\n        if self.source == self.LOCAL_FILE:\n            home = os.path.expanduser(\"~\")\n            if self.loaded_file.startswith(home):\n                # os.path.join does not like ~\n                name = \"~\" + os.path.sep + \\\n                       self.loaded_file[len(home):].lstrip(\"/\").lstrip(\"\\\\\")\n            else:\n                name = self.loaded_file\n            if self.sheet_combo.isVisible():\n                name += f\" ({self.sheet_combo.currentText()})\"\n            self.report_items(\"File\", [(\"File name\", name),\n                                       (\"Format\", get_ext_name(name))])\n        else:\n            self.report_items(\"Data\", [(\"Resource\", self.url),\n                                       (\"Format\", get_ext_name(self.url))])\n\n        self.report_data(\"Data\", self.data)\n\n    @staticmethod\n    def dragEnterEvent(event):\n        \"\"\"Accept drops of valid file urls\"\"\"\n        urls = event.mimeData().urls()\n        if urls:\n            try:\n                FileFormat.get_reader(urls[0].toLocalFile())\n                event.acceptProposedAction()\n            except IOError:\n                pass\n\n    def dropEvent(self, event):\n        \"\"\"Handle file drops\"\"\"\n        urls = event.mimeData().urls()\n        if urls:\n            self.add_path(urls[0].toLocalFile())  # add first file\n            self.source = self.LOCAL_FILE\n            self.load_data()\n\n    def workflowEnvChanged(self, key, value, oldvalue):\n        \"\"\"\n        Function called when environment changes (e.g. while saving the scheme)\n        It make sure that all environment connected values are modified\n        (e.g. relative file paths are changed)\n        \"\"\"\n        self.update_file_list(key, value, oldvalue)\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    WidgetPreview(OWFile).run()\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/data/owfile.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "470cca0e9",
                "new_commit_hash": "31f6ee147",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/data/owfile.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/data/owfile.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 1,
                            "length": 7
                        },
                        "new_range": {
                            "start": 1,
                            "length": 6
                        },
                        "section": ""
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "import os",
                                "type": "context"
                            },
                            {
                                "content": "import logging",
                                "type": "context"
                            },
                            {
                                "content": "from itertools import chain",
                                "type": "context"
                            },
                            {
                                "content": "from warnings import catch_warnings",
                                "type": "deleted"
                            },
                            {
                                "content": "from urllib.parse import urlparse",
                                "type": "context"
                            },
                            {
                                "content": "from typing import List",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [],
                    "deleted_entities": [
                        {
                            "file_name": "Orange/widgets/data/owfile.py",
                            "type": "statement",
                            "name": "",
                            "content": "from warnings import catch_warnings",
                            "ast_type_str": "ImportFrom",
                            "start_lineno": 4,
                            "end_lineno": 4,
                            "parent": null
                        }
                    ]
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 13,
                            "length": 6
                        },
                        "new_range": {
                            "start": 12,
                            "length": 7
                        },
                        "section": "from AnyQt.QtCore import Qt, QTimer, QSize"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "from Orange.data.table import Table, get_sample_datasets_dir",
                                "type": "context"
                            },
                            {
                                "content": "from Orange.data.io import FileFormat, UrlReader, class_from_qualified_name",
                                "type": "context"
                            },
                            {
                                "content": "from Orange.util import log_warnings",
                                "type": "added"
                            },
                            {
                                "content": "from Orange.widgets import widget, gui",
                                "type": "context"
                            },
                            {
                                "content": "from Orange.widgets.settings import Setting, ContextSetting, \\",
                                "type": "context"
                            },
                            {
                                "content": "    PerfectDomainContextHandler, SettingProvider",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [
                        {
                            "file_name": "Orange/widgets/data/owfile.py",
                            "type": "statement",
                            "name": "",
                            "content": "from Orange.util import log_warnings",
                            "ast_type_str": "ImportFrom",
                            "start_lineno": 15,
                            "end_lineno": 15,
                            "parent": null
                        }
                    ],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 366,
                            "length": 7
                        },
                        "new_range": {
                            "start": 366,
                            "length": 7
                        },
                        "section": "class OWFile(widget.OWWidget, RecentPathsWComboMixin):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        except Exception:",
                                "type": "context"
                            },
                            {
                                "content": "            return self.Error.sheet_error",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        with catch_warnings(record=True) as warnings:",
                                "type": "deleted"
                            },
                            {
                                "content": "        with log_warnings() as warnings:",
                                "type": "added"
                            },
                            {
                                "content": "            try:",
                                "type": "context"
                            },
                            {
                                "content": "                data = self.reader.read()",
                                "type": "context"
                            },
                            {
                                "content": "            except Exception as ex:",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/owfile.py",
                            "type": "method",
                            "name": "OWFile._try_load",
                            "content": "class OWFile(widget.OWWidget, RecentPathsWComboMixin):\n    name = \"File\"\n    id = \"orange.widgets.data.file\"\n    description = \"Read data from an input file or network \" \\\n                  \"and send a data table to the output.\"\n    icon = \"icons/File.svg\"\n    priority = 10\n    category = \"Data\"\n    keywords = [\"file\", \"load\", \"read\", \"open\"]\n\n    class Outputs:\n        data = Output(\"Data\", Table,\n                      doc=\"Attribute-valued dataset read from the input file.\")\n\n    want_main_area = False\n    buttons_area_orientation = None\n\n    SEARCH_PATHS = [(\"sample-datasets\", get_sample_datasets_dir())]\n    SIZE_LIMIT = 1e7\n    LOCAL_FILE, URL = range(2)\n\n    settingsHandler = PerfectDomainContextHandler(\n        match_values=PerfectDomainContextHandler.MATCH_VALUES_ALL\n    )\n\n    # pylint seems to want declarations separated from definitions\n    recent_paths: List[RecentPath]\n    recent_urls: List[str]\n    variables: list\n\n    # Overload RecentPathsWidgetMixin.recent_paths to set defaults\n    recent_paths = Setting([\n        RecentPath(\"\", \"sample-datasets\", \"iris.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"titanic.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"housing.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"heart_disease.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"brown-selected.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"zoo.tab\"),\n    ])\n    recent_urls = Setting([])\n    source = Setting(LOCAL_FILE)\n    sheet_names = Setting({})\n    url = Setting(\"\")\n\n    variables = ContextSetting([])\n\n    domain_editor = SettingProvider(DomainEditor)\n\n    class Warning(widget.OWWidget.Warning):\n        file_too_big = Msg(\"The file is too large to load automatically.\"\n                           \" Press Reload to load.\")\n        load_warning = Msg(\"Read warning:\\n{}\")\n        performance_warning = Msg(\n            \"Categorical variables with >100 values may decrease performance.\")\n        renamed_vars = Msg(\"Some variables have been renamed \"\n                           \"to avoid duplicates.\\n{}\")\n        multiple_targets = Msg(\"Most widgets do not support multiple targets\")\n\n    class Error(widget.OWWidget.Error):\n        file_not_found = Msg(\"File not found.\")\n        missing_reader = Msg(\"Missing reader.\")\n        sheet_error = Msg(\"Error listing available sheets.\")\n        unknown = Msg(\"Read error:\\n{}\")\n\n    class NoFileSelected:\n        pass\n\n    UserAdviceMessages = [\n        widget.Message(\n            \"Use CSV File Import widget for advanced options \"\n            \"for comma-separated files\",\n            \"use-csv-file-import\"),\n        widget.Message(\n            \"This widget loads only tabular data. Use other widgets to load \"\n            \"other data types like models, distance matrices and networks.\",\n            \"other-data-types\"\n        )\n    ]\n\n    def __init__(self):\n        super().__init__()\n        RecentPathsWComboMixin.__init__(self)\n        self.domain = None\n        self.data = None\n        self.loaded_file = \"\"\n        self.reader = None\n\n        layout = QGridLayout()\n        layout.setSpacing(4)\n        gui.widgetBox(self.controlArea, orientation=layout, box='Source')\n        vbox = gui.radioButtons(None, self, \"source\", box=True,\n                                callback=self.load_data, addToLayout=False)\n\n        rb_button = gui.appendRadioButton(vbox, \"File:\", addToLayout=False)\n        layout.addWidget(rb_button, 0, 0, Qt.AlignVCenter)\n\n        box = gui.hBox(None, addToLayout=False, margin=0)\n        box.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)\n        self.file_combo.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)\n        self.file_combo.activated[int].connect(self.select_file)\n        box.layout().addWidget(self.file_combo)\n        layout.addWidget(box, 0, 1)\n\n        file_button = gui.button(\n            None, self, '...', callback=self.browse_file, autoDefault=False)\n        file_button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))\n        file_button.setSizePolicy(Policy.Maximum, Policy.Fixed)\n        layout.addWidget(file_button, 0, 2)\n\n        reload_button = gui.button(\n            None, self, \"Reload\", callback=self.load_data, autoDefault=False)\n        reload_button.setIcon(self.style().standardIcon(\n            QStyle.SP_BrowserReload))\n        reload_button.setSizePolicy(Policy.Fixed, Policy.Fixed)\n        layout.addWidget(reload_button, 0, 3)\n\n        self.sheet_box = gui.hBox(None, addToLayout=False, margin=0)\n        self.sheet_combo = QComboBox()\n        self.sheet_combo.activated[str].connect(self.select_sheet)\n        self.sheet_combo.setSizePolicy(\n            Policy.MinimumExpanding, Policy.Fixed)\n        self.sheet_label = QLabel()\n        self.sheet_label.setText('Sheet')\n        self.sheet_label.setSizePolicy(\n            Policy.MinimumExpanding, Policy.Fixed)\n        self.sheet_box.layout().addWidget(\n            self.sheet_label, Qt.AlignLeft)\n        self.sheet_box.layout().addWidget(\n            self.sheet_combo, Qt.AlignVCenter)\n        layout.addWidget(self.sheet_box, 2, 1)\n        self.sheet_box.hide()\n\n        rb_button = gui.appendRadioButton(vbox, \"URL:\", addToLayout=False)\n        layout.addWidget(rb_button, 3, 0, Qt.AlignVCenter)\n\n        self.url_combo = url_combo = QComboBox()\n        url_model = NamedURLModel(self.sheet_names)\n        url_model.wrap(self.recent_urls)\n        url_combo.setLineEdit(LineEditSelectOnFocus())\n        url_combo.setModel(url_model)\n        url_combo.setSizePolicy(Policy.Ignored, Policy.Fixed)\n        url_combo.setEditable(True)\n        url_combo.setInsertPolicy(url_combo.InsertAtTop)\n        url_edit = url_combo.lineEdit()\n        l, t, r, b = url_edit.getTextMargins()\n        url_edit.setTextMargins(l + 5, t, r, b)\n        layout.addWidget(url_combo, 3, 1, 1, 3)\n        url_combo.activated.connect(self._url_set)\n        # whit completer we set that combo box is case sensitive when\n        # matching the history\n        completer = QCompleter()\n        completer.setCaseSensitivity(Qt.CaseSensitive)\n        url_combo.setCompleter(completer)\n\n        box = gui.vBox(self.controlArea, \"Info\")\n        self.infolabel = gui.widgetLabel(box, 'No data loaded.')\n        self.warnings = gui.widgetLabel(box, '')\n\n        box = gui.widgetBox(self.controlArea, \"Columns (Double click to edit)\")\n        self.domain_editor = DomainEditor(self)\n        self.editor_model = self.domain_editor.model()\n        box.layout().addWidget(self.domain_editor)\n\n        box = gui.hBox(box)\n        gui.button(\n            box, self, \"Reset\", callback=self.reset_domain_edit,\n            autoDefault=False\n        )\n        gui.rubber(box)\n        self.apply_button = gui.button(\n            box, self, \"Apply\", callback=self.apply_domain_edit)\n        self.apply_button.setEnabled(False)\n        self.apply_button.setFixedWidth(170)\n        self.editor_model.dataChanged.connect(\n            lambda: self.apply_button.setEnabled(True))\n\n        hBox = gui.hBox(self.controlArea)\n        gui.rubber(hBox)\n        gui.button(\n            hBox, self, \"Browse documentation datasets\",\n            callback=lambda: self.browse_file(True), autoDefault=False)\n        gui.rubber(hBox)\n\n        self.info.set_output_summary(self.info.NoOutput)\n\n        self.set_file_list()\n        # Must not call open_file from within __init__. open_file\n        # explicitly re-enters the event loop (by a progress bar)\n\n        self.setAcceptDrops(True)\n\n        if self.source == self.LOCAL_FILE:\n            last_path = self.last_path()\n            if last_path and os.path.exists(last_path) and \\\n                    os.path.getsize(last_path) > self.SIZE_LIMIT:\n                self.Warning.file_too_big()\n                return\n\n        QTimer.singleShot(0, self.load_data)\n\n    @staticmethod\n    def sizeHint():\n        return QSize(600, 550)\n\n    def select_file(self, n):\n        assert n < len(self.recent_paths)\n        super().select_file(n)\n        if self.recent_paths:\n            self.source = self.LOCAL_FILE\n            self.load_data()\n            self.set_file_list()\n\n    def select_sheet(self):\n        self.recent_paths[0].sheet = self.sheet_combo.currentText()\n        self.load_data()\n\n    def _url_set(self):\n        url = self.url_combo.currentText()\n        pos = self.recent_urls.index(url)\n        url = url.strip()\n\n        if not urlparse(url).scheme:\n            url = 'http://' + url\n            self.url_combo.setItemText(pos, url)\n            self.recent_urls[pos] = url\n\n        self.source = self.URL\n        self.load_data()\n\n    def browse_file(self, in_demos=False):\n        if in_demos:\n            start_file = get_sample_datasets_dir()\n            if not os.path.exists(start_file):\n                QMessageBox.information(\n                    None, \"File\",\n                    \"Cannot find the directory with documentation datasets\")\n                return\n        else:\n            start_file = self.last_path() or os.path.expanduser(\"~/\")\n\n        readers = [f for f in FileFormat.formats\n                   if getattr(f, 'read', None)\n                   and getattr(f, \"EXTENSIONS\", None)]\n        filename, reader, _ = open_filename_dialog(start_file, None, readers)\n        if not filename:\n            return\n        self.add_path(filename)\n        if reader is not None:\n            self.recent_paths[0].file_format = reader.qualified_name()\n\n        self.source = self.LOCAL_FILE\n        self.load_data()\n\n    # Open a file, create data from it and send it over the data channel\n    def load_data(self):\n        # We need to catch any exception type since anything can happen in\n        # file readers\n        self.closeContext()\n        self.domain_editor.set_domain(None)\n        self.apply_button.setEnabled(False)\n        self.clear_messages()\n        self.set_file_list()\n\n        error = self._try_load()\n        if error:\n            error()\n            self.data = None\n            self.sheet_box.hide()\n            self.Outputs.data.send(None)\n            self.infolabel.setText(\"No data.\")\n            self.info.set_output_summary(self.info.NoOutput)\n\n    def _try_load(self):\n        # pylint: disable=broad-except\n        if self.last_path() and not os.path.exists(self.last_path()):\n            return self.Error.file_not_found\n\n        try:\n            self.reader = self._get_reader()\n            assert self.reader is not None\n        except Exception:\n            return self.Error.missing_reader\n\n        if self.reader is self.NoFileSelected:\n            self.Outputs.data.send(None)\n            self.info.set_output_summary(self.info.NoOutput)\n            return None\n\n        try:\n            self._update_sheet_combo()\n        except Exception:\n            return self.Error.sheet_error\n\n        with catch_warnings(record=True) as warnings:\n            try:\n                data = self.reader.read()\n            except Exception as ex:\n                log.exception(ex)\n                return lambda x=ex: self.Error.unknown(str(x))\n            if warnings:\n                self.Warning.load_warning(warnings[-1].message.args[0])\n\n        self.infolabel.setText(self._describe(data))\n\n        self.loaded_file = self.last_path()\n        add_origin(data, self.loaded_file)\n        self.data = data\n        self.openContext(data.domain)\n        self.apply_domain_edit()  # sends data\n        return None\n\n    def _get_reader(self) -> FileFormat:\n        if self.source == self.LOCAL_FILE:\n            path = self.last_path()\n            if path is None:\n                return self.NoFileSelected\n            if self.recent_paths and self.recent_paths[0].file_format:\n                qname = self.recent_paths[0].file_format\n                reader_class = class_from_qualified_name(qname)\n                reader = reader_class(path)\n            else:\n                reader = FileFormat.get_reader(path)\n            if self.recent_paths and self.recent_paths[0].sheet:\n                reader.select_sheet(self.recent_paths[0].sheet)\n            return reader\n        else:\n            url = self.url_combo.currentText().strip()\n            if url:\n                return UrlReader(url)\n            else:\n                return self.NoFileSelected\n\n    def _update_sheet_combo(self):\n        if len(self.reader.sheets) < 2:\n            self.sheet_box.hide()\n            self.reader.select_sheet(None)\n            return\n\n        self.sheet_combo.clear()\n        self.sheet_combo.addItems(self.reader.sheets)\n        self._select_active_sheet()\n        self.sheet_box.show()\n\n    def _select_active_sheet(self):\n        try:\n            idx = self.reader.sheets.index(self.reader.sheet)\n            self.sheet_combo.setCurrentIndex(idx)\n        except ValueError:\n            # Requested sheet does not exist in this file\n            self.reader.select_sheet(None)\n            self.sheet_combo.setCurrentIndex(0)\n\n    @staticmethod\n    def _describe(table):\n        def missing_prop(prop):\n            if prop:\n                return f\"({prop * 100:.1f}% missing values)\"\n            else:\n                return \"(no missing values)\"\n\n        domain = table.domain\n        text = \"\"\n\n        attrs = getattr(table, \"attributes\", {})\n        descs = [attrs[desc]\n                 for desc in (\"Name\", \"Description\") if desc in attrs]\n        if len(descs) == 2:\n            descs[0] = f\"<b>{descs[0]}</b>\"\n        if descs:\n            text += f\"<p>{'<br/>'.join(descs)}</p>\"\n\n        text += f\"<p>{len(table)} instance(s)\"\n\n        missing_in_attr = missing_prop(table.has_missing_attribute()\n                                       and table.get_nan_frequency_attribute())\n        missing_in_class = missing_prop(table.has_missing_class()\n                                        and table.get_nan_frequency_class())\n        text += f\"<br/>{len(domain.attributes)} feature(s) {missing_in_attr}\"\n        if domain.has_continuous_class:\n            text += f\"<br/>Regression; numerical class {missing_in_class}\"\n        elif domain.has_discrete_class:\n            text += \"<br/>Classification; categorical class \" \\\n                f\"with {len(domain.class_var.values)} values {missing_in_class}\"\n        elif table.domain.class_vars:\n            text += \"<br/>Multi-target; \" \\\n                f\"{len(table.domain.class_vars)} target variables \" \\\n                f\"{missing_in_class}\"\n        else:\n            text += \"<br/>Data has no target variable.\"\n        text += f\"<br/>{len(domain.metas)} meta attribute(s)\"\n        text += \"</p>\"\n\n        if 'Timestamp' in table.domain:\n            # Google Forms uses this header to timestamp responses\n            text += f\"<p>First entry: {table[0, 'Timestamp']}<br/>\" \\\n                f\"Last entry: {table[-1, 'Timestamp']}</p>\"\n        return text\n\n    def storeSpecificSettings(self):\n        self.current_context.modified_variables = self.variables[:]\n\n    def retrieveSpecificSettings(self):\n        if hasattr(self.current_context, \"modified_variables\"):\n            self.variables[:] = self.current_context.modified_variables\n\n    def reset_domain_edit(self):\n        self.domain_editor.reset_domain()\n        self.apply_domain_edit()\n\n    def _inspect_discrete_variables(self, domain):\n        for var in chain(domain.variables, domain.metas):\n            if var.is_discrete and len(var.values) > 100:\n                self.Warning.performance_warning()\n\n    def apply_domain_edit(self):\n        self.Warning.performance_warning.clear()\n        self.Warning.renamed_vars.clear()\n        if self.data is None:\n            table = None\n        else:\n            domain, cols, renamed = \\\n                self.domain_editor.get_domain(self.data.domain, self.data,\n                                              deduplicate=True)\n            if not (domain.variables or domain.metas):\n                table = None\n            elif domain is self.data.domain:\n                table = self.data\n            else:\n                X, y, m = cols\n                table = Table.from_numpy(domain, X, y, m, self.data.W)\n                table.name = self.data.name\n                table.ids = np.array(self.data.ids)\n                table.attributes = getattr(self.data, 'attributes', {})\n                self._inspect_discrete_variables(domain)\n            if renamed:\n                self.Warning.renamed_vars(f\"Renamed: {', '.join(renamed)}\")\n\n        self.Warning.multiple_targets(\n            shown=table is not None and len(table.domain.class_vars) > 1)\n        summary = len(table) if table else self.info.NoOutput\n        details = format_summary_details(table) if table else \"\"\n        self.info.set_output_summary(summary, details)\n        self.Outputs.data.send(table)\n        self.apply_button.setEnabled(False)\n\n    def get_widget_name_extension(self):\n        _, name = os.path.split(self.loaded_file)\n        return os.path.splitext(name)[0]\n\n    def send_report(self):\n        def get_ext_name(filename):\n            try:\n                return FileFormat.names[os.path.splitext(filename)[1]]\n            except KeyError:\n                return \"unknown\"\n\n        if self.data is None:\n            self.report_paragraph(\"File\", \"No file.\")\n            return\n\n        if self.source == self.LOCAL_FILE:\n            home = os.path.expanduser(\"~\")\n            if self.loaded_file.startswith(home):\n                # os.path.join does not like ~\n                name = \"~\" + os.path.sep + \\\n                       self.loaded_file[len(home):].lstrip(\"/\").lstrip(\"\\\\\")\n            else:\n                name = self.loaded_file\n            if self.sheet_combo.isVisible():\n                name += f\" ({self.sheet_combo.currentText()})\"\n            self.report_items(\"File\", [(\"File name\", name),\n                                       (\"Format\", get_ext_name(name))])\n        else:\n            self.report_items(\"Data\", [(\"Resource\", self.url),\n                                       (\"Format\", get_ext_name(self.url))])\n\n        self.report_data(\"Data\", self.data)\n\n    @staticmethod\n    def dragEnterEvent(event):\n        \"\"\"Accept drops of valid file urls\"\"\"\n        urls = event.mimeData().urls()\n        if urls:\n            try:\n                FileFormat.get_reader(urls[0].toLocalFile())\n                event.acceptProposedAction()\n            except IOError:\n                pass\n\n    def dropEvent(self, event):\n        \"\"\"Handle file drops\"\"\"\n        urls = event.mimeData().urls()\n        if urls:\n            self.add_path(urls[0].toLocalFile())  # add first file\n            self.source = self.LOCAL_FILE\n            self.load_data()\n\n    def workflowEnvChanged(self, key, value, oldvalue):\n        \"\"\"\n        Function called when environment changes (e.g. while saving the scheme)\n        It make sure that all environment connected values are modified\n        (e.g. relative file paths are changed)\n        \"\"\"\n        self.update_file_list(key, value, oldvalue)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 348,
                            "end_lineno": 385,
                            "parent": {
                                "file_name": "Orange/widgets/data/owfile.py",
                                "type": "class",
                                "name": "OWFile",
                                "content": "class OWFile(widget.OWWidget, RecentPathsWComboMixin):\n    name = \"File\"\n    id = \"orange.widgets.data.file\"\n    description = \"Read data from an input file or network \" \\\n                  \"and send a data table to the output.\"\n    icon = \"icons/File.svg\"\n    priority = 10\n    category = \"Data\"\n    keywords = [\"file\", \"load\", \"read\", \"open\"]\n\n    class Outputs:\n        data = Output(\"Data\", Table,\n                      doc=\"Attribute-valued dataset read from the input file.\")\n\n    want_main_area = False\n    buttons_area_orientation = None\n\n    SEARCH_PATHS = [(\"sample-datasets\", get_sample_datasets_dir())]\n    SIZE_LIMIT = 1e7\n    LOCAL_FILE, URL = range(2)\n\n    settingsHandler = PerfectDomainContextHandler(\n        match_values=PerfectDomainContextHandler.MATCH_VALUES_ALL\n    )\n\n    # pylint seems to want declarations separated from definitions\n    recent_paths: List[RecentPath]\n    recent_urls: List[str]\n    variables: list\n\n    # Overload RecentPathsWidgetMixin.recent_paths to set defaults\n    recent_paths = Setting([\n        RecentPath(\"\", \"sample-datasets\", \"iris.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"titanic.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"housing.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"heart_disease.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"brown-selected.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"zoo.tab\"),\n    ])\n    recent_urls = Setting([])\n    source = Setting(LOCAL_FILE)\n    sheet_names = Setting({})\n    url = Setting(\"\")\n\n    variables = ContextSetting([])\n\n    domain_editor = SettingProvider(DomainEditor)\n\n    class Warning(widget.OWWidget.Warning):\n        file_too_big = Msg(\"The file is too large to load automatically.\"\n                           \" Press Reload to load.\")\n        load_warning = Msg(\"Read warning:\\n{}\")\n        performance_warning = Msg(\n            \"Categorical variables with >100 values may decrease performance.\")\n        renamed_vars = Msg(\"Some variables have been renamed \"\n                           \"to avoid duplicates.\\n{}\")\n        multiple_targets = Msg(\"Most widgets do not support multiple targets\")\n\n    class Error(widget.OWWidget.Error):\n        file_not_found = Msg(\"File not found.\")\n        missing_reader = Msg(\"Missing reader.\")\n        sheet_error = Msg(\"Error listing available sheets.\")\n        unknown = Msg(\"Read error:\\n{}\")\n\n    class NoFileSelected:\n        pass\n\n    UserAdviceMessages = [\n        widget.Message(\n            \"Use CSV File Import widget for advanced options \"\n            \"for comma-separated files\",\n            \"use-csv-file-import\"),\n        widget.Message(\n            \"This widget loads only tabular data. Use other widgets to load \"\n            \"other data types like models, distance matrices and networks.\",\n            \"other-data-types\"\n        )\n    ]\n\n    def __init__(self):\n        super().__init__()\n        RecentPathsWComboMixin.__init__(self)\n        self.domain = None\n        self.data = None\n        self.loaded_file = \"\"\n        self.reader = None\n\n        layout = QGridLayout()\n        layout.setSpacing(4)\n        gui.widgetBox(self.controlArea, orientation=layout, box='Source')\n        vbox = gui.radioButtons(None, self, \"source\", box=True,\n                                callback=self.load_data, addToLayout=False)\n\n        rb_button = gui.appendRadioButton(vbox, \"File:\", addToLayout=False)\n        layout.addWidget(rb_button, 0, 0, Qt.AlignVCenter)\n\n        box = gui.hBox(None, addToLayout=False, margin=0)\n        box.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)\n        self.file_combo.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)\n        self.file_combo.activated[int].connect(self.select_file)\n        box.layout().addWidget(self.file_combo)\n        layout.addWidget(box, 0, 1)\n\n        file_button = gui.button(\n            None, self, '...', callback=self.browse_file, autoDefault=False)\n        file_button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))\n        file_button.setSizePolicy(Policy.Maximum, Policy.Fixed)\n        layout.addWidget(file_button, 0, 2)\n\n        reload_button = gui.button(\n            None, self, \"Reload\", callback=self.load_data, autoDefault=False)\n        reload_button.setIcon(self.style().standardIcon(\n            QStyle.SP_BrowserReload))\n        reload_button.setSizePolicy(Policy.Fixed, Policy.Fixed)\n        layout.addWidget(reload_button, 0, 3)\n\n        self.sheet_box = gui.hBox(None, addToLayout=False, margin=0)\n        self.sheet_combo = QComboBox()\n        self.sheet_combo.activated[str].connect(self.select_sheet)\n        self.sheet_combo.setSizePolicy(\n            Policy.MinimumExpanding, Policy.Fixed)\n        self.sheet_label = QLabel()\n        self.sheet_label.setText('Sheet')\n        self.sheet_label.setSizePolicy(\n            Policy.MinimumExpanding, Policy.Fixed)\n        self.sheet_box.layout().addWidget(\n            self.sheet_label, Qt.AlignLeft)\n        self.sheet_box.layout().addWidget(\n            self.sheet_combo, Qt.AlignVCenter)\n        layout.addWidget(self.sheet_box, 2, 1)\n        self.sheet_box.hide()\n\n        rb_button = gui.appendRadioButton(vbox, \"URL:\", addToLayout=False)\n        layout.addWidget(rb_button, 3, 0, Qt.AlignVCenter)\n\n        self.url_combo = url_combo = QComboBox()\n        url_model = NamedURLModel(self.sheet_names)\n        url_model.wrap(self.recent_urls)\n        url_combo.setLineEdit(LineEditSelectOnFocus())\n        url_combo.setModel(url_model)\n        url_combo.setSizePolicy(Policy.Ignored, Policy.Fixed)\n        url_combo.setEditable(True)\n        url_combo.setInsertPolicy(url_combo.InsertAtTop)\n        url_edit = url_combo.lineEdit()\n        l, t, r, b = url_edit.getTextMargins()\n        url_edit.setTextMargins(l + 5, t, r, b)\n        layout.addWidget(url_combo, 3, 1, 1, 3)\n        url_combo.activated.connect(self._url_set)\n        # whit completer we set that combo box is case sensitive when\n        # matching the history\n        completer = QCompleter()\n        completer.setCaseSensitivity(Qt.CaseSensitive)\n        url_combo.setCompleter(completer)\n\n        box = gui.vBox(self.controlArea, \"Info\")\n        self.infolabel = gui.widgetLabel(box, 'No data loaded.')\n        self.warnings = gui.widgetLabel(box, '')\n\n        box = gui.widgetBox(self.controlArea, \"Columns (Double click to edit)\")\n        self.domain_editor = DomainEditor(self)\n        self.editor_model = self.domain_editor.model()\n        box.layout().addWidget(self.domain_editor)\n\n        box = gui.hBox(box)\n        gui.button(\n            box, self, \"Reset\", callback=self.reset_domain_edit,\n            autoDefault=False\n        )\n        gui.rubber(box)\n        self.apply_button = gui.button(\n            box, self, \"Apply\", callback=self.apply_domain_edit)\n        self.apply_button.setEnabled(False)\n        self.apply_button.setFixedWidth(170)\n        self.editor_model.dataChanged.connect(\n            lambda: self.apply_button.setEnabled(True))\n\n        hBox = gui.hBox(self.controlArea)\n        gui.rubber(hBox)\n        gui.button(\n            hBox, self, \"Browse documentation datasets\",\n            callback=lambda: self.browse_file(True), autoDefault=False)\n        gui.rubber(hBox)\n\n        self.info.set_output_summary(self.info.NoOutput)\n\n        self.set_file_list()\n        # Must not call open_file from within __init__. open_file\n        # explicitly re-enters the event loop (by a progress bar)\n\n        self.setAcceptDrops(True)\n\n        if self.source == self.LOCAL_FILE:\n            last_path = self.last_path()\n            if last_path and os.path.exists(last_path) and \\\n                    os.path.getsize(last_path) > self.SIZE_LIMIT:\n                self.Warning.file_too_big()\n                return\n\n        QTimer.singleShot(0, self.load_data)\n\n    @staticmethod\n    def sizeHint():\n        return QSize(600, 550)\n\n    def select_file(self, n):\n        assert n < len(self.recent_paths)\n        super().select_file(n)\n        if self.recent_paths:\n            self.source = self.LOCAL_FILE\n            self.load_data()\n            self.set_file_list()\n\n    def select_sheet(self):\n        self.recent_paths[0].sheet = self.sheet_combo.currentText()\n        self.load_data()\n\n    def _url_set(self):\n        url = self.url_combo.currentText()\n        pos = self.recent_urls.index(url)\n        url = url.strip()\n\n        if not urlparse(url).scheme:\n            url = 'http://' + url\n            self.url_combo.setItemText(pos, url)\n            self.recent_urls[pos] = url\n\n        self.source = self.URL\n        self.load_data()\n\n    def browse_file(self, in_demos=False):\n        if in_demos:\n            start_file = get_sample_datasets_dir()\n            if not os.path.exists(start_file):\n                QMessageBox.information(\n                    None, \"File\",\n                    \"Cannot find the directory with documentation datasets\")\n                return\n        else:\n            start_file = self.last_path() or os.path.expanduser(\"~/\")\n\n        readers = [f for f in FileFormat.formats\n                   if getattr(f, 'read', None)\n                   and getattr(f, \"EXTENSIONS\", None)]\n        filename, reader, _ = open_filename_dialog(start_file, None, readers)\n        if not filename:\n            return\n        self.add_path(filename)\n        if reader is not None:\n            self.recent_paths[0].file_format = reader.qualified_name()\n\n        self.source = self.LOCAL_FILE\n        self.load_data()\n\n    # Open a file, create data from it and send it over the data channel\n    def load_data(self):\n        # We need to catch any exception type since anything can happen in\n        # file readers\n        self.closeContext()\n        self.domain_editor.set_domain(None)\n        self.apply_button.setEnabled(False)\n        self.clear_messages()\n        self.set_file_list()\n\n        error = self._try_load()\n        if error:\n            error()\n            self.data = None\n            self.sheet_box.hide()\n            self.Outputs.data.send(None)\n            self.infolabel.setText(\"No data.\")\n            self.info.set_output_summary(self.info.NoOutput)\n\n    def _try_load(self):\n        # pylint: disable=broad-except\n        if self.last_path() and not os.path.exists(self.last_path()):\n            return self.Error.file_not_found\n\n        try:\n            self.reader = self._get_reader()\n            assert self.reader is not None\n        except Exception:\n            return self.Error.missing_reader\n\n        if self.reader is self.NoFileSelected:\n            self.Outputs.data.send(None)\n            self.info.set_output_summary(self.info.NoOutput)\n            return None\n\n        try:\n            self._update_sheet_combo()\n        except Exception:\n            return self.Error.sheet_error\n\n        with catch_warnings(record=True) as warnings:\n            try:\n                data = self.reader.read()\n            except Exception as ex:\n                log.exception(ex)\n                return lambda x=ex: self.Error.unknown(str(x))\n            if warnings:\n                self.Warning.load_warning(warnings[-1].message.args[0])\n\n        self.infolabel.setText(self._describe(data))\n\n        self.loaded_file = self.last_path()\n        add_origin(data, self.loaded_file)\n        self.data = data\n        self.openContext(data.domain)\n        self.apply_domain_edit()  # sends data\n        return None\n\n    def _get_reader(self) -> FileFormat:\n        if self.source == self.LOCAL_FILE:\n            path = self.last_path()\n            if path is None:\n                return self.NoFileSelected\n            if self.recent_paths and self.recent_paths[0].file_format:\n                qname = self.recent_paths[0].file_format\n                reader_class = class_from_qualified_name(qname)\n                reader = reader_class(path)\n            else:\n                reader = FileFormat.get_reader(path)\n            if self.recent_paths and self.recent_paths[0].sheet:\n                reader.select_sheet(self.recent_paths[0].sheet)\n            return reader\n        else:\n            url = self.url_combo.currentText().strip()\n            if url:\n                return UrlReader(url)\n            else:\n                return self.NoFileSelected\n\n    def _update_sheet_combo(self):\n        if len(self.reader.sheets) < 2:\n            self.sheet_box.hide()\n            self.reader.select_sheet(None)\n            return\n\n        self.sheet_combo.clear()\n        self.sheet_combo.addItems(self.reader.sheets)\n        self._select_active_sheet()\n        self.sheet_box.show()\n\n    def _select_active_sheet(self):\n        try:\n            idx = self.reader.sheets.index(self.reader.sheet)\n            self.sheet_combo.setCurrentIndex(idx)\n        except ValueError:\n            # Requested sheet does not exist in this file\n            self.reader.select_sheet(None)\n            self.sheet_combo.setCurrentIndex(0)\n\n    @staticmethod\n    def _describe(table):\n        def missing_prop(prop):\n            if prop:\n                return f\"({prop * 100:.1f}% missing values)\"\n            else:\n                return \"(no missing values)\"\n\n        domain = table.domain\n        text = \"\"\n\n        attrs = getattr(table, \"attributes\", {})\n        descs = [attrs[desc]\n                 for desc in (\"Name\", \"Description\") if desc in attrs]\n        if len(descs) == 2:\n            descs[0] = f\"<b>{descs[0]}</b>\"\n        if descs:\n            text += f\"<p>{'<br/>'.join(descs)}</p>\"\n\n        text += f\"<p>{len(table)} instance(s)\"\n\n        missing_in_attr = missing_prop(table.has_missing_attribute()\n                                       and table.get_nan_frequency_attribute())\n        missing_in_class = missing_prop(table.has_missing_class()\n                                        and table.get_nan_frequency_class())\n        text += f\"<br/>{len(domain.attributes)} feature(s) {missing_in_attr}\"\n        if domain.has_continuous_class:\n            text += f\"<br/>Regression; numerical class {missing_in_class}\"\n        elif domain.has_discrete_class:\n            text += \"<br/>Classification; categorical class \" \\\n                f\"with {len(domain.class_var.values)} values {missing_in_class}\"\n        elif table.domain.class_vars:\n            text += \"<br/>Multi-target; \" \\\n                f\"{len(table.domain.class_vars)} target variables \" \\\n                f\"{missing_in_class}\"\n        else:\n            text += \"<br/>Data has no target variable.\"\n        text += f\"<br/>{len(domain.metas)} meta attribute(s)\"\n        text += \"</p>\"\n\n        if 'Timestamp' in table.domain:\n            # Google Forms uses this header to timestamp responses\n            text += f\"<p>First entry: {table[0, 'Timestamp']}<br/>\" \\\n                f\"Last entry: {table[-1, 'Timestamp']}</p>\"\n        return text\n\n    def storeSpecificSettings(self):\n        self.current_context.modified_variables = self.variables[:]\n\n    def retrieveSpecificSettings(self):\n        if hasattr(self.current_context, \"modified_variables\"):\n            self.variables[:] = self.current_context.modified_variables\n\n    def reset_domain_edit(self):\n        self.domain_editor.reset_domain()\n        self.apply_domain_edit()\n\n    def _inspect_discrete_variables(self, domain):\n        for var in chain(domain.variables, domain.metas):\n            if var.is_discrete and len(var.values) > 100:\n                self.Warning.performance_warning()\n\n    def apply_domain_edit(self):\n        self.Warning.performance_warning.clear()\n        self.Warning.renamed_vars.clear()\n        if self.data is None:\n            table = None\n        else:\n            domain, cols, renamed = \\\n                self.domain_editor.get_domain(self.data.domain, self.data,\n                                              deduplicate=True)\n            if not (domain.variables or domain.metas):\n                table = None\n            elif domain is self.data.domain:\n                table = self.data\n            else:\n                X, y, m = cols\n                table = Table.from_numpy(domain, X, y, m, self.data.W)\n                table.name = self.data.name\n                table.ids = np.array(self.data.ids)\n                table.attributes = getattr(self.data, 'attributes', {})\n                self._inspect_discrete_variables(domain)\n            if renamed:\n                self.Warning.renamed_vars(f\"Renamed: {', '.join(renamed)}\")\n\n        self.Warning.multiple_targets(\n            shown=table is not None and len(table.domain.class_vars) > 1)\n        summary = len(table) if table else self.info.NoOutput\n        details = format_summary_details(table) if table else \"\"\n        self.info.set_output_summary(summary, details)\n        self.Outputs.data.send(table)\n        self.apply_button.setEnabled(False)\n\n    def get_widget_name_extension(self):\n        _, name = os.path.split(self.loaded_file)\n        return os.path.splitext(name)[0]\n\n    def send_report(self):\n        def get_ext_name(filename):\n            try:\n                return FileFormat.names[os.path.splitext(filename)[1]]\n            except KeyError:\n                return \"unknown\"\n\n        if self.data is None:\n            self.report_paragraph(\"File\", \"No file.\")\n            return\n\n        if self.source == self.LOCAL_FILE:\n            home = os.path.expanduser(\"~\")\n            if self.loaded_file.startswith(home):\n                # os.path.join does not like ~\n                name = \"~\" + os.path.sep + \\\n                       self.loaded_file[len(home):].lstrip(\"/\").lstrip(\"\\\\\")\n            else:\n                name = self.loaded_file\n            if self.sheet_combo.isVisible():\n                name += f\" ({self.sheet_combo.currentText()})\"\n            self.report_items(\"File\", [(\"File name\", name),\n                                       (\"Format\", get_ext_name(name))])\n        else:\n            self.report_items(\"Data\", [(\"Resource\", self.url),\n                                       (\"Format\", get_ext_name(self.url))])\n\n        self.report_data(\"Data\", self.data)\n\n    @staticmethod\n    def dragEnterEvent(event):\n        \"\"\"Accept drops of valid file urls\"\"\"\n        urls = event.mimeData().urls()\n        if urls:\n            try:\n                FileFormat.get_reader(urls[0].toLocalFile())\n                event.acceptProposedAction()\n            except IOError:\n                pass\n\n    def dropEvent(self, event):\n        \"\"\"Handle file drops\"\"\"\n        urls = event.mimeData().urls()\n        if urls:\n            self.add_path(urls[0].toLocalFile())  # add first file\n            self.source = self.LOCAL_FILE\n            self.load_data()\n\n    def workflowEnvChanged(self, key, value, oldvalue):\n        \"\"\"\n        Function called when environment changes (e.g. while saving the scheme)\n        It make sure that all environment connected values are modified\n        (e.g. relative file paths are changed)\n        \"\"\"\n        self.update_file_list(key, value, oldvalue)",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 76,
                                "end_lineno": 579,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/data/owfile.py",
                            "type": "class",
                            "name": "OWFile",
                            "content": "class OWFile(widget.OWWidget, RecentPathsWComboMixin):\n    name = \"File\"\n    id = \"orange.widgets.data.file\"\n    description = \"Read data from an input file or network \" \\\n                  \"and send a data table to the output.\"\n    icon = \"icons/File.svg\"\n    priority = 10\n    category = \"Data\"\n    keywords = [\"file\", \"load\", \"read\", \"open\"]\n\n    class Outputs:\n        data = Output(\"Data\", Table,\n                      doc=\"Attribute-valued dataset read from the input file.\")\n\n    want_main_area = False\n    buttons_area_orientation = None\n\n    SEARCH_PATHS = [(\"sample-datasets\", get_sample_datasets_dir())]\n    SIZE_LIMIT = 1e7\n    LOCAL_FILE, URL = range(2)\n\n    settingsHandler = PerfectDomainContextHandler(\n        match_values=PerfectDomainContextHandler.MATCH_VALUES_ALL\n    )\n\n    # pylint seems to want declarations separated from definitions\n    recent_paths: List[RecentPath]\n    recent_urls: List[str]\n    variables: list\n\n    # Overload RecentPathsWidgetMixin.recent_paths to set defaults\n    recent_paths = Setting([\n        RecentPath(\"\", \"sample-datasets\", \"iris.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"titanic.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"housing.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"heart_disease.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"brown-selected.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"zoo.tab\"),\n    ])\n    recent_urls = Setting([])\n    source = Setting(LOCAL_FILE)\n    sheet_names = Setting({})\n    url = Setting(\"\")\n\n    variables = ContextSetting([])\n\n    domain_editor = SettingProvider(DomainEditor)\n\n    class Warning(widget.OWWidget.Warning):\n        file_too_big = Msg(\"The file is too large to load automatically.\"\n                           \" Press Reload to load.\")\n        load_warning = Msg(\"Read warning:\\n{}\")\n        performance_warning = Msg(\n            \"Categorical variables with >100 values may decrease performance.\")\n        renamed_vars = Msg(\"Some variables have been renamed \"\n                           \"to avoid duplicates.\\n{}\")\n        multiple_targets = Msg(\"Most widgets do not support multiple targets\")\n\n    class Error(widget.OWWidget.Error):\n        file_not_found = Msg(\"File not found.\")\n        missing_reader = Msg(\"Missing reader.\")\n        sheet_error = Msg(\"Error listing available sheets.\")\n        unknown = Msg(\"Read error:\\n{}\")\n\n    class NoFileSelected:\n        pass\n\n    UserAdviceMessages = [\n        widget.Message(\n            \"Use CSV File Import widget for advanced options \"\n            \"for comma-separated files\",\n            \"use-csv-file-import\"),\n        widget.Message(\n            \"This widget loads only tabular data. Use other widgets to load \"\n            \"other data types like models, distance matrices and networks.\",\n            \"other-data-types\"\n        )\n    ]\n\n    def __init__(self):\n        super().__init__()\n        RecentPathsWComboMixin.__init__(self)\n        self.domain = None\n        self.data = None\n        self.loaded_file = \"\"\n        self.reader = None\n\n        layout = QGridLayout()\n        layout.setSpacing(4)\n        gui.widgetBox(self.controlArea, orientation=layout, box='Source')\n        vbox = gui.radioButtons(None, self, \"source\", box=True,\n                                callback=self.load_data, addToLayout=False)\n\n        rb_button = gui.appendRadioButton(vbox, \"File:\", addToLayout=False)\n        layout.addWidget(rb_button, 0, 0, Qt.AlignVCenter)\n\n        box = gui.hBox(None, addToLayout=False, margin=0)\n        box.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)\n        self.file_combo.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)\n        self.file_combo.activated[int].connect(self.select_file)\n        box.layout().addWidget(self.file_combo)\n        layout.addWidget(box, 0, 1)\n\n        file_button = gui.button(\n            None, self, '...', callback=self.browse_file, autoDefault=False)\n        file_button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))\n        file_button.setSizePolicy(Policy.Maximum, Policy.Fixed)\n        layout.addWidget(file_button, 0, 2)\n\n        reload_button = gui.button(\n            None, self, \"Reload\", callback=self.load_data, autoDefault=False)\n        reload_button.setIcon(self.style().standardIcon(\n            QStyle.SP_BrowserReload))\n        reload_button.setSizePolicy(Policy.Fixed, Policy.Fixed)\n        layout.addWidget(reload_button, 0, 3)\n\n        self.sheet_box = gui.hBox(None, addToLayout=False, margin=0)\n        self.sheet_combo = QComboBox()\n        self.sheet_combo.activated[str].connect(self.select_sheet)\n        self.sheet_combo.setSizePolicy(\n            Policy.MinimumExpanding, Policy.Fixed)\n        self.sheet_label = QLabel()\n        self.sheet_label.setText('Sheet')\n        self.sheet_label.setSizePolicy(\n            Policy.MinimumExpanding, Policy.Fixed)\n        self.sheet_box.layout().addWidget(\n            self.sheet_label, Qt.AlignLeft)\n        self.sheet_box.layout().addWidget(\n            self.sheet_combo, Qt.AlignVCenter)\n        layout.addWidget(self.sheet_box, 2, 1)\n        self.sheet_box.hide()\n\n        rb_button = gui.appendRadioButton(vbox, \"URL:\", addToLayout=False)\n        layout.addWidget(rb_button, 3, 0, Qt.AlignVCenter)\n\n        self.url_combo = url_combo = QComboBox()\n        url_model = NamedURLModel(self.sheet_names)\n        url_model.wrap(self.recent_urls)\n        url_combo.setLineEdit(LineEditSelectOnFocus())\n        url_combo.setModel(url_model)\n        url_combo.setSizePolicy(Policy.Ignored, Policy.Fixed)\n        url_combo.setEditable(True)\n        url_combo.setInsertPolicy(url_combo.InsertAtTop)\n        url_edit = url_combo.lineEdit()\n        l, t, r, b = url_edit.getTextMargins()\n        url_edit.setTextMargins(l + 5, t, r, b)\n        layout.addWidget(url_combo, 3, 1, 1, 3)\n        url_combo.activated.connect(self._url_set)\n        # whit completer we set that combo box is case sensitive when\n        # matching the history\n        completer = QCompleter()\n        completer.setCaseSensitivity(Qt.CaseSensitive)\n        url_combo.setCompleter(completer)\n\n        box = gui.vBox(self.controlArea, \"Info\")\n        self.infolabel = gui.widgetLabel(box, 'No data loaded.')\n        self.warnings = gui.widgetLabel(box, '')\n\n        box = gui.widgetBox(self.controlArea, \"Columns (Double click to edit)\")\n        self.domain_editor = DomainEditor(self)\n        self.editor_model = self.domain_editor.model()\n        box.layout().addWidget(self.domain_editor)\n\n        box = gui.hBox(box)\n        gui.button(\n            box, self, \"Reset\", callback=self.reset_domain_edit,\n            autoDefault=False\n        )\n        gui.rubber(box)\n        self.apply_button = gui.button(\n            box, self, \"Apply\", callback=self.apply_domain_edit)\n        self.apply_button.setEnabled(False)\n        self.apply_button.setFixedWidth(170)\n        self.editor_model.dataChanged.connect(\n            lambda: self.apply_button.setEnabled(True))\n\n        hBox = gui.hBox(self.controlArea)\n        gui.rubber(hBox)\n        gui.button(\n            hBox, self, \"Browse documentation datasets\",\n            callback=lambda: self.browse_file(True), autoDefault=False)\n        gui.rubber(hBox)\n\n        self.info.set_output_summary(self.info.NoOutput)\n\n        self.set_file_list()\n        # Must not call open_file from within __init__. open_file\n        # explicitly re-enters the event loop (by a progress bar)\n\n        self.setAcceptDrops(True)\n\n        if self.source == self.LOCAL_FILE:\n            last_path = self.last_path()\n            if last_path and os.path.exists(last_path) and \\\n                    os.path.getsize(last_path) > self.SIZE_LIMIT:\n                self.Warning.file_too_big()\n                return\n\n        QTimer.singleShot(0, self.load_data)\n\n    @staticmethod\n    def sizeHint():\n        return QSize(600, 550)\n\n    def select_file(self, n):\n        assert n < len(self.recent_paths)\n        super().select_file(n)\n        if self.recent_paths:\n            self.source = self.LOCAL_FILE\n            self.load_data()\n            self.set_file_list()\n\n    def select_sheet(self):\n        self.recent_paths[0].sheet = self.sheet_combo.currentText()\n        self.load_data()\n\n    def _url_set(self):\n        url = self.url_combo.currentText()\n        pos = self.recent_urls.index(url)\n        url = url.strip()\n\n        if not urlparse(url).scheme:\n            url = 'http://' + url\n            self.url_combo.setItemText(pos, url)\n            self.recent_urls[pos] = url\n\n        self.source = self.URL\n        self.load_data()\n\n    def browse_file(self, in_demos=False):\n        if in_demos:\n            start_file = get_sample_datasets_dir()\n            if not os.path.exists(start_file):\n                QMessageBox.information(\n                    None, \"File\",\n                    \"Cannot find the directory with documentation datasets\")\n                return\n        else:\n            start_file = self.last_path() or os.path.expanduser(\"~/\")\n\n        readers = [f for f in FileFormat.formats\n                   if getattr(f, 'read', None)\n                   and getattr(f, \"EXTENSIONS\", None)]\n        filename, reader, _ = open_filename_dialog(start_file, None, readers)\n        if not filename:\n            return\n        self.add_path(filename)\n        if reader is not None:\n            self.recent_paths[0].file_format = reader.qualified_name()\n\n        self.source = self.LOCAL_FILE\n        self.load_data()\n\n    # Open a file, create data from it and send it over the data channel\n    def load_data(self):\n        # We need to catch any exception type since anything can happen in\n        # file readers\n        self.closeContext()\n        self.domain_editor.set_domain(None)\n        self.apply_button.setEnabled(False)\n        self.clear_messages()\n        self.set_file_list()\n\n        error = self._try_load()\n        if error:\n            error()\n            self.data = None\n            self.sheet_box.hide()\n            self.Outputs.data.send(None)\n            self.infolabel.setText(\"No data.\")\n            self.info.set_output_summary(self.info.NoOutput)\n\n    def _try_load(self):\n        # pylint: disable=broad-except\n        if self.last_path() and not os.path.exists(self.last_path()):\n            return self.Error.file_not_found\n\n        try:\n            self.reader = self._get_reader()\n            assert self.reader is not None\n        except Exception:\n            return self.Error.missing_reader\n\n        if self.reader is self.NoFileSelected:\n            self.Outputs.data.send(None)\n            self.info.set_output_summary(self.info.NoOutput)\n            return None\n\n        try:\n            self._update_sheet_combo()\n        except Exception:\n            return self.Error.sheet_error\n\n        with catch_warnings(record=True) as warnings:\n            try:\n                data = self.reader.read()\n            except Exception as ex:\n                log.exception(ex)\n                return lambda x=ex: self.Error.unknown(str(x))\n            if warnings:\n                self.Warning.load_warning(warnings[-1].message.args[0])\n\n        self.infolabel.setText(self._describe(data))\n\n        self.loaded_file = self.last_path()\n        add_origin(data, self.loaded_file)\n        self.data = data\n        self.openContext(data.domain)\n        self.apply_domain_edit()  # sends data\n        return None\n\n    def _get_reader(self) -> FileFormat:\n        if self.source == self.LOCAL_FILE:\n            path = self.last_path()\n            if path is None:\n                return self.NoFileSelected\n            if self.recent_paths and self.recent_paths[0].file_format:\n                qname = self.recent_paths[0].file_format\n                reader_class = class_from_qualified_name(qname)\n                reader = reader_class(path)\n            else:\n                reader = FileFormat.get_reader(path)\n            if self.recent_paths and self.recent_paths[0].sheet:\n                reader.select_sheet(self.recent_paths[0].sheet)\n            return reader\n        else:\n            url = self.url_combo.currentText().strip()\n            if url:\n                return UrlReader(url)\n            else:\n                return self.NoFileSelected\n\n    def _update_sheet_combo(self):\n        if len(self.reader.sheets) < 2:\n            self.sheet_box.hide()\n            self.reader.select_sheet(None)\n            return\n\n        self.sheet_combo.clear()\n        self.sheet_combo.addItems(self.reader.sheets)\n        self._select_active_sheet()\n        self.sheet_box.show()\n\n    def _select_active_sheet(self):\n        try:\n            idx = self.reader.sheets.index(self.reader.sheet)\n            self.sheet_combo.setCurrentIndex(idx)\n        except ValueError:\n            # Requested sheet does not exist in this file\n            self.reader.select_sheet(None)\n            self.sheet_combo.setCurrentIndex(0)\n\n    @staticmethod\n    def _describe(table):\n        def missing_prop(prop):\n            if prop:\n                return f\"({prop * 100:.1f}% missing values)\"\n            else:\n                return \"(no missing values)\"\n\n        domain = table.domain\n        text = \"\"\n\n        attrs = getattr(table, \"attributes\", {})\n        descs = [attrs[desc]\n                 for desc in (\"Name\", \"Description\") if desc in attrs]\n        if len(descs) == 2:\n            descs[0] = f\"<b>{descs[0]}</b>\"\n        if descs:\n            text += f\"<p>{'<br/>'.join(descs)}</p>\"\n\n        text += f\"<p>{len(table)} instance(s)\"\n\n        missing_in_attr = missing_prop(table.has_missing_attribute()\n                                       and table.get_nan_frequency_attribute())\n        missing_in_class = missing_prop(table.has_missing_class()\n                                        and table.get_nan_frequency_class())\n        text += f\"<br/>{len(domain.attributes)} feature(s) {missing_in_attr}\"\n        if domain.has_continuous_class:\n            text += f\"<br/>Regression; numerical class {missing_in_class}\"\n        elif domain.has_discrete_class:\n            text += \"<br/>Classification; categorical class \" \\\n                f\"with {len(domain.class_var.values)} values {missing_in_class}\"\n        elif table.domain.class_vars:\n            text += \"<br/>Multi-target; \" \\\n                f\"{len(table.domain.class_vars)} target variables \" \\\n                f\"{missing_in_class}\"\n        else:\n            text += \"<br/>Data has no target variable.\"\n        text += f\"<br/>{len(domain.metas)} meta attribute(s)\"\n        text += \"</p>\"\n\n        if 'Timestamp' in table.domain:\n            # Google Forms uses this header to timestamp responses\n            text += f\"<p>First entry: {table[0, 'Timestamp']}<br/>\" \\\n                f\"Last entry: {table[-1, 'Timestamp']}</p>\"\n        return text\n\n    def storeSpecificSettings(self):\n        self.current_context.modified_variables = self.variables[:]\n\n    def retrieveSpecificSettings(self):\n        if hasattr(self.current_context, \"modified_variables\"):\n            self.variables[:] = self.current_context.modified_variables\n\n    def reset_domain_edit(self):\n        self.domain_editor.reset_domain()\n        self.apply_domain_edit()\n\n    def _inspect_discrete_variables(self, domain):\n        for var in chain(domain.variables, domain.metas):\n            if var.is_discrete and len(var.values) > 100:\n                self.Warning.performance_warning()\n\n    def apply_domain_edit(self):\n        self.Warning.performance_warning.clear()\n        self.Warning.renamed_vars.clear()\n        if self.data is None:\n            table = None\n        else:\n            domain, cols, renamed = \\\n                self.domain_editor.get_domain(self.data.domain, self.data,\n                                              deduplicate=True)\n            if not (domain.variables or domain.metas):\n                table = None\n            elif domain is self.data.domain:\n                table = self.data\n            else:\n                X, y, m = cols\n                table = Table.from_numpy(domain, X, y, m, self.data.W)\n                table.name = self.data.name\n                table.ids = np.array(self.data.ids)\n                table.attributes = getattr(self.data, 'attributes', {})\n                self._inspect_discrete_variables(domain)\n            if renamed:\n                self.Warning.renamed_vars(f\"Renamed: {', '.join(renamed)}\")\n\n        self.Warning.multiple_targets(\n            shown=table is not None and len(table.domain.class_vars) > 1)\n        summary = len(table) if table else self.info.NoOutput\n        details = format_summary_details(table) if table else \"\"\n        self.info.set_output_summary(summary, details)\n        self.Outputs.data.send(table)\n        self.apply_button.setEnabled(False)\n\n    def get_widget_name_extension(self):\n        _, name = os.path.split(self.loaded_file)\n        return os.path.splitext(name)[0]\n\n    def send_report(self):\n        def get_ext_name(filename):\n            try:\n                return FileFormat.names[os.path.splitext(filename)[1]]\n            except KeyError:\n                return \"unknown\"\n\n        if self.data is None:\n            self.report_paragraph(\"File\", \"No file.\")\n            return\n\n        if self.source == self.LOCAL_FILE:\n            home = os.path.expanduser(\"~\")\n            if self.loaded_file.startswith(home):\n                # os.path.join does not like ~\n                name = \"~\" + os.path.sep + \\\n                       self.loaded_file[len(home):].lstrip(\"/\").lstrip(\"\\\\\")\n            else:\n                name = self.loaded_file\n            if self.sheet_combo.isVisible():\n                name += f\" ({self.sheet_combo.currentText()})\"\n            self.report_items(\"File\", [(\"File name\", name),\n                                       (\"Format\", get_ext_name(name))])\n        else:\n            self.report_items(\"Data\", [(\"Resource\", self.url),\n                                       (\"Format\", get_ext_name(self.url))])\n\n        self.report_data(\"Data\", self.data)\n\n    @staticmethod\n    def dragEnterEvent(event):\n        \"\"\"Accept drops of valid file urls\"\"\"\n        urls = event.mimeData().urls()\n        if urls:\n            try:\n                FileFormat.get_reader(urls[0].toLocalFile())\n                event.acceptProposedAction()\n            except IOError:\n                pass\n\n    def dropEvent(self, event):\n        \"\"\"Handle file drops\"\"\"\n        urls = event.mimeData().urls()\n        if urls:\n            self.add_path(urls[0].toLocalFile())  # add first file\n            self.source = self.LOCAL_FILE\n            self.load_data()\n\n    def workflowEnvChanged(self, key, value, oldvalue):\n        \"\"\"\n        Function called when environment changes (e.g. while saving the scheme)\n        It make sure that all environment connected values are modified\n        (e.g. relative file paths are changed)\n        \"\"\"\n        self.update_file_list(key, value, oldvalue)",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 76,
                            "end_lineno": 579,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\nfrom os import path, remove, getcwd\nfrom os.path import dirname\nfrom unittest.mock import Mock, patch\nimport pickle\nimport tempfile\nimport warnings\nimport time\n\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom AnyQt.QtCore import QMimeData, QPoint, Qt, QUrl, QThread, QObject\nfrom AnyQt.QtGui import QDragEnterEvent, QDropEvent\nfrom AnyQt.QtWidgets import QComboBox\n\nimport Orange\n\nfrom Orange.data import FileFormat, dataset_dirs, StringVariable, Table, \\\n    Domain, DiscreteVariable, ContinuousVariable\nfrom Orange.util import OrangeDeprecationWarning\n\nfrom Orange.data.io import TabReader\nfrom Orange.tests import named_file\nfrom Orange.widgets.data.owfile import OWFile\nfrom Orange.widgets.utils.filedialogs import dialog_formats, format_filter, RecentPath\nfrom Orange.widgets.utils.state_summary import format_summary_details\nfrom Orange.widgets.tests.base import WidgetTest\nfrom Orange.widgets.utils.domaineditor import ComboDelegate, VarTypeDelegate, VarTableModel\n\nTITANIC_PATH = path.join(path.dirname(Orange.__file__), 'datasets', 'titanic.tab')\norig_path_exists = path.exists\n\n\nclass FailedSheetsFormat(FileFormat):\n    EXTENSIONS = ('.failed_sheet',)\n    DESCRIPTION = \"Make a sheet function that fails\"\n\n    def read(self):\n        pass\n\n    def sheets(self):\n        raise Exception(\"Not working\")\n\n\nclass WithWarnings(FileFormat):\n    EXTENSIONS = ('.with_warning',)\n    DESCRIPTION = \"Warning\"\n\n    @staticmethod\n    def read():\n        warnings.warn(\"Some warning\")\n        return Orange.data.Table(\"iris\")\n\n\nclass MyCustomTabReader(FileFormat):\n    EXTENSIONS = ('.tab',)\n    DESCRIPTION = \"Always return iris\"\n    PRIORITY = 999999\n\n    @staticmethod\n    def read():\n        return Orange.data.Table(\"iris\")\n\n\nclass TestOWFile(WidgetTest):\n    # Attribute used to store event data so it does not get garbage\n    # collected before event is processed.\n    event_data = None\n\n    def setUp(self):\n        self.widget = self.create_widget(OWFile)  # type: OWFile\n        dataset_dirs.append(dirname(__file__))\n\n    def tearDown(self):\n        dataset_dirs.pop()\n\n    def test_dragEnterEvent_accepts_urls(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dragEnterEvent(event)\n        self.assertTrue(event.isAccepted())\n\n    def test_dragEnterEvent_skips_osx_file_references(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('/.file/id=12345'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def test_dragEnterEvent_skips_usupported_files(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('file.unsupported'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def _drag_enter_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n        return QDragEnterEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier)\n\n    def test_dropEvent_selects_file(self):\n        self.widget.load_data = Mock()\n        self.widget.source = OWFile.URL\n\n        event = self._drop_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dropEvent(event)\n\n        self.assertEqual(self.widget.source, OWFile.LOCAL_FILE)\n        self.assertTrue(path.samefile(self.widget.last_path(), TITANIC_PATH))\n        self.widget.load_data.assert_called_with()\n\n    def _drop_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n\n        return QDropEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier, QDropEvent.Drop)\n\n    def test_check_file_size(self):\n        self.assertFalse(self.widget.Warning.file_too_big.is_shown())\n        self.widget.SIZE_LIMIT = 4000\n        self.widget.__init__()\n        self.assertTrue(self.widget.Warning.file_too_big.is_shown())\n\n    def test_domain_changes_are_stored(self):\n        assert isinstance(self.widget, OWFile)\n\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n        self.open_dataset(\"zoo\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(data.name, \"zoo\")\n\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n    def test_rename_duplicates(self):\n        self.open_dataset(\"iris\")\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n        self.widget.domain_editor.model().setData(idx, \"iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"iris (1)\", data.domain)\n        self.assertIn(\"iris (2)\", data.domain)\n        self.assertTrue(self.widget.Warning.renamed_vars.is_shown())\n\n        self.widget.domain_editor.model().setData(idx, \"different iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n\n    def test_variable_name_change(self):\n        \"\"\"\n        Test whether the name of the variable is changed correctly by\n        the domaineditor.\n        \"\"\"\n        self.open_dataset(\"iris\")\n\n        # just rename\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"a\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"a\", data.domain)\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.widget.domain_editor.model().setData(idx, \"d\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"d\", data.domain)\n\n        # rename and change to text\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"b\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"b\", data.domain)\n        self.assertIsInstance(data.domain[\"b\"], StringVariable)\n\n        # rename and change to discrete\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(\n            idx, \"categorical\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], DiscreteVariable)\n\n        # rename and change to continuous\n        self.open_dataset(\"zoo\")\n        idx = self.widget.domain_editor.model().createIndex(0, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(0, 1)\n        self.widget.domain_editor.model().setData(idx, \"numeric\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], ContinuousVariable)\n\n    def open_dataset(self, name):\n        filename = FileFormat.locate(name, dataset_dirs)\n        self.widget.add_path(filename)\n        self.widget.load_data()\n\n    def test_no_last_path(self):\n        self.widget =\\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n        # Doesn't crash and contains a single item, (none).\n        self.assertEqual(self.widget.file_combo.count(), 1)\n\n    def test_file_not_found(self):\n        # Create a dummy file\n        file_name = \"test_owfile_data.tab\"\n        domainA = Domain([DiscreteVariable(\"d1\", values=(\"a\", \"b\"))],\n                         DiscreteVariable(\"c1\", values=(\"aaa\", \"bbb\")))\n        dataA = Table(domainA, np.array([[0], [1], [0], [np.nan]]),\n                      np.array([0, 1, 0, 1]))\n        dataA.save(file_name)\n\n        # Open the file with the widget\n        self.open_dataset(file_name)\n        self.assertEqual(self.get_output(self.widget.Outputs.data).domain, dataA.domain)\n\n        # Delete the file and try to reload it\n        remove(file_name)\n        self.widget.load_data()\n        self.assertEqual(file_name, path.basename(self.widget.last_path()))\n        self.assertTrue(self.widget.Error.file_not_found.is_shown())\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n        self.assertEqual(self.widget.infolabel.text(), \"No data.\")\n\n        # Open a sample dataset\n        self.open_dataset(\"iris\")\n        self.assertFalse(self.widget.Error.file_not_found.is_shown())\n\n    def test_nothing_selected(self):\n        # pylint: disable=protected-access\n        widget = self.widget = \\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n\n        widget.Outputs.data.send = Mock()\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n        widget.Outputs.data.send.reset_mock()\n        widget.source = widget.URL\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n    def test_check_column_noname(self):\n        \"\"\"\n        Column name cannot be changed to an empty string or a string with whitespaces.\n        GH-2039\n        \"\"\"\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(1, 0)\n        temp = self.widget.domain_editor.model().data(idx, Qt.DisplayRole)\n        self.widget.domain_editor.model().setData(idx, \"   \", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n        self.widget.domain_editor.model().setData(idx, \"\", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n\n    def test_invalid_role_mode(self):\n        self.open_dataset(\"iris\")\n        model = self.widget.domain_editor.model()\n        idx = model.createIndex(1, 0)\n        self.assertFalse(model.setData(idx, Qt.StatusTipRole, \"\"))\n        self.assertIsNone(model.data(idx, Qt.StatusTipRole))\n\n    def test_context_match_includes_variable_values(self):\n        file1 = \"\"\"\\\nvar\na b\n\na\n\"\"\"\n        file2 = \"\"\"\\\nvar\na b c\n\na\n\"\"\"\n        editor = self.widget.domain_editor\n        idx = self.widget.domain_editor.model().createIndex(0, 3)\n\n        with named_file(file1, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b\")\n\n        with named_file(file2, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b, c\")\n\n    def test_check_datetime_disabled(self):\n        \"\"\"\n        Datetime option is disable if numerical is disabled as well.\n        GH-2050 (code fixes)\n        GH-2120\n        \"\"\"\n        dat = \"\"\"\\\n            01.08.16\\t42.15\\tneumann\\t2017-02-20\n            03.08.16\\t16.08\\tneumann\\t2017-02-21\n            04.08.16\\t23.04\\tneumann\\t2017-02-22\n            03.09.16\\t48.84\\tturing\\t2017-02-23\n            02.02.17\\t23.16\\tturing\\t2017-02-24\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            domain_editor = self.widget.domain_editor\n            idx = lambda x: self.widget.domain_editor.model().createIndex(x, 1)\n\n            qcombobox = QComboBox()\n            combo = ComboDelegate(domain_editor,\n                                  VarTableModel.typenames).createEditor(qcombobox, None, idx(2))\n            vartype_delegate = VarTypeDelegate(domain_editor, VarTableModel.typenames)\n\n            vartype_delegate.setEditorData(combo, idx(2))\n            counts = [4, 2, 4, 2]\n            for i in range(4):\n                vartype_delegate.setEditorData(combo, idx(i))\n                self.assertEqual(combo.count(), counts[i])\n\n    def test_reader_custom_tab(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            qname = MyCustomTabReader.qualified_name()\n            reader = RecentPath(fn, None, None, file_format=qname)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [reader]})\n            self.widget.load_data()\n        self.assertFalse(self.widget.Error.missing_reader.is_shown())\n        outdata = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(outdata), 150)  # loaded iris\n\n    def test_no_reader_extension(self):\n        with named_file(\"\", suffix=\".xyz_unknown\") as fn:\n            no_reader = RecentPath(fn, None, None)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_reader]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_fail_sheets(self):\n        with named_file(\"\", suffix=\".failed_sheet\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Error.sheet_error.is_shown())\n\n    def test_with_warnings(self):\n        with named_file(\"\", suffix=\".with_warning\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Warning.load_warning.is_shown())\n\n    def test_fail(self):\n        with named_file(\"name\\nc\\n\\nstring\", suffix=\".tab\") as fn, \\\n                patch(\"Orange.widgets.data.owfile.log.exception\") as log:\n            self.open_dataset(fn)\n            log.assert_called()\n        self.assertTrue(self.widget.Error.unknown.is_shown())\n\n    def test_read_format(self):\n        iris = Table(\"iris\")\n\n        def open_iris_with_no_spec_format(_a, _b, _c, filters, _e):\n            return iris.__file__, filters.split(\";;\")[0]\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_no_spec_format):\n            self.widget.browse_file()\n\n        self.assertIsNone(self.widget.recent_paths[0].file_format)\n\n        def open_iris_with_tab(*_):\n            return iris.__file__, format_filter(TabReader)\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_tab):\n            self.widget.browse_file()\n\n        self.assertEqual(self.widget.recent_paths[0].file_format, \"Orange.data.io.TabReader\")\n\n    def test_no_specified_reader(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            no_class = RecentPath(fn, None, None, file_format=\"not.a.file.reader.class\")\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_class]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_domain_edit_no_changes(self):\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        # When no changes have been made in the domain editor,\n        # output data should be the same object (and not recreated)\n        self.assertTrue(data is self.widget.data)\n\n    def test_domain_edit_on_sparse_data(self):\n        iris = Table(\"iris\").to_sparse()\n\n        f = tempfile.NamedTemporaryFile(suffix='.pickle', delete=False)\n        pickle.dump(iris, f)\n        f.close()\n\n        self.widget.add_path(f.name)\n        self.widget.load_data()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(output, Table)\n        self.assertEqual(iris.X.shape, output.X.shape)\n        self.assertTrue(sp.issparse(output.X))\n\n    def test_drop_data_when_everything_skipped(self):\n        \"\"\"\n        No data when everything is skipped. Otherwise Select Rows crashes.\n        GH-2237\n        \"\"\"\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertTrue(len(data), 150)\n        self.assertTrue(len(data.domain), 5)\n        for i in range(5):\n            idx = self.widget.domain_editor.model().createIndex(i, 2)\n            self.widget.domain_editor.model().setData(idx, \"skip\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsNone(data)\n\n    def test_call_deprecated_dialog_formats(self):\n        with self.assertWarns(OrangeDeprecationWarning):\n            self.assertIn(\"Tab\", dialog_formats())\n\n    def test_add_new_format(self):\n        # test adding file formats after registering the widget\n        called = False\n        with named_file(\"\", suffix=\".tab\") as filename:\n            def test_format(_sd, _sf, ff, **_):\n                nonlocal called\n                called = True\n                self.assertIn(FailedSheetsFormat, ff)\n                return filename, TabReader, \"\"\n            with patch(\"Orange.widgets.data.owfile.open_filename_dialog\", test_format):\n                self.widget.browse_file()\n        self.assertTrue(called)\n\n    def test_domain_editor_conversions(self):\n        dat = \"\"\"V0\\tV1\\tV2\\tV3\\tV4\\tV5\\tV6\n                 c\\tc\\td\\td\\tc\\td\\td\n                  \\t \\t \\t \\t \\t \\t\n                 3.0\\t1.0\\t4\\ta\\t0.0\\tx\\t1.0\n                 1.0\\t2.0\\t4\\tb\\t0.0\\ty\\t2.0\n                 2.0\\t1.0\\t7\\ta\\t0.0\\ty\\t2.0\n                 0.0\\t2.0\\t7\\ta\\t0.0\\tz\\t2.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            data1 = self.get_output(self.widget.Outputs.data)\n            model = self.widget.domain_editor.model()\n            # check the ordering of attributes\n            for i, a in enumerate(data1.domain.attributes):\n                self.assertEqual(str(a), model.data(model.createIndex(i, 0), Qt.DisplayRole))\n            # make conversions\n            model.setData(model.createIndex(0, 1), \"categorical\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(2, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(3, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(6, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n            data2 = self.get_output(self.widget.Outputs.data)\n            # round continuous values should be converted to integers (3.0 -> 3, \"3\")\n            self.assertEqual(len(data2.domain.attributes[0].values[0]), 1)\n            self.assertEqual(len(data2[0].metas[0]), 1)\n            # discrete integer values should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][2].value), data2[0][1])\n            # discrete round floats should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][6].value), data2[0][5])\n\n    def test_domaineditor_continuous_to_string(self):\n        # GH 2744\n        dat = \"\"\"V0\\nc\\n\\n1.0\\nnan\\n3.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertSequenceEqual(data.metas.ravel().tolist(), ['1', '', '3'])\n\n    def test_domaineditor_makes_variables(self):\n        # Variables created with domain editor should be interchangeable\n        # with variables read from file.\n\n        dat = \"\"\"V0\\tV1\\nc\\td\\n\\n1.0\\t2\"\"\"\n        v0 = StringVariable.make(\"V0\")\n        v1 = ContinuousVariable.make(\"V1\")\n\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertEqual(data.domain[\"V0\"], v0)\n            self.assertEqual(data.domain[\"V1\"], v1)\n\n    def test_url_no_scheme(self):\n        mock_urlreader = Mock(side_effect=ValueError())\n        url = 'foo.bar/xxx.csv'\n\n        with patch('Orange.widgets.data.owfile.UrlReader', mock_urlreader):\n            self.widget.url_combo.insertItem(0, url)\n            self.widget.url_combo.activated.emit(0)\n\n        mock_urlreader.assert_called_once_with('http://' + url)\n\n    def test_adds_origin(self):\n        self.open_dataset(\"origin1/images\")\n        data1 = self.get_output(self.widget.Outputs.data)\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n        self.open_dataset(\"origin2/images\")\n        data2 = self.get_output(self.widget.Outputs.data)\n        attrs = data2.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin2\", attrs[\"origin\"])\n\n        # Make sure that variable in data1 still contains correct origin\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n    def test_summary(self):\n        \"\"\"Check if the status bar is updated when data is received\"\"\"\n        output_sum = self.widget.info.set_output_summary = Mock()\n        self.open_dataset(\"iris\")\n        output = self.get_output(self.widget.Outputs.data)\n        output_sum.assert_called_with(len(output),\n                                      format_summary_details(output))\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_open_moved_workflow(self):\n        \"\"\"Test opening workflow that has been moved to another location\n        (i.e. sent by email), considering data file is stored in the same\n        directory as the workflow.\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n            self.assertEqual(w.file_combo.count(), 1)\n            self.assertFalse(w.Error.file_not_found.is_shown())\n        finally:\n            remove(file_name)\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_files_relocated(self):\n        \"\"\"\n        This test testes if paths are relocated correctly\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n\n            # relocation is called already\n            # if it works correctly relative path should be same than base name\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n\n            w.workflowEnvChanged(\"basedir\", base_name, base_name)\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n        finally:\n            remove(file_name)\n\n    def test_sheets(self):\n        # pylint: disable=protected-access\n        widget = self.widget\n        combo = widget.sheet_combo\n        widget.last_path = \\\n            lambda: path.join(path.dirname(__file__), '..', \"..\", '..',\n                              'tests', 'xlsx_files', 'header_0_sheet.xlsx')\n        widget._try_load()\n        widget.reader.sheet = \"my_sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.itemText(0), \"Sheet1\")\n        self.assertEqual(combo.itemText(1), \"my_sheet\")\n        self.assertEqual(combo.itemText(2), \"Sheet3\")\n        self.assertEqual(combo.currentIndex(), 1)\n\n        widget.reader.sheet = \"no such sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.currentIndex(), 0)\n\n    @patch(\"os.path.exists\", new=lambda _: True)\n    def test_warning_from_another_thread(self):\n        class AnotherWidget(QObject):\n            # This must be a method, not a staticmethod to run in the thread\n            def issue_warning(self):  # pylint: disable=no-self-use\n                time.sleep(0.1)\n                warnings.warn(\"warning from another thread\")\n                warning_thread.quit()\n\n        def read():\n            warning_thread.start()\n            time.sleep(0.2)\n            return Table(TITANIC_PATH)\n\n        warning_thread = QThread()\n        another_widget = AnotherWidget()\n        another_widget.moveToThread(warning_thread)\n        warning_thread.started.connect(another_widget.issue_warning)\n\n        reader = Mock()\n        reader.read = read\n        self.widget._get_reader = lambda: reader\n        self.widget.last_path = lambda: \"foo\"\n        self.widget._update_sheet_combo = Mock()\n        self.widget._try_load()\n        self.assertFalse(self.widget.Warning.load_warning.is_shown())\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "new_file_content": "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring,protected-access\nfrom os import path, remove, getcwd\nfrom os.path import dirname\nimport unittest\nfrom unittest.mock import Mock, patch\nimport pickle\nimport tempfile\nimport warnings\nimport time\n\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom AnyQt.QtCore import QMimeData, QPoint, Qt, QUrl, QThread, QObject\nfrom AnyQt.QtGui import QDragEnterEvent, QDropEvent\nfrom AnyQt.QtWidgets import QComboBox\n\nimport Orange\n\nfrom Orange.data import FileFormat, dataset_dirs, StringVariable, Table, \\\n    Domain, DiscreteVariable, ContinuousVariable\nfrom Orange.util import OrangeDeprecationWarning\n\nfrom Orange.data.io import TabReader\nfrom Orange.tests import named_file\nfrom Orange.widgets.data.owfile import OWFile\nfrom Orange.widgets.utils.filedialogs import dialog_formats, format_filter, RecentPath\nfrom Orange.widgets.utils.state_summary import format_summary_details\nfrom Orange.widgets.tests.base import WidgetTest\nfrom Orange.widgets.utils.domaineditor import ComboDelegate, VarTypeDelegate, VarTableModel\n\nTITANIC_PATH = path.join(path.dirname(Orange.__file__), 'datasets', 'titanic.tab')\norig_path_exists = path.exists\n\n\nclass FailedSheetsFormat(FileFormat):\n    EXTENSIONS = ('.failed_sheet',)\n    DESCRIPTION = \"Make a sheet function that fails\"\n\n    def read(self):\n        pass\n\n    def sheets(self):\n        raise Exception(\"Not working\")\n\n\nclass WithWarnings(FileFormat):\n    EXTENSIONS = ('.with_warning',)\n    DESCRIPTION = \"Warning\"\n\n    @staticmethod\n    def read():\n        warnings.warn(\"Some warning\")\n        return Orange.data.Table(\"iris\")\n\n\nclass MyCustomTabReader(FileFormat):\n    EXTENSIONS = ('.tab',)\n    DESCRIPTION = \"Always return iris\"\n    PRIORITY = 999999\n\n    @staticmethod\n    def read():\n        return Orange.data.Table(\"iris\")\n\n\nclass TestOWFile(WidgetTest):\n    # Attribute used to store event data so it does not get garbage\n    # collected before event is processed.\n    event_data = None\n\n    def setUp(self):\n        self.widget = self.create_widget(OWFile)  # type: OWFile\n        dataset_dirs.append(dirname(__file__))\n\n    def tearDown(self):\n        dataset_dirs.pop()\n\n    def test_dragEnterEvent_accepts_urls(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dragEnterEvent(event)\n        self.assertTrue(event.isAccepted())\n\n    def test_dragEnterEvent_skips_osx_file_references(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('/.file/id=12345'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def test_dragEnterEvent_skips_usupported_files(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('file.unsupported'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def _drag_enter_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n        return QDragEnterEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier)\n\n    def test_dropEvent_selects_file(self):\n        self.widget.load_data = Mock()\n        self.widget.source = OWFile.URL\n\n        event = self._drop_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dropEvent(event)\n\n        self.assertEqual(self.widget.source, OWFile.LOCAL_FILE)\n        self.assertTrue(path.samefile(self.widget.last_path(), TITANIC_PATH))\n        self.widget.load_data.assert_called_with()\n\n    def _drop_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n\n        return QDropEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier, QDropEvent.Drop)\n\n    def test_check_file_size(self):\n        self.assertFalse(self.widget.Warning.file_too_big.is_shown())\n        self.widget.SIZE_LIMIT = 4000\n        self.widget.__init__()\n        self.assertTrue(self.widget.Warning.file_too_big.is_shown())\n\n    def test_domain_changes_are_stored(self):\n        assert isinstance(self.widget, OWFile)\n\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n        self.open_dataset(\"zoo\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(data.name, \"zoo\")\n\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n    def test_rename_duplicates(self):\n        self.open_dataset(\"iris\")\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n        self.widget.domain_editor.model().setData(idx, \"iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"iris (1)\", data.domain)\n        self.assertIn(\"iris (2)\", data.domain)\n        self.assertTrue(self.widget.Warning.renamed_vars.is_shown())\n\n        self.widget.domain_editor.model().setData(idx, \"different iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n\n    def test_variable_name_change(self):\n        \"\"\"\n        Test whether the name of the variable is changed correctly by\n        the domaineditor.\n        \"\"\"\n        self.open_dataset(\"iris\")\n\n        # just rename\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"a\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"a\", data.domain)\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.widget.domain_editor.model().setData(idx, \"d\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"d\", data.domain)\n\n        # rename and change to text\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"b\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"b\", data.domain)\n        self.assertIsInstance(data.domain[\"b\"], StringVariable)\n\n        # rename and change to discrete\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(\n            idx, \"categorical\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], DiscreteVariable)\n\n        # rename and change to continuous\n        self.open_dataset(\"zoo\")\n        idx = self.widget.domain_editor.model().createIndex(0, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(0, 1)\n        self.widget.domain_editor.model().setData(idx, \"numeric\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], ContinuousVariable)\n\n    def open_dataset(self, name):\n        filename = FileFormat.locate(name, dataset_dirs)\n        self.widget.add_path(filename)\n        self.widget.load_data()\n\n    def test_no_last_path(self):\n        self.widget =\\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n        # Doesn't crash and contains a single item, (none).\n        self.assertEqual(self.widget.file_combo.count(), 1)\n\n    def test_file_not_found(self):\n        # Create a dummy file\n        file_name = \"test_owfile_data.tab\"\n        domainA = Domain([DiscreteVariable(\"d1\", values=(\"a\", \"b\"))],\n                         DiscreteVariable(\"c1\", values=(\"aaa\", \"bbb\")))\n        dataA = Table(domainA, np.array([[0], [1], [0], [np.nan]]),\n                      np.array([0, 1, 0, 1]))\n        dataA.save(file_name)\n\n        # Open the file with the widget\n        self.open_dataset(file_name)\n        self.assertEqual(self.get_output(self.widget.Outputs.data).domain, dataA.domain)\n\n        # Delete the file and try to reload it\n        remove(file_name)\n        self.widget.load_data()\n        self.assertEqual(file_name, path.basename(self.widget.last_path()))\n        self.assertTrue(self.widget.Error.file_not_found.is_shown())\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n        self.assertEqual(self.widget.infolabel.text(), \"No data.\")\n\n        # Open a sample dataset\n        self.open_dataset(\"iris\")\n        self.assertFalse(self.widget.Error.file_not_found.is_shown())\n\n    def test_nothing_selected(self):\n        # pylint: disable=protected-access\n        widget = self.widget = \\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n\n        widget.Outputs.data.send = Mock()\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n        widget.Outputs.data.send.reset_mock()\n        widget.source = widget.URL\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n    def test_check_column_noname(self):\n        \"\"\"\n        Column name cannot be changed to an empty string or a string with whitespaces.\n        GH-2039\n        \"\"\"\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(1, 0)\n        temp = self.widget.domain_editor.model().data(idx, Qt.DisplayRole)\n        self.widget.domain_editor.model().setData(idx, \"   \", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n        self.widget.domain_editor.model().setData(idx, \"\", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n\n    def test_invalid_role_mode(self):\n        self.open_dataset(\"iris\")\n        model = self.widget.domain_editor.model()\n        idx = model.createIndex(1, 0)\n        self.assertFalse(model.setData(idx, Qt.StatusTipRole, \"\"))\n        self.assertIsNone(model.data(idx, Qt.StatusTipRole))\n\n    def test_context_match_includes_variable_values(self):\n        file1 = \"\"\"\\\nvar\na b\n\na\n\"\"\"\n        file2 = \"\"\"\\\nvar\na b c\n\na\n\"\"\"\n        editor = self.widget.domain_editor\n        idx = self.widget.domain_editor.model().createIndex(0, 3)\n\n        with named_file(file1, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b\")\n\n        with named_file(file2, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b, c\")\n\n    def test_check_datetime_disabled(self):\n        \"\"\"\n        Datetime option is disable if numerical is disabled as well.\n        GH-2050 (code fixes)\n        GH-2120\n        \"\"\"\n        dat = \"\"\"\\\n            01.08.16\\t42.15\\tneumann\\t2017-02-20\n            03.08.16\\t16.08\\tneumann\\t2017-02-21\n            04.08.16\\t23.04\\tneumann\\t2017-02-22\n            03.09.16\\t48.84\\tturing\\t2017-02-23\n            02.02.17\\t23.16\\tturing\\t2017-02-24\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            domain_editor = self.widget.domain_editor\n            idx = lambda x: self.widget.domain_editor.model().createIndex(x, 1)\n\n            qcombobox = QComboBox()\n            combo = ComboDelegate(domain_editor,\n                                  VarTableModel.typenames).createEditor(qcombobox, None, idx(2))\n            vartype_delegate = VarTypeDelegate(domain_editor, VarTableModel.typenames)\n\n            vartype_delegate.setEditorData(combo, idx(2))\n            counts = [4, 2, 4, 2]\n            for i in range(4):\n                vartype_delegate.setEditorData(combo, idx(i))\n                self.assertEqual(combo.count(), counts[i])\n\n    def test_reader_custom_tab(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            qname = MyCustomTabReader.qualified_name()\n            reader = RecentPath(fn, None, None, file_format=qname)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [reader]})\n            self.widget.load_data()\n        self.assertFalse(self.widget.Error.missing_reader.is_shown())\n        outdata = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(outdata), 150)  # loaded iris\n\n    def test_no_reader_extension(self):\n        with named_file(\"\", suffix=\".xyz_unknown\") as fn:\n            no_reader = RecentPath(fn, None, None)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_reader]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_fail_sheets(self):\n        with named_file(\"\", suffix=\".failed_sheet\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Error.sheet_error.is_shown())\n\n    def test_with_warnings(self):\n        with named_file(\"\", suffix=\".with_warning\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Warning.load_warning.is_shown())\n\n    def test_fail(self):\n        with named_file(\"name\\nc\\n\\nstring\", suffix=\".tab\") as fn, \\\n                patch(\"Orange.widgets.data.owfile.log.exception\") as log:\n            self.open_dataset(fn)\n            log.assert_called()\n        self.assertTrue(self.widget.Error.unknown.is_shown())\n\n    def test_read_format(self):\n        iris = Table(\"iris\")\n\n        def open_iris_with_no_spec_format(_a, _b, _c, filters, _e):\n            return iris.__file__, filters.split(\";;\")[0]\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_no_spec_format):\n            self.widget.browse_file()\n\n        self.assertIsNone(self.widget.recent_paths[0].file_format)\n\n        def open_iris_with_tab(*_):\n            return iris.__file__, format_filter(TabReader)\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_tab):\n            self.widget.browse_file()\n\n        self.assertEqual(self.widget.recent_paths[0].file_format, \"Orange.data.io.TabReader\")\n\n    def test_no_specified_reader(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            no_class = RecentPath(fn, None, None, file_format=\"not.a.file.reader.class\")\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_class]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_domain_edit_no_changes(self):\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        # When no changes have been made in the domain editor,\n        # output data should be the same object (and not recreated)\n        self.assertTrue(data is self.widget.data)\n\n    def test_domain_edit_on_sparse_data(self):\n        iris = Table(\"iris\").to_sparse()\n\n        f = tempfile.NamedTemporaryFile(suffix='.pickle', delete=False)\n        pickle.dump(iris, f)\n        f.close()\n\n        self.widget.add_path(f.name)\n        self.widget.load_data()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(output, Table)\n        self.assertEqual(iris.X.shape, output.X.shape)\n        self.assertTrue(sp.issparse(output.X))\n\n    def test_drop_data_when_everything_skipped(self):\n        \"\"\"\n        No data when everything is skipped. Otherwise Select Rows crashes.\n        GH-2237\n        \"\"\"\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertTrue(len(data), 150)\n        self.assertTrue(len(data.domain), 5)\n        for i in range(5):\n            idx = self.widget.domain_editor.model().createIndex(i, 2)\n            self.widget.domain_editor.model().setData(idx, \"skip\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsNone(data)\n\n    def test_call_deprecated_dialog_formats(self):\n        with self.assertWarns(OrangeDeprecationWarning):\n            self.assertIn(\"Tab\", dialog_formats())\n\n    def test_add_new_format(self):\n        # test adding file formats after registering the widget\n        called = False\n        with named_file(\"\", suffix=\".tab\") as filename:\n            def test_format(_sd, _sf, ff, **_):\n                nonlocal called\n                called = True\n                self.assertIn(FailedSheetsFormat, ff)\n                return filename, TabReader, \"\"\n            with patch(\"Orange.widgets.data.owfile.open_filename_dialog\", test_format):\n                self.widget.browse_file()\n        self.assertTrue(called)\n\n    def test_domain_editor_conversions(self):\n        dat = \"\"\"V0\\tV1\\tV2\\tV3\\tV4\\tV5\\tV6\n                 c\\tc\\td\\td\\tc\\td\\td\n                  \\t \\t \\t \\t \\t \\t\n                 3.0\\t1.0\\t4\\ta\\t0.0\\tx\\t1.0\n                 1.0\\t2.0\\t4\\tb\\t0.0\\ty\\t2.0\n                 2.0\\t1.0\\t7\\ta\\t0.0\\ty\\t2.0\n                 0.0\\t2.0\\t7\\ta\\t0.0\\tz\\t2.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            data1 = self.get_output(self.widget.Outputs.data)\n            model = self.widget.domain_editor.model()\n            # check the ordering of attributes\n            for i, a in enumerate(data1.domain.attributes):\n                self.assertEqual(str(a), model.data(model.createIndex(i, 0), Qt.DisplayRole))\n            # make conversions\n            model.setData(model.createIndex(0, 1), \"categorical\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(2, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(3, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(6, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n            data2 = self.get_output(self.widget.Outputs.data)\n            # round continuous values should be converted to integers (3.0 -> 3, \"3\")\n            self.assertEqual(len(data2.domain.attributes[0].values[0]), 1)\n            self.assertEqual(len(data2[0].metas[0]), 1)\n            # discrete integer values should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][2].value), data2[0][1])\n            # discrete round floats should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][6].value), data2[0][5])\n\n    def test_domaineditor_continuous_to_string(self):\n        # GH 2744\n        dat = \"\"\"V0\\nc\\n\\n1.0\\nnan\\n3.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertSequenceEqual(data.metas.ravel().tolist(), ['1', '', '3'])\n\n    def test_domaineditor_makes_variables(self):\n        # Variables created with domain editor should be interchangeable\n        # with variables read from file.\n\n        dat = \"\"\"V0\\tV1\\nc\\td\\n\\n1.0\\t2\"\"\"\n        v0 = StringVariable.make(\"V0\")\n        v1 = ContinuousVariable.make(\"V1\")\n\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertEqual(data.domain[\"V0\"], v0)\n            self.assertEqual(data.domain[\"V1\"], v1)\n\n    def test_url_no_scheme(self):\n        mock_urlreader = Mock(side_effect=ValueError())\n        url = 'foo.bar/xxx.csv'\n\n        with patch('Orange.widgets.data.owfile.UrlReader', mock_urlreader):\n            self.widget.url_combo.insertItem(0, url)\n            self.widget.url_combo.activated.emit(0)\n\n        mock_urlreader.assert_called_once_with('http://' + url)\n\n    def test_adds_origin(self):\n        self.open_dataset(\"origin1/images\")\n        data1 = self.get_output(self.widget.Outputs.data)\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n        self.open_dataset(\"origin2/images\")\n        data2 = self.get_output(self.widget.Outputs.data)\n        attrs = data2.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin2\", attrs[\"origin\"])\n\n        # Make sure that variable in data1 still contains correct origin\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n    def test_summary(self):\n        \"\"\"Check if the status bar is updated when data is received\"\"\"\n        output_sum = self.widget.info.set_output_summary = Mock()\n        self.open_dataset(\"iris\")\n        output = self.get_output(self.widget.Outputs.data)\n        output_sum.assert_called_with(len(output),\n                                      format_summary_details(output))\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_open_moved_workflow(self):\n        \"\"\"Test opening workflow that has been moved to another location\n        (i.e. sent by email), considering data file is stored in the same\n        directory as the workflow.\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n            self.assertEqual(w.file_combo.count(), 1)\n            self.assertFalse(w.Error.file_not_found.is_shown())\n        finally:\n            remove(file_name)\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_files_relocated(self):\n        \"\"\"\n        This test testes if paths are relocated correctly\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n\n            # relocation is called already\n            # if it works correctly relative path should be same than base name\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n\n            w.workflowEnvChanged(\"basedir\", base_name, base_name)\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n        finally:\n            remove(file_name)\n\n    def test_sheets(self):\n        # pylint: disable=protected-access\n        widget = self.widget\n        combo = widget.sheet_combo\n        widget.last_path = \\\n            lambda: path.join(path.dirname(__file__), '..', \"..\", '..',\n                              'tests', 'xlsx_files', 'header_0_sheet.xlsx')\n        widget._try_load()\n        widget.reader.sheet = \"my_sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.itemText(0), \"Sheet1\")\n        self.assertEqual(combo.itemText(1), \"my_sheet\")\n        self.assertEqual(combo.itemText(2), \"Sheet3\")\n        self.assertEqual(combo.currentIndex(), 1)\n\n        widget.reader.sheet = \"no such sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.currentIndex(), 0)\n\n    @patch(\"os.path.exists\", new=lambda _: True)\n    def test_warning_from_another_thread(self):\n        class AnotherWidget(QObject):\n            # This must be a method, not a staticmethod to run in the thread\n            def issue_warning(self):  # pylint: disable=no-self-use\n                time.sleep(0.1)\n                warnings.warn(\"warning from another thread\")\n                warning_thread.quit()\n\n        def read():\n            warning_thread.start()\n            time.sleep(0.2)\n            return Table(TITANIC_PATH)\n\n        warning_thread = QThread()\n        another_widget = AnotherWidget()\n        another_widget.moveToThread(warning_thread)\n        warning_thread.started.connect(another_widget.issue_warning)\n\n        reader = Mock()\n        reader.read = read\n        self.widget._get_reader = lambda: reader\n        self.widget.last_path = lambda: \"foo\"\n        self.widget._update_sheet_combo = Mock()\n\n        # Warning must be caught by unit tests, but not the widget\n        with self.assertWarns(UserWarning):\n            self.widget._try_load()\n            self.assertFalse(self.widget.Warning.load_warning.is_shown())\n\n\n    @patch(\"os.path.exists\", new=lambda _: True)\n    def test_warning_from_this_thread(self):\n        WARNING_MSG = \"warning from this thread\"\n\n        def read():\n            warnings.warn(WARNING_MSG)\n            return Table(TITANIC_PATH)\n\n        reader = Mock()\n        reader.read = read\n        self.widget._get_reader = lambda: reader\n        self.widget.last_path = lambda: \"foo\"\n        self.widget._update_sheet_combo = Mock()\n\n        self.widget._try_load()\n        self.assertTrue(self.widget.Warning.load_warning.is_shown())\n        self.assertIn(WARNING_MSG, str(self.widget.Warning.load_warning))\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/data/tests/test_owfile.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "28a71a7de",
                "new_commit_hash": "a3c4a14d4",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/data/tests/test_owfile.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/data/tests/test_owfile.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 1,
                            "length": 7
                        },
                        "new_range": {
                            "start": 1,
                            "length": 8
                        },
                        "section": ""
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "# Test methods with long descriptive names can omit docstrings",
                                "type": "context"
                            },
                            {
                                "content": "# pylint: disable=missing-docstring",
                                "type": "deleted"
                            },
                            {
                                "content": "# pylint: disable=missing-docstring,protected-access",
                                "type": "added"
                            },
                            {
                                "content": "from os import path, remove, getcwd",
                                "type": "context"
                            },
                            {
                                "content": "from os.path import dirname",
                                "type": "context"
                            },
                            {
                                "content": "import unittest",
                                "type": "added"
                            },
                            {
                                "content": "from unittest.mock import Mock, patch",
                                "type": "context"
                            },
                            {
                                "content": "import pickle",
                                "type": "context"
                            },
                            {
                                "content": "import tempfile",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owfile.py",
                            "type": "import",
                            "name": "unittest",
                            "content": "import unittest",
                            "ast_type_str": "Import",
                            "start_lineno": 5,
                            "end_lineno": 5,
                            "parent": null
                        }
                    ],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 648,
                            "length": 8
                        },
                        "new_range": {
                            "start": 649,
                            "length": 30
                        },
                        "section": "a"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.widget._get_reader = lambda: reader",
                                "type": "context"
                            },
                            {
                                "content": "        self.widget.last_path = lambda: \"foo\"",
                                "type": "context"
                            },
                            {
                                "content": "        self.widget._update_sheet_combo = Mock()",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        # Warning must be caught by unit tests, but not the widget",
                                "type": "added"
                            },
                            {
                                "content": "        with self.assertWarns(UserWarning):",
                                "type": "added"
                            },
                            {
                                "content": "            self.widget._try_load()",
                                "type": "added"
                            },
                            {
                                "content": "            self.assertFalse(self.widget.Warning.load_warning.is_shown())",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    @patch(\"os.path.exists\", new=lambda _: True)",
                                "type": "added"
                            },
                            {
                                "content": "    def test_warning_from_this_thread(self):",
                                "type": "added"
                            },
                            {
                                "content": "        WARNING_MSG = \"warning from this thread\"",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        def read():",
                                "type": "added"
                            },
                            {
                                "content": "            warnings.warn(WARNING_MSG)",
                                "type": "added"
                            },
                            {
                                "content": "            return Table(TITANIC_PATH)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        reader = Mock()",
                                "type": "added"
                            },
                            {
                                "content": "        reader.read = read",
                                "type": "added"
                            },
                            {
                                "content": "        self.widget._get_reader = lambda: reader",
                                "type": "added"
                            },
                            {
                                "content": "        self.widget.last_path = lambda: \"foo\"",
                                "type": "added"
                            },
                            {
                                "content": "        self.widget._update_sheet_combo = Mock()",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        self.widget._try_load()",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertFalse(self.widget.Warning.load_warning.is_shown())",
                                "type": "deleted"
                            },
                            {
                                "content": "        self.assertTrue(self.widget.Warning.load_warning.is_shown())",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertIn(WARNING_MSG, str(self.widget.Warning.load_warning))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "if __name__ == \"__main__\":",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owfile.py",
                            "type": "method",
                            "name": "TestOWFile.test_warning_from_another_thread",
                            "content": "class TestOWFile(WidgetTest):\n    # Attribute used to store event data so it does not get garbage\n    # collected before event is processed.\n    event_data = None\n\n    def setUp(self):\n        self.widget = self.create_widget(OWFile)  # type: OWFile\n        dataset_dirs.append(dirname(__file__))\n\n    def tearDown(self):\n        dataset_dirs.pop()\n\n    def test_dragEnterEvent_accepts_urls(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dragEnterEvent(event)\n        self.assertTrue(event.isAccepted())\n\n    def test_dragEnterEvent_skips_osx_file_references(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('/.file/id=12345'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def test_dragEnterEvent_skips_usupported_files(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('file.unsupported'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def _drag_enter_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n        return QDragEnterEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier)\n\n    def test_dropEvent_selects_file(self):\n        self.widget.load_data = Mock()\n        self.widget.source = OWFile.URL\n\n        event = self._drop_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dropEvent(event)\n\n        self.assertEqual(self.widget.source, OWFile.LOCAL_FILE)\n        self.assertTrue(path.samefile(self.widget.last_path(), TITANIC_PATH))\n        self.widget.load_data.assert_called_with()\n\n    def _drop_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n\n        return QDropEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier, QDropEvent.Drop)\n\n    def test_check_file_size(self):\n        self.assertFalse(self.widget.Warning.file_too_big.is_shown())\n        self.widget.SIZE_LIMIT = 4000\n        self.widget.__init__()\n        self.assertTrue(self.widget.Warning.file_too_big.is_shown())\n\n    def test_domain_changes_are_stored(self):\n        assert isinstance(self.widget, OWFile)\n\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n        self.open_dataset(\"zoo\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(data.name, \"zoo\")\n\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n    def test_rename_duplicates(self):\n        self.open_dataset(\"iris\")\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n        self.widget.domain_editor.model().setData(idx, \"iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"iris (1)\", data.domain)\n        self.assertIn(\"iris (2)\", data.domain)\n        self.assertTrue(self.widget.Warning.renamed_vars.is_shown())\n\n        self.widget.domain_editor.model().setData(idx, \"different iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n\n    def test_variable_name_change(self):\n        \"\"\"\n        Test whether the name of the variable is changed correctly by\n        the domaineditor.\n        \"\"\"\n        self.open_dataset(\"iris\")\n\n        # just rename\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"a\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"a\", data.domain)\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.widget.domain_editor.model().setData(idx, \"d\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"d\", data.domain)\n\n        # rename and change to text\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"b\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"b\", data.domain)\n        self.assertIsInstance(data.domain[\"b\"], StringVariable)\n\n        # rename and change to discrete\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(\n            idx, \"categorical\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], DiscreteVariable)\n\n        # rename and change to continuous\n        self.open_dataset(\"zoo\")\n        idx = self.widget.domain_editor.model().createIndex(0, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(0, 1)\n        self.widget.domain_editor.model().setData(idx, \"numeric\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], ContinuousVariable)\n\n    def open_dataset(self, name):\n        filename = FileFormat.locate(name, dataset_dirs)\n        self.widget.add_path(filename)\n        self.widget.load_data()\n\n    def test_no_last_path(self):\n        self.widget =\\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n        # Doesn't crash and contains a single item, (none).\n        self.assertEqual(self.widget.file_combo.count(), 1)\n\n    def test_file_not_found(self):\n        # Create a dummy file\n        file_name = \"test_owfile_data.tab\"\n        domainA = Domain([DiscreteVariable(\"d1\", values=(\"a\", \"b\"))],\n                         DiscreteVariable(\"c1\", values=(\"aaa\", \"bbb\")))\n        dataA = Table(domainA, np.array([[0], [1], [0], [np.nan]]),\n                      np.array([0, 1, 0, 1]))\n        dataA.save(file_name)\n\n        # Open the file with the widget\n        self.open_dataset(file_name)\n        self.assertEqual(self.get_output(self.widget.Outputs.data).domain, dataA.domain)\n\n        # Delete the file and try to reload it\n        remove(file_name)\n        self.widget.load_data()\n        self.assertEqual(file_name, path.basename(self.widget.last_path()))\n        self.assertTrue(self.widget.Error.file_not_found.is_shown())\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n        self.assertEqual(self.widget.infolabel.text(), \"No data.\")\n\n        # Open a sample dataset\n        self.open_dataset(\"iris\")\n        self.assertFalse(self.widget.Error.file_not_found.is_shown())\n\n    def test_nothing_selected(self):\n        # pylint: disable=protected-access\n        widget = self.widget = \\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n\n        widget.Outputs.data.send = Mock()\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n        widget.Outputs.data.send.reset_mock()\n        widget.source = widget.URL\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n    def test_check_column_noname(self):\n        \"\"\"\n        Column name cannot be changed to an empty string or a string with whitespaces.\n        GH-2039\n        \"\"\"\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(1, 0)\n        temp = self.widget.domain_editor.model().data(idx, Qt.DisplayRole)\n        self.widget.domain_editor.model().setData(idx, \"   \", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n        self.widget.domain_editor.model().setData(idx, \"\", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n\n    def test_invalid_role_mode(self):\n        self.open_dataset(\"iris\")\n        model = self.widget.domain_editor.model()\n        idx = model.createIndex(1, 0)\n        self.assertFalse(model.setData(idx, Qt.StatusTipRole, \"\"))\n        self.assertIsNone(model.data(idx, Qt.StatusTipRole))\n\n    def test_context_match_includes_variable_values(self):\n        file1 = \"\"\"\\\nvar\na b\n\na\n\"\"\"\n        file2 = \"\"\"\\\nvar\na b c\n\na\n\"\"\"\n        editor = self.widget.domain_editor\n        idx = self.widget.domain_editor.model().createIndex(0, 3)\n\n        with named_file(file1, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b\")\n\n        with named_file(file2, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b, c\")\n\n    def test_check_datetime_disabled(self):\n        \"\"\"\n        Datetime option is disable if numerical is disabled as well.\n        GH-2050 (code fixes)\n        GH-2120\n        \"\"\"\n        dat = \"\"\"\\\n            01.08.16\\t42.15\\tneumann\\t2017-02-20\n            03.08.16\\t16.08\\tneumann\\t2017-02-21\n            04.08.16\\t23.04\\tneumann\\t2017-02-22\n            03.09.16\\t48.84\\tturing\\t2017-02-23\n            02.02.17\\t23.16\\tturing\\t2017-02-24\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            domain_editor = self.widget.domain_editor\n            idx = lambda x: self.widget.domain_editor.model().createIndex(x, 1)\n\n            qcombobox = QComboBox()\n            combo = ComboDelegate(domain_editor,\n                                  VarTableModel.typenames).createEditor(qcombobox, None, idx(2))\n            vartype_delegate = VarTypeDelegate(domain_editor, VarTableModel.typenames)\n\n            vartype_delegate.setEditorData(combo, idx(2))\n            counts = [4, 2, 4, 2]\n            for i in range(4):\n                vartype_delegate.setEditorData(combo, idx(i))\n                self.assertEqual(combo.count(), counts[i])\n\n    def test_reader_custom_tab(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            qname = MyCustomTabReader.qualified_name()\n            reader = RecentPath(fn, None, None, file_format=qname)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [reader]})\n            self.widget.load_data()\n        self.assertFalse(self.widget.Error.missing_reader.is_shown())\n        outdata = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(outdata), 150)  # loaded iris\n\n    def test_no_reader_extension(self):\n        with named_file(\"\", suffix=\".xyz_unknown\") as fn:\n            no_reader = RecentPath(fn, None, None)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_reader]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_fail_sheets(self):\n        with named_file(\"\", suffix=\".failed_sheet\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Error.sheet_error.is_shown())\n\n    def test_with_warnings(self):\n        with named_file(\"\", suffix=\".with_warning\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Warning.load_warning.is_shown())\n\n    def test_fail(self):\n        with named_file(\"name\\nc\\n\\nstring\", suffix=\".tab\") as fn, \\\n                patch(\"Orange.widgets.data.owfile.log.exception\") as log:\n            self.open_dataset(fn)\n            log.assert_called()\n        self.assertTrue(self.widget.Error.unknown.is_shown())\n\n    def test_read_format(self):\n        iris = Table(\"iris\")\n\n        def open_iris_with_no_spec_format(_a, _b, _c, filters, _e):\n            return iris.__file__, filters.split(\";;\")[0]\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_no_spec_format):\n            self.widget.browse_file()\n\n        self.assertIsNone(self.widget.recent_paths[0].file_format)\n\n        def open_iris_with_tab(*_):\n            return iris.__file__, format_filter(TabReader)\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_tab):\n            self.widget.browse_file()\n\n        self.assertEqual(self.widget.recent_paths[0].file_format, \"Orange.data.io.TabReader\")\n\n    def test_no_specified_reader(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            no_class = RecentPath(fn, None, None, file_format=\"not.a.file.reader.class\")\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_class]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_domain_edit_no_changes(self):\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        # When no changes have been made in the domain editor,\n        # output data should be the same object (and not recreated)\n        self.assertTrue(data is self.widget.data)\n\n    def test_domain_edit_on_sparse_data(self):\n        iris = Table(\"iris\").to_sparse()\n\n        f = tempfile.NamedTemporaryFile(suffix='.pickle', delete=False)\n        pickle.dump(iris, f)\n        f.close()\n\n        self.widget.add_path(f.name)\n        self.widget.load_data()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(output, Table)\n        self.assertEqual(iris.X.shape, output.X.shape)\n        self.assertTrue(sp.issparse(output.X))\n\n    def test_drop_data_when_everything_skipped(self):\n        \"\"\"\n        No data when everything is skipped. Otherwise Select Rows crashes.\n        GH-2237\n        \"\"\"\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertTrue(len(data), 150)\n        self.assertTrue(len(data.domain), 5)\n        for i in range(5):\n            idx = self.widget.domain_editor.model().createIndex(i, 2)\n            self.widget.domain_editor.model().setData(idx, \"skip\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsNone(data)\n\n    def test_call_deprecated_dialog_formats(self):\n        with self.assertWarns(OrangeDeprecationWarning):\n            self.assertIn(\"Tab\", dialog_formats())\n\n    def test_add_new_format(self):\n        # test adding file formats after registering the widget\n        called = False\n        with named_file(\"\", suffix=\".tab\") as filename:\n            def test_format(_sd, _sf, ff, **_):\n                nonlocal called\n                called = True\n                self.assertIn(FailedSheetsFormat, ff)\n                return filename, TabReader, \"\"\n            with patch(\"Orange.widgets.data.owfile.open_filename_dialog\", test_format):\n                self.widget.browse_file()\n        self.assertTrue(called)\n\n    def test_domain_editor_conversions(self):\n        dat = \"\"\"V0\\tV1\\tV2\\tV3\\tV4\\tV5\\tV6\n                 c\\tc\\td\\td\\tc\\td\\td\n                  \\t \\t \\t \\t \\t \\t\n                 3.0\\t1.0\\t4\\ta\\t0.0\\tx\\t1.0\n                 1.0\\t2.0\\t4\\tb\\t0.0\\ty\\t2.0\n                 2.0\\t1.0\\t7\\ta\\t0.0\\ty\\t2.0\n                 0.0\\t2.0\\t7\\ta\\t0.0\\tz\\t2.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            data1 = self.get_output(self.widget.Outputs.data)\n            model = self.widget.domain_editor.model()\n            # check the ordering of attributes\n            for i, a in enumerate(data1.domain.attributes):\n                self.assertEqual(str(a), model.data(model.createIndex(i, 0), Qt.DisplayRole))\n            # make conversions\n            model.setData(model.createIndex(0, 1), \"categorical\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(2, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(3, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(6, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n            data2 = self.get_output(self.widget.Outputs.data)\n            # round continuous values should be converted to integers (3.0 -> 3, \"3\")\n            self.assertEqual(len(data2.domain.attributes[0].values[0]), 1)\n            self.assertEqual(len(data2[0].metas[0]), 1)\n            # discrete integer values should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][2].value), data2[0][1])\n            # discrete round floats should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][6].value), data2[0][5])\n\n    def test_domaineditor_continuous_to_string(self):\n        # GH 2744\n        dat = \"\"\"V0\\nc\\n\\n1.0\\nnan\\n3.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertSequenceEqual(data.metas.ravel().tolist(), ['1', '', '3'])\n\n    def test_domaineditor_makes_variables(self):\n        # Variables created with domain editor should be interchangeable\n        # with variables read from file.\n\n        dat = \"\"\"V0\\tV1\\nc\\td\\n\\n1.0\\t2\"\"\"\n        v0 = StringVariable.make(\"V0\")\n        v1 = ContinuousVariable.make(\"V1\")\n\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertEqual(data.domain[\"V0\"], v0)\n            self.assertEqual(data.domain[\"V1\"], v1)\n\n    def test_url_no_scheme(self):\n        mock_urlreader = Mock(side_effect=ValueError())\n        url = 'foo.bar/xxx.csv'\n\n        with patch('Orange.widgets.data.owfile.UrlReader', mock_urlreader):\n            self.widget.url_combo.insertItem(0, url)\n            self.widget.url_combo.activated.emit(0)\n\n        mock_urlreader.assert_called_once_with('http://' + url)\n\n    def test_adds_origin(self):\n        self.open_dataset(\"origin1/images\")\n        data1 = self.get_output(self.widget.Outputs.data)\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n        self.open_dataset(\"origin2/images\")\n        data2 = self.get_output(self.widget.Outputs.data)\n        attrs = data2.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin2\", attrs[\"origin\"])\n\n        # Make sure that variable in data1 still contains correct origin\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n    def test_summary(self):\n        \"\"\"Check if the status bar is updated when data is received\"\"\"\n        output_sum = self.widget.info.set_output_summary = Mock()\n        self.open_dataset(\"iris\")\n        output = self.get_output(self.widget.Outputs.data)\n        output_sum.assert_called_with(len(output),\n                                      format_summary_details(output))\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_open_moved_workflow(self):\n        \"\"\"Test opening workflow that has been moved to another location\n        (i.e. sent by email), considering data file is stored in the same\n        directory as the workflow.\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n            self.assertEqual(w.file_combo.count(), 1)\n            self.assertFalse(w.Error.file_not_found.is_shown())\n        finally:\n            remove(file_name)\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_files_relocated(self):\n        \"\"\"\n        This test testes if paths are relocated correctly\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n\n            # relocation is called already\n            # if it works correctly relative path should be same than base name\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n\n            w.workflowEnvChanged(\"basedir\", base_name, base_name)\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n        finally:\n            remove(file_name)\n\n    def test_sheets(self):\n        # pylint: disable=protected-access\n        widget = self.widget\n        combo = widget.sheet_combo\n        widget.last_path = \\\n            lambda: path.join(path.dirname(__file__), '..', \"..\", '..',\n                              'tests', 'xlsx_files', 'header_0_sheet.xlsx')\n        widget._try_load()\n        widget.reader.sheet = \"my_sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.itemText(0), \"Sheet1\")\n        self.assertEqual(combo.itemText(1), \"my_sheet\")\n        self.assertEqual(combo.itemText(2), \"Sheet3\")\n        self.assertEqual(combo.currentIndex(), 1)\n\n        widget.reader.sheet = \"no such sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.currentIndex(), 0)\n\n    @patch(\"os.path.exists\", new=lambda _: True)\n    def test_warning_from_another_thread(self):\n        class AnotherWidget(QObject):\n            # This must be a method, not a staticmethod to run in the thread\n            def issue_warning(self):  # pylint: disable=no-self-use\n                time.sleep(0.1)\n                warnings.warn(\"warning from another thread\")\n                warning_thread.quit()\n\n        def read():\n            warning_thread.start()\n            time.sleep(0.2)\n            return Table(TITANIC_PATH)\n\n        warning_thread = QThread()\n        another_widget = AnotherWidget()\n        another_widget.moveToThread(warning_thread)\n        warning_thread.started.connect(another_widget.issue_warning)\n\n        reader = Mock()\n        reader.read = read\n        self.widget._get_reader = lambda: reader\n        self.widget.last_path = lambda: \"foo\"\n        self.widget._update_sheet_combo = Mock()\n        self.widget._try_load()\n        self.assertFalse(self.widget.Warning.load_warning.is_shown())",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 628,
                            "end_lineno": 652,
                            "parent": {
                                "file_name": "Orange/widgets/data/tests/test_owfile.py",
                                "type": "class",
                                "name": "TestOWFile",
                                "content": "class TestOWFile(WidgetTest):\n    # Attribute used to store event data so it does not get garbage\n    # collected before event is processed.\n    event_data = None\n\n    def setUp(self):\n        self.widget = self.create_widget(OWFile)  # type: OWFile\n        dataset_dirs.append(dirname(__file__))\n\n    def tearDown(self):\n        dataset_dirs.pop()\n\n    def test_dragEnterEvent_accepts_urls(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dragEnterEvent(event)\n        self.assertTrue(event.isAccepted())\n\n    def test_dragEnterEvent_skips_osx_file_references(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('/.file/id=12345'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def test_dragEnterEvent_skips_usupported_files(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('file.unsupported'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def _drag_enter_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n        return QDragEnterEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier)\n\n    def test_dropEvent_selects_file(self):\n        self.widget.load_data = Mock()\n        self.widget.source = OWFile.URL\n\n        event = self._drop_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dropEvent(event)\n\n        self.assertEqual(self.widget.source, OWFile.LOCAL_FILE)\n        self.assertTrue(path.samefile(self.widget.last_path(), TITANIC_PATH))\n        self.widget.load_data.assert_called_with()\n\n    def _drop_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n\n        return QDropEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier, QDropEvent.Drop)\n\n    def test_check_file_size(self):\n        self.assertFalse(self.widget.Warning.file_too_big.is_shown())\n        self.widget.SIZE_LIMIT = 4000\n        self.widget.__init__()\n        self.assertTrue(self.widget.Warning.file_too_big.is_shown())\n\n    def test_domain_changes_are_stored(self):\n        assert isinstance(self.widget, OWFile)\n\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n        self.open_dataset(\"zoo\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(data.name, \"zoo\")\n\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n    def test_rename_duplicates(self):\n        self.open_dataset(\"iris\")\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n        self.widget.domain_editor.model().setData(idx, \"iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"iris (1)\", data.domain)\n        self.assertIn(\"iris (2)\", data.domain)\n        self.assertTrue(self.widget.Warning.renamed_vars.is_shown())\n\n        self.widget.domain_editor.model().setData(idx, \"different iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n\n    def test_variable_name_change(self):\n        \"\"\"\n        Test whether the name of the variable is changed correctly by\n        the domaineditor.\n        \"\"\"\n        self.open_dataset(\"iris\")\n\n        # just rename\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"a\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"a\", data.domain)\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.widget.domain_editor.model().setData(idx, \"d\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"d\", data.domain)\n\n        # rename and change to text\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"b\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"b\", data.domain)\n        self.assertIsInstance(data.domain[\"b\"], StringVariable)\n\n        # rename and change to discrete\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(\n            idx, \"categorical\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], DiscreteVariable)\n\n        # rename and change to continuous\n        self.open_dataset(\"zoo\")\n        idx = self.widget.domain_editor.model().createIndex(0, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(0, 1)\n        self.widget.domain_editor.model().setData(idx, \"numeric\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], ContinuousVariable)\n\n    def open_dataset(self, name):\n        filename = FileFormat.locate(name, dataset_dirs)\n        self.widget.add_path(filename)\n        self.widget.load_data()\n\n    def test_no_last_path(self):\n        self.widget =\\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n        # Doesn't crash and contains a single item, (none).\n        self.assertEqual(self.widget.file_combo.count(), 1)\n\n    def test_file_not_found(self):\n        # Create a dummy file\n        file_name = \"test_owfile_data.tab\"\n        domainA = Domain([DiscreteVariable(\"d1\", values=(\"a\", \"b\"))],\n                         DiscreteVariable(\"c1\", values=(\"aaa\", \"bbb\")))\n        dataA = Table(domainA, np.array([[0], [1], [0], [np.nan]]),\n                      np.array([0, 1, 0, 1]))\n        dataA.save(file_name)\n\n        # Open the file with the widget\n        self.open_dataset(file_name)\n        self.assertEqual(self.get_output(self.widget.Outputs.data).domain, dataA.domain)\n\n        # Delete the file and try to reload it\n        remove(file_name)\n        self.widget.load_data()\n        self.assertEqual(file_name, path.basename(self.widget.last_path()))\n        self.assertTrue(self.widget.Error.file_not_found.is_shown())\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n        self.assertEqual(self.widget.infolabel.text(), \"No data.\")\n\n        # Open a sample dataset\n        self.open_dataset(\"iris\")\n        self.assertFalse(self.widget.Error.file_not_found.is_shown())\n\n    def test_nothing_selected(self):\n        # pylint: disable=protected-access\n        widget = self.widget = \\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n\n        widget.Outputs.data.send = Mock()\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n        widget.Outputs.data.send.reset_mock()\n        widget.source = widget.URL\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n    def test_check_column_noname(self):\n        \"\"\"\n        Column name cannot be changed to an empty string or a string with whitespaces.\n        GH-2039\n        \"\"\"\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(1, 0)\n        temp = self.widget.domain_editor.model().data(idx, Qt.DisplayRole)\n        self.widget.domain_editor.model().setData(idx, \"   \", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n        self.widget.domain_editor.model().setData(idx, \"\", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n\n    def test_invalid_role_mode(self):\n        self.open_dataset(\"iris\")\n        model = self.widget.domain_editor.model()\n        idx = model.createIndex(1, 0)\n        self.assertFalse(model.setData(idx, Qt.StatusTipRole, \"\"))\n        self.assertIsNone(model.data(idx, Qt.StatusTipRole))\n\n    def test_context_match_includes_variable_values(self):\n        file1 = \"\"\"\\\nvar\na b\n\na\n\"\"\"\n        file2 = \"\"\"\\\nvar\na b c\n\na\n\"\"\"\n        editor = self.widget.domain_editor\n        idx = self.widget.domain_editor.model().createIndex(0, 3)\n\n        with named_file(file1, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b\")\n\n        with named_file(file2, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b, c\")\n\n    def test_check_datetime_disabled(self):\n        \"\"\"\n        Datetime option is disable if numerical is disabled as well.\n        GH-2050 (code fixes)\n        GH-2120\n        \"\"\"\n        dat = \"\"\"\\\n            01.08.16\\t42.15\\tneumann\\t2017-02-20\n            03.08.16\\t16.08\\tneumann\\t2017-02-21\n            04.08.16\\t23.04\\tneumann\\t2017-02-22\n            03.09.16\\t48.84\\tturing\\t2017-02-23\n            02.02.17\\t23.16\\tturing\\t2017-02-24\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            domain_editor = self.widget.domain_editor\n            idx = lambda x: self.widget.domain_editor.model().createIndex(x, 1)\n\n            qcombobox = QComboBox()\n            combo = ComboDelegate(domain_editor,\n                                  VarTableModel.typenames).createEditor(qcombobox, None, idx(2))\n            vartype_delegate = VarTypeDelegate(domain_editor, VarTableModel.typenames)\n\n            vartype_delegate.setEditorData(combo, idx(2))\n            counts = [4, 2, 4, 2]\n            for i in range(4):\n                vartype_delegate.setEditorData(combo, idx(i))\n                self.assertEqual(combo.count(), counts[i])\n\n    def test_reader_custom_tab(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            qname = MyCustomTabReader.qualified_name()\n            reader = RecentPath(fn, None, None, file_format=qname)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [reader]})\n            self.widget.load_data()\n        self.assertFalse(self.widget.Error.missing_reader.is_shown())\n        outdata = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(outdata), 150)  # loaded iris\n\n    def test_no_reader_extension(self):\n        with named_file(\"\", suffix=\".xyz_unknown\") as fn:\n            no_reader = RecentPath(fn, None, None)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_reader]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_fail_sheets(self):\n        with named_file(\"\", suffix=\".failed_sheet\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Error.sheet_error.is_shown())\n\n    def test_with_warnings(self):\n        with named_file(\"\", suffix=\".with_warning\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Warning.load_warning.is_shown())\n\n    def test_fail(self):\n        with named_file(\"name\\nc\\n\\nstring\", suffix=\".tab\") as fn, \\\n                patch(\"Orange.widgets.data.owfile.log.exception\") as log:\n            self.open_dataset(fn)\n            log.assert_called()\n        self.assertTrue(self.widget.Error.unknown.is_shown())\n\n    def test_read_format(self):\n        iris = Table(\"iris\")\n\n        def open_iris_with_no_spec_format(_a, _b, _c, filters, _e):\n            return iris.__file__, filters.split(\";;\")[0]\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_no_spec_format):\n            self.widget.browse_file()\n\n        self.assertIsNone(self.widget.recent_paths[0].file_format)\n\n        def open_iris_with_tab(*_):\n            return iris.__file__, format_filter(TabReader)\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_tab):\n            self.widget.browse_file()\n\n        self.assertEqual(self.widget.recent_paths[0].file_format, \"Orange.data.io.TabReader\")\n\n    def test_no_specified_reader(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            no_class = RecentPath(fn, None, None, file_format=\"not.a.file.reader.class\")\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_class]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_domain_edit_no_changes(self):\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        # When no changes have been made in the domain editor,\n        # output data should be the same object (and not recreated)\n        self.assertTrue(data is self.widget.data)\n\n    def test_domain_edit_on_sparse_data(self):\n        iris = Table(\"iris\").to_sparse()\n\n        f = tempfile.NamedTemporaryFile(suffix='.pickle', delete=False)\n        pickle.dump(iris, f)\n        f.close()\n\n        self.widget.add_path(f.name)\n        self.widget.load_data()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(output, Table)\n        self.assertEqual(iris.X.shape, output.X.shape)\n        self.assertTrue(sp.issparse(output.X))\n\n    def test_drop_data_when_everything_skipped(self):\n        \"\"\"\n        No data when everything is skipped. Otherwise Select Rows crashes.\n        GH-2237\n        \"\"\"\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertTrue(len(data), 150)\n        self.assertTrue(len(data.domain), 5)\n        for i in range(5):\n            idx = self.widget.domain_editor.model().createIndex(i, 2)\n            self.widget.domain_editor.model().setData(idx, \"skip\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsNone(data)\n\n    def test_call_deprecated_dialog_formats(self):\n        with self.assertWarns(OrangeDeprecationWarning):\n            self.assertIn(\"Tab\", dialog_formats())\n\n    def test_add_new_format(self):\n        # test adding file formats after registering the widget\n        called = False\n        with named_file(\"\", suffix=\".tab\") as filename:\n            def test_format(_sd, _sf, ff, **_):\n                nonlocal called\n                called = True\n                self.assertIn(FailedSheetsFormat, ff)\n                return filename, TabReader, \"\"\n            with patch(\"Orange.widgets.data.owfile.open_filename_dialog\", test_format):\n                self.widget.browse_file()\n        self.assertTrue(called)\n\n    def test_domain_editor_conversions(self):\n        dat = \"\"\"V0\\tV1\\tV2\\tV3\\tV4\\tV5\\tV6\n                 c\\tc\\td\\td\\tc\\td\\td\n                  \\t \\t \\t \\t \\t \\t\n                 3.0\\t1.0\\t4\\ta\\t0.0\\tx\\t1.0\n                 1.0\\t2.0\\t4\\tb\\t0.0\\ty\\t2.0\n                 2.0\\t1.0\\t7\\ta\\t0.0\\ty\\t2.0\n                 0.0\\t2.0\\t7\\ta\\t0.0\\tz\\t2.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            data1 = self.get_output(self.widget.Outputs.data)\n            model = self.widget.domain_editor.model()\n            # check the ordering of attributes\n            for i, a in enumerate(data1.domain.attributes):\n                self.assertEqual(str(a), model.data(model.createIndex(i, 0), Qt.DisplayRole))\n            # make conversions\n            model.setData(model.createIndex(0, 1), \"categorical\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(2, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(3, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(6, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n            data2 = self.get_output(self.widget.Outputs.data)\n            # round continuous values should be converted to integers (3.0 -> 3, \"3\")\n            self.assertEqual(len(data2.domain.attributes[0].values[0]), 1)\n            self.assertEqual(len(data2[0].metas[0]), 1)\n            # discrete integer values should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][2].value), data2[0][1])\n            # discrete round floats should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][6].value), data2[0][5])\n\n    def test_domaineditor_continuous_to_string(self):\n        # GH 2744\n        dat = \"\"\"V0\\nc\\n\\n1.0\\nnan\\n3.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertSequenceEqual(data.metas.ravel().tolist(), ['1', '', '3'])\n\n    def test_domaineditor_makes_variables(self):\n        # Variables created with domain editor should be interchangeable\n        # with variables read from file.\n\n        dat = \"\"\"V0\\tV1\\nc\\td\\n\\n1.0\\t2\"\"\"\n        v0 = StringVariable.make(\"V0\")\n        v1 = ContinuousVariable.make(\"V1\")\n\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertEqual(data.domain[\"V0\"], v0)\n            self.assertEqual(data.domain[\"V1\"], v1)\n\n    def test_url_no_scheme(self):\n        mock_urlreader = Mock(side_effect=ValueError())\n        url = 'foo.bar/xxx.csv'\n\n        with patch('Orange.widgets.data.owfile.UrlReader', mock_urlreader):\n            self.widget.url_combo.insertItem(0, url)\n            self.widget.url_combo.activated.emit(0)\n\n        mock_urlreader.assert_called_once_with('http://' + url)\n\n    def test_adds_origin(self):\n        self.open_dataset(\"origin1/images\")\n        data1 = self.get_output(self.widget.Outputs.data)\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n        self.open_dataset(\"origin2/images\")\n        data2 = self.get_output(self.widget.Outputs.data)\n        attrs = data2.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin2\", attrs[\"origin\"])\n\n        # Make sure that variable in data1 still contains correct origin\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n    def test_summary(self):\n        \"\"\"Check if the status bar is updated when data is received\"\"\"\n        output_sum = self.widget.info.set_output_summary = Mock()\n        self.open_dataset(\"iris\")\n        output = self.get_output(self.widget.Outputs.data)\n        output_sum.assert_called_with(len(output),\n                                      format_summary_details(output))\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_open_moved_workflow(self):\n        \"\"\"Test opening workflow that has been moved to another location\n        (i.e. sent by email), considering data file is stored in the same\n        directory as the workflow.\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n            self.assertEqual(w.file_combo.count(), 1)\n            self.assertFalse(w.Error.file_not_found.is_shown())\n        finally:\n            remove(file_name)\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_files_relocated(self):\n        \"\"\"\n        This test testes if paths are relocated correctly\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n\n            # relocation is called already\n            # if it works correctly relative path should be same than base name\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n\n            w.workflowEnvChanged(\"basedir\", base_name, base_name)\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n        finally:\n            remove(file_name)\n\n    def test_sheets(self):\n        # pylint: disable=protected-access\n        widget = self.widget\n        combo = widget.sheet_combo\n        widget.last_path = \\\n            lambda: path.join(path.dirname(__file__), '..', \"..\", '..',\n                              'tests', 'xlsx_files', 'header_0_sheet.xlsx')\n        widget._try_load()\n        widget.reader.sheet = \"my_sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.itemText(0), \"Sheet1\")\n        self.assertEqual(combo.itemText(1), \"my_sheet\")\n        self.assertEqual(combo.itemText(2), \"Sheet3\")\n        self.assertEqual(combo.currentIndex(), 1)\n\n        widget.reader.sheet = \"no such sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.currentIndex(), 0)\n\n    @patch(\"os.path.exists\", new=lambda _: True)\n    def test_warning_from_another_thread(self):\n        class AnotherWidget(QObject):\n            # This must be a method, not a staticmethod to run in the thread\n            def issue_warning(self):  # pylint: disable=no-self-use\n                time.sleep(0.1)\n                warnings.warn(\"warning from another thread\")\n                warning_thread.quit()\n\n        def read():\n            warning_thread.start()\n            time.sleep(0.2)\n            return Table(TITANIC_PATH)\n\n        warning_thread = QThread()\n        another_widget = AnotherWidget()\n        another_widget.moveToThread(warning_thread)\n        warning_thread.started.connect(another_widget.issue_warning)\n\n        reader = Mock()\n        reader.read = read\n        self.widget._get_reader = lambda: reader\n        self.widget.last_path = lambda: \"foo\"\n        self.widget._update_sheet_combo = Mock()\n        self.widget._try_load()\n        self.assertFalse(self.widget.Warning.load_warning.is_shown())",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 67,
                                "end_lineno": 652,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/data/tests/test_owfile.py",
                            "type": "class",
                            "name": "TestOWFile",
                            "content": "class TestOWFile(WidgetTest):\n    # Attribute used to store event data so it does not get garbage\n    # collected before event is processed.\n    event_data = None\n\n    def setUp(self):\n        self.widget = self.create_widget(OWFile)  # type: OWFile\n        dataset_dirs.append(dirname(__file__))\n\n    def tearDown(self):\n        dataset_dirs.pop()\n\n    def test_dragEnterEvent_accepts_urls(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dragEnterEvent(event)\n        self.assertTrue(event.isAccepted())\n\n    def test_dragEnterEvent_skips_osx_file_references(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('/.file/id=12345'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def test_dragEnterEvent_skips_usupported_files(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('file.unsupported'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def _drag_enter_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n        return QDragEnterEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier)\n\n    def test_dropEvent_selects_file(self):\n        self.widget.load_data = Mock()\n        self.widget.source = OWFile.URL\n\n        event = self._drop_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dropEvent(event)\n\n        self.assertEqual(self.widget.source, OWFile.LOCAL_FILE)\n        self.assertTrue(path.samefile(self.widget.last_path(), TITANIC_PATH))\n        self.widget.load_data.assert_called_with()\n\n    def _drop_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n\n        return QDropEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier, QDropEvent.Drop)\n\n    def test_check_file_size(self):\n        self.assertFalse(self.widget.Warning.file_too_big.is_shown())\n        self.widget.SIZE_LIMIT = 4000\n        self.widget.__init__()\n        self.assertTrue(self.widget.Warning.file_too_big.is_shown())\n\n    def test_domain_changes_are_stored(self):\n        assert isinstance(self.widget, OWFile)\n\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n        self.open_dataset(\"zoo\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(data.name, \"zoo\")\n\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n    def test_rename_duplicates(self):\n        self.open_dataset(\"iris\")\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n        self.widget.domain_editor.model().setData(idx, \"iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"iris (1)\", data.domain)\n        self.assertIn(\"iris (2)\", data.domain)\n        self.assertTrue(self.widget.Warning.renamed_vars.is_shown())\n\n        self.widget.domain_editor.model().setData(idx, \"different iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n\n    def test_variable_name_change(self):\n        \"\"\"\n        Test whether the name of the variable is changed correctly by\n        the domaineditor.\n        \"\"\"\n        self.open_dataset(\"iris\")\n\n        # just rename\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"a\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"a\", data.domain)\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.widget.domain_editor.model().setData(idx, \"d\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"d\", data.domain)\n\n        # rename and change to text\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"b\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"b\", data.domain)\n        self.assertIsInstance(data.domain[\"b\"], StringVariable)\n\n        # rename and change to discrete\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(\n            idx, \"categorical\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], DiscreteVariable)\n\n        # rename and change to continuous\n        self.open_dataset(\"zoo\")\n        idx = self.widget.domain_editor.model().createIndex(0, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(0, 1)\n        self.widget.domain_editor.model().setData(idx, \"numeric\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], ContinuousVariable)\n\n    def open_dataset(self, name):\n        filename = FileFormat.locate(name, dataset_dirs)\n        self.widget.add_path(filename)\n        self.widget.load_data()\n\n    def test_no_last_path(self):\n        self.widget =\\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n        # Doesn't crash and contains a single item, (none).\n        self.assertEqual(self.widget.file_combo.count(), 1)\n\n    def test_file_not_found(self):\n        # Create a dummy file\n        file_name = \"test_owfile_data.tab\"\n        domainA = Domain([DiscreteVariable(\"d1\", values=(\"a\", \"b\"))],\n                         DiscreteVariable(\"c1\", values=(\"aaa\", \"bbb\")))\n        dataA = Table(domainA, np.array([[0], [1], [0], [np.nan]]),\n                      np.array([0, 1, 0, 1]))\n        dataA.save(file_name)\n\n        # Open the file with the widget\n        self.open_dataset(file_name)\n        self.assertEqual(self.get_output(self.widget.Outputs.data).domain, dataA.domain)\n\n        # Delete the file and try to reload it\n        remove(file_name)\n        self.widget.load_data()\n        self.assertEqual(file_name, path.basename(self.widget.last_path()))\n        self.assertTrue(self.widget.Error.file_not_found.is_shown())\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n        self.assertEqual(self.widget.infolabel.text(), \"No data.\")\n\n        # Open a sample dataset\n        self.open_dataset(\"iris\")\n        self.assertFalse(self.widget.Error.file_not_found.is_shown())\n\n    def test_nothing_selected(self):\n        # pylint: disable=protected-access\n        widget = self.widget = \\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n\n        widget.Outputs.data.send = Mock()\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n        widget.Outputs.data.send.reset_mock()\n        widget.source = widget.URL\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n    def test_check_column_noname(self):\n        \"\"\"\n        Column name cannot be changed to an empty string or a string with whitespaces.\n        GH-2039\n        \"\"\"\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(1, 0)\n        temp = self.widget.domain_editor.model().data(idx, Qt.DisplayRole)\n        self.widget.domain_editor.model().setData(idx, \"   \", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n        self.widget.domain_editor.model().setData(idx, \"\", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n\n    def test_invalid_role_mode(self):\n        self.open_dataset(\"iris\")\n        model = self.widget.domain_editor.model()\n        idx = model.createIndex(1, 0)\n        self.assertFalse(model.setData(idx, Qt.StatusTipRole, \"\"))\n        self.assertIsNone(model.data(idx, Qt.StatusTipRole))\n\n    def test_context_match_includes_variable_values(self):\n        file1 = \"\"\"\\\nvar\na b\n\na\n\"\"\"\n        file2 = \"\"\"\\\nvar\na b c\n\na\n\"\"\"\n        editor = self.widget.domain_editor\n        idx = self.widget.domain_editor.model().createIndex(0, 3)\n\n        with named_file(file1, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b\")\n\n        with named_file(file2, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b, c\")\n\n    def test_check_datetime_disabled(self):\n        \"\"\"\n        Datetime option is disable if numerical is disabled as well.\n        GH-2050 (code fixes)\n        GH-2120\n        \"\"\"\n        dat = \"\"\"\\\n            01.08.16\\t42.15\\tneumann\\t2017-02-20\n            03.08.16\\t16.08\\tneumann\\t2017-02-21\n            04.08.16\\t23.04\\tneumann\\t2017-02-22\n            03.09.16\\t48.84\\tturing\\t2017-02-23\n            02.02.17\\t23.16\\tturing\\t2017-02-24\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            domain_editor = self.widget.domain_editor\n            idx = lambda x: self.widget.domain_editor.model().createIndex(x, 1)\n\n            qcombobox = QComboBox()\n            combo = ComboDelegate(domain_editor,\n                                  VarTableModel.typenames).createEditor(qcombobox, None, idx(2))\n            vartype_delegate = VarTypeDelegate(domain_editor, VarTableModel.typenames)\n\n            vartype_delegate.setEditorData(combo, idx(2))\n            counts = [4, 2, 4, 2]\n            for i in range(4):\n                vartype_delegate.setEditorData(combo, idx(i))\n                self.assertEqual(combo.count(), counts[i])\n\n    def test_reader_custom_tab(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            qname = MyCustomTabReader.qualified_name()\n            reader = RecentPath(fn, None, None, file_format=qname)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [reader]})\n            self.widget.load_data()\n        self.assertFalse(self.widget.Error.missing_reader.is_shown())\n        outdata = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(outdata), 150)  # loaded iris\n\n    def test_no_reader_extension(self):\n        with named_file(\"\", suffix=\".xyz_unknown\") as fn:\n            no_reader = RecentPath(fn, None, None)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_reader]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_fail_sheets(self):\n        with named_file(\"\", suffix=\".failed_sheet\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Error.sheet_error.is_shown())\n\n    def test_with_warnings(self):\n        with named_file(\"\", suffix=\".with_warning\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Warning.load_warning.is_shown())\n\n    def test_fail(self):\n        with named_file(\"name\\nc\\n\\nstring\", suffix=\".tab\") as fn, \\\n                patch(\"Orange.widgets.data.owfile.log.exception\") as log:\n            self.open_dataset(fn)\n            log.assert_called()\n        self.assertTrue(self.widget.Error.unknown.is_shown())\n\n    def test_read_format(self):\n        iris = Table(\"iris\")\n\n        def open_iris_with_no_spec_format(_a, _b, _c, filters, _e):\n            return iris.__file__, filters.split(\";;\")[0]\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_no_spec_format):\n            self.widget.browse_file()\n\n        self.assertIsNone(self.widget.recent_paths[0].file_format)\n\n        def open_iris_with_tab(*_):\n            return iris.__file__, format_filter(TabReader)\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_tab):\n            self.widget.browse_file()\n\n        self.assertEqual(self.widget.recent_paths[0].file_format, \"Orange.data.io.TabReader\")\n\n    def test_no_specified_reader(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            no_class = RecentPath(fn, None, None, file_format=\"not.a.file.reader.class\")\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_class]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_domain_edit_no_changes(self):\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        # When no changes have been made in the domain editor,\n        # output data should be the same object (and not recreated)\n        self.assertTrue(data is self.widget.data)\n\n    def test_domain_edit_on_sparse_data(self):\n        iris = Table(\"iris\").to_sparse()\n\n        f = tempfile.NamedTemporaryFile(suffix='.pickle', delete=False)\n        pickle.dump(iris, f)\n        f.close()\n\n        self.widget.add_path(f.name)\n        self.widget.load_data()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(output, Table)\n        self.assertEqual(iris.X.shape, output.X.shape)\n        self.assertTrue(sp.issparse(output.X))\n\n    def test_drop_data_when_everything_skipped(self):\n        \"\"\"\n        No data when everything is skipped. Otherwise Select Rows crashes.\n        GH-2237\n        \"\"\"\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertTrue(len(data), 150)\n        self.assertTrue(len(data.domain), 5)\n        for i in range(5):\n            idx = self.widget.domain_editor.model().createIndex(i, 2)\n            self.widget.domain_editor.model().setData(idx, \"skip\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsNone(data)\n\n    def test_call_deprecated_dialog_formats(self):\n        with self.assertWarns(OrangeDeprecationWarning):\n            self.assertIn(\"Tab\", dialog_formats())\n\n    def test_add_new_format(self):\n        # test adding file formats after registering the widget\n        called = False\n        with named_file(\"\", suffix=\".tab\") as filename:\n            def test_format(_sd, _sf, ff, **_):\n                nonlocal called\n                called = True\n                self.assertIn(FailedSheetsFormat, ff)\n                return filename, TabReader, \"\"\n            with patch(\"Orange.widgets.data.owfile.open_filename_dialog\", test_format):\n                self.widget.browse_file()\n        self.assertTrue(called)\n\n    def test_domain_editor_conversions(self):\n        dat = \"\"\"V0\\tV1\\tV2\\tV3\\tV4\\tV5\\tV6\n                 c\\tc\\td\\td\\tc\\td\\td\n                  \\t \\t \\t \\t \\t \\t\n                 3.0\\t1.0\\t4\\ta\\t0.0\\tx\\t1.0\n                 1.0\\t2.0\\t4\\tb\\t0.0\\ty\\t2.0\n                 2.0\\t1.0\\t7\\ta\\t0.0\\ty\\t2.0\n                 0.0\\t2.0\\t7\\ta\\t0.0\\tz\\t2.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            data1 = self.get_output(self.widget.Outputs.data)\n            model = self.widget.domain_editor.model()\n            # check the ordering of attributes\n            for i, a in enumerate(data1.domain.attributes):\n                self.assertEqual(str(a), model.data(model.createIndex(i, 0), Qt.DisplayRole))\n            # make conversions\n            model.setData(model.createIndex(0, 1), \"categorical\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(2, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(3, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(6, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n            data2 = self.get_output(self.widget.Outputs.data)\n            # round continuous values should be converted to integers (3.0 -> 3, \"3\")\n            self.assertEqual(len(data2.domain.attributes[0].values[0]), 1)\n            self.assertEqual(len(data2[0].metas[0]), 1)\n            # discrete integer values should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][2].value), data2[0][1])\n            # discrete round floats should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][6].value), data2[0][5])\n\n    def test_domaineditor_continuous_to_string(self):\n        # GH 2744\n        dat = \"\"\"V0\\nc\\n\\n1.0\\nnan\\n3.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertSequenceEqual(data.metas.ravel().tolist(), ['1', '', '3'])\n\n    def test_domaineditor_makes_variables(self):\n        # Variables created with domain editor should be interchangeable\n        # with variables read from file.\n\n        dat = \"\"\"V0\\tV1\\nc\\td\\n\\n1.0\\t2\"\"\"\n        v0 = StringVariable.make(\"V0\")\n        v1 = ContinuousVariable.make(\"V1\")\n\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertEqual(data.domain[\"V0\"], v0)\n            self.assertEqual(data.domain[\"V1\"], v1)\n\n    def test_url_no_scheme(self):\n        mock_urlreader = Mock(side_effect=ValueError())\n        url = 'foo.bar/xxx.csv'\n\n        with patch('Orange.widgets.data.owfile.UrlReader', mock_urlreader):\n            self.widget.url_combo.insertItem(0, url)\n            self.widget.url_combo.activated.emit(0)\n\n        mock_urlreader.assert_called_once_with('http://' + url)\n\n    def test_adds_origin(self):\n        self.open_dataset(\"origin1/images\")\n        data1 = self.get_output(self.widget.Outputs.data)\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n        self.open_dataset(\"origin2/images\")\n        data2 = self.get_output(self.widget.Outputs.data)\n        attrs = data2.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin2\", attrs[\"origin\"])\n\n        # Make sure that variable in data1 still contains correct origin\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n    def test_summary(self):\n        \"\"\"Check if the status bar is updated when data is received\"\"\"\n        output_sum = self.widget.info.set_output_summary = Mock()\n        self.open_dataset(\"iris\")\n        output = self.get_output(self.widget.Outputs.data)\n        output_sum.assert_called_with(len(output),\n                                      format_summary_details(output))\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_open_moved_workflow(self):\n        \"\"\"Test opening workflow that has been moved to another location\n        (i.e. sent by email), considering data file is stored in the same\n        directory as the workflow.\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n            self.assertEqual(w.file_combo.count(), 1)\n            self.assertFalse(w.Error.file_not_found.is_shown())\n        finally:\n            remove(file_name)\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_files_relocated(self):\n        \"\"\"\n        This test testes if paths are relocated correctly\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n\n            # relocation is called already\n            # if it works correctly relative path should be same than base name\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n\n            w.workflowEnvChanged(\"basedir\", base_name, base_name)\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n        finally:\n            remove(file_name)\n\n    def test_sheets(self):\n        # pylint: disable=protected-access\n        widget = self.widget\n        combo = widget.sheet_combo\n        widget.last_path = \\\n            lambda: path.join(path.dirname(__file__), '..', \"..\", '..',\n                              'tests', 'xlsx_files', 'header_0_sheet.xlsx')\n        widget._try_load()\n        widget.reader.sheet = \"my_sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.itemText(0), \"Sheet1\")\n        self.assertEqual(combo.itemText(1), \"my_sheet\")\n        self.assertEqual(combo.itemText(2), \"Sheet3\")\n        self.assertEqual(combo.currentIndex(), 1)\n\n        widget.reader.sheet = \"no such sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.currentIndex(), 0)\n\n    @patch(\"os.path.exists\", new=lambda _: True)\n    def test_warning_from_another_thread(self):\n        class AnotherWidget(QObject):\n            # This must be a method, not a staticmethod to run in the thread\n            def issue_warning(self):  # pylint: disable=no-self-use\n                time.sleep(0.1)\n                warnings.warn(\"warning from another thread\")\n                warning_thread.quit()\n\n        def read():\n            warning_thread.start()\n            time.sleep(0.2)\n            return Table(TITANIC_PATH)\n\n        warning_thread = QThread()\n        another_widget = AnotherWidget()\n        another_widget.moveToThread(warning_thread)\n        warning_thread.started.connect(another_widget.issue_warning)\n\n        reader = Mock()\n        reader.read = read\n        self.widget._get_reader = lambda: reader\n        self.widget.last_path = lambda: \"foo\"\n        self.widget._update_sheet_combo = Mock()\n        self.widget._try_load()\n        self.assertFalse(self.widget.Warning.load_warning.is_shown())",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 67,
                            "end_lineno": 652,
                            "parent": null
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owfile.py",
                            "type": "method",
                            "name": "TestOWFile.test_warning_from_this_thread",
                            "content": "class TestOWFile(WidgetTest):\n    # Attribute used to store event data so it does not get garbage\n    # collected before event is processed.\n    event_data = None\n\n    def setUp(self):\n        self.widget = self.create_widget(OWFile)  # type: OWFile\n        dataset_dirs.append(dirname(__file__))\n\n    def tearDown(self):\n        dataset_dirs.pop()\n\n    def test_dragEnterEvent_accepts_urls(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dragEnterEvent(event)\n        self.assertTrue(event.isAccepted())\n\n    def test_dragEnterEvent_skips_osx_file_references(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('/.file/id=12345'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def test_dragEnterEvent_skips_usupported_files(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('file.unsupported'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def _drag_enter_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n        return QDragEnterEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier)\n\n    def test_dropEvent_selects_file(self):\n        self.widget.load_data = Mock()\n        self.widget.source = OWFile.URL\n\n        event = self._drop_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dropEvent(event)\n\n        self.assertEqual(self.widget.source, OWFile.LOCAL_FILE)\n        self.assertTrue(path.samefile(self.widget.last_path(), TITANIC_PATH))\n        self.widget.load_data.assert_called_with()\n\n    def _drop_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n\n        return QDropEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier, QDropEvent.Drop)\n\n    def test_check_file_size(self):\n        self.assertFalse(self.widget.Warning.file_too_big.is_shown())\n        self.widget.SIZE_LIMIT = 4000\n        self.widget.__init__()\n        self.assertTrue(self.widget.Warning.file_too_big.is_shown())\n\n    def test_domain_changes_are_stored(self):\n        assert isinstance(self.widget, OWFile)\n\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n        self.open_dataset(\"zoo\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(data.name, \"zoo\")\n\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n    def test_rename_duplicates(self):\n        self.open_dataset(\"iris\")\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n        self.widget.domain_editor.model().setData(idx, \"iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"iris (1)\", data.domain)\n        self.assertIn(\"iris (2)\", data.domain)\n        self.assertTrue(self.widget.Warning.renamed_vars.is_shown())\n\n        self.widget.domain_editor.model().setData(idx, \"different iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n\n    def test_variable_name_change(self):\n        \"\"\"\n        Test whether the name of the variable is changed correctly by\n        the domaineditor.\n        \"\"\"\n        self.open_dataset(\"iris\")\n\n        # just rename\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"a\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"a\", data.domain)\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.widget.domain_editor.model().setData(idx, \"d\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"d\", data.domain)\n\n        # rename and change to text\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"b\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"b\", data.domain)\n        self.assertIsInstance(data.domain[\"b\"], StringVariable)\n\n        # rename and change to discrete\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(\n            idx, \"categorical\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], DiscreteVariable)\n\n        # rename and change to continuous\n        self.open_dataset(\"zoo\")\n        idx = self.widget.domain_editor.model().createIndex(0, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(0, 1)\n        self.widget.domain_editor.model().setData(idx, \"numeric\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], ContinuousVariable)\n\n    def open_dataset(self, name):\n        filename = FileFormat.locate(name, dataset_dirs)\n        self.widget.add_path(filename)\n        self.widget.load_data()\n\n    def test_no_last_path(self):\n        self.widget =\\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n        # Doesn't crash and contains a single item, (none).\n        self.assertEqual(self.widget.file_combo.count(), 1)\n\n    def test_file_not_found(self):\n        # Create a dummy file\n        file_name = \"test_owfile_data.tab\"\n        domainA = Domain([DiscreteVariable(\"d1\", values=(\"a\", \"b\"))],\n                         DiscreteVariable(\"c1\", values=(\"aaa\", \"bbb\")))\n        dataA = Table(domainA, np.array([[0], [1], [0], [np.nan]]),\n                      np.array([0, 1, 0, 1]))\n        dataA.save(file_name)\n\n        # Open the file with the widget\n        self.open_dataset(file_name)\n        self.assertEqual(self.get_output(self.widget.Outputs.data).domain, dataA.domain)\n\n        # Delete the file and try to reload it\n        remove(file_name)\n        self.widget.load_data()\n        self.assertEqual(file_name, path.basename(self.widget.last_path()))\n        self.assertTrue(self.widget.Error.file_not_found.is_shown())\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n        self.assertEqual(self.widget.infolabel.text(), \"No data.\")\n\n        # Open a sample dataset\n        self.open_dataset(\"iris\")\n        self.assertFalse(self.widget.Error.file_not_found.is_shown())\n\n    def test_nothing_selected(self):\n        # pylint: disable=protected-access\n        widget = self.widget = \\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n\n        widget.Outputs.data.send = Mock()\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n        widget.Outputs.data.send.reset_mock()\n        widget.source = widget.URL\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n    def test_check_column_noname(self):\n        \"\"\"\n        Column name cannot be changed to an empty string or a string with whitespaces.\n        GH-2039\n        \"\"\"\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(1, 0)\n        temp = self.widget.domain_editor.model().data(idx, Qt.DisplayRole)\n        self.widget.domain_editor.model().setData(idx, \"   \", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n        self.widget.domain_editor.model().setData(idx, \"\", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n\n    def test_invalid_role_mode(self):\n        self.open_dataset(\"iris\")\n        model = self.widget.domain_editor.model()\n        idx = model.createIndex(1, 0)\n        self.assertFalse(model.setData(idx, Qt.StatusTipRole, \"\"))\n        self.assertIsNone(model.data(idx, Qt.StatusTipRole))\n\n    def test_context_match_includes_variable_values(self):\n        file1 = \"\"\"\\\nvar\na b\n\na\n\"\"\"\n        file2 = \"\"\"\\\nvar\na b c\n\na\n\"\"\"\n        editor = self.widget.domain_editor\n        idx = self.widget.domain_editor.model().createIndex(0, 3)\n\n        with named_file(file1, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b\")\n\n        with named_file(file2, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b, c\")\n\n    def test_check_datetime_disabled(self):\n        \"\"\"\n        Datetime option is disable if numerical is disabled as well.\n        GH-2050 (code fixes)\n        GH-2120\n        \"\"\"\n        dat = \"\"\"\\\n            01.08.16\\t42.15\\tneumann\\t2017-02-20\n            03.08.16\\t16.08\\tneumann\\t2017-02-21\n            04.08.16\\t23.04\\tneumann\\t2017-02-22\n            03.09.16\\t48.84\\tturing\\t2017-02-23\n            02.02.17\\t23.16\\tturing\\t2017-02-24\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            domain_editor = self.widget.domain_editor\n            idx = lambda x: self.widget.domain_editor.model().createIndex(x, 1)\n\n            qcombobox = QComboBox()\n            combo = ComboDelegate(domain_editor,\n                                  VarTableModel.typenames).createEditor(qcombobox, None, idx(2))\n            vartype_delegate = VarTypeDelegate(domain_editor, VarTableModel.typenames)\n\n            vartype_delegate.setEditorData(combo, idx(2))\n            counts = [4, 2, 4, 2]\n            for i in range(4):\n                vartype_delegate.setEditorData(combo, idx(i))\n                self.assertEqual(combo.count(), counts[i])\n\n    def test_reader_custom_tab(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            qname = MyCustomTabReader.qualified_name()\n            reader = RecentPath(fn, None, None, file_format=qname)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [reader]})\n            self.widget.load_data()\n        self.assertFalse(self.widget.Error.missing_reader.is_shown())\n        outdata = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(outdata), 150)  # loaded iris\n\n    def test_no_reader_extension(self):\n        with named_file(\"\", suffix=\".xyz_unknown\") as fn:\n            no_reader = RecentPath(fn, None, None)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_reader]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_fail_sheets(self):\n        with named_file(\"\", suffix=\".failed_sheet\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Error.sheet_error.is_shown())\n\n    def test_with_warnings(self):\n        with named_file(\"\", suffix=\".with_warning\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Warning.load_warning.is_shown())\n\n    def test_fail(self):\n        with named_file(\"name\\nc\\n\\nstring\", suffix=\".tab\") as fn, \\\n                patch(\"Orange.widgets.data.owfile.log.exception\") as log:\n            self.open_dataset(fn)\n            log.assert_called()\n        self.assertTrue(self.widget.Error.unknown.is_shown())\n\n    def test_read_format(self):\n        iris = Table(\"iris\")\n\n        def open_iris_with_no_spec_format(_a, _b, _c, filters, _e):\n            return iris.__file__, filters.split(\";;\")[0]\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_no_spec_format):\n            self.widget.browse_file()\n\n        self.assertIsNone(self.widget.recent_paths[0].file_format)\n\n        def open_iris_with_tab(*_):\n            return iris.__file__, format_filter(TabReader)\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_tab):\n            self.widget.browse_file()\n\n        self.assertEqual(self.widget.recent_paths[0].file_format, \"Orange.data.io.TabReader\")\n\n    def test_no_specified_reader(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            no_class = RecentPath(fn, None, None, file_format=\"not.a.file.reader.class\")\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_class]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_domain_edit_no_changes(self):\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        # When no changes have been made in the domain editor,\n        # output data should be the same object (and not recreated)\n        self.assertTrue(data is self.widget.data)\n\n    def test_domain_edit_on_sparse_data(self):\n        iris = Table(\"iris\").to_sparse()\n\n        f = tempfile.NamedTemporaryFile(suffix='.pickle', delete=False)\n        pickle.dump(iris, f)\n        f.close()\n\n        self.widget.add_path(f.name)\n        self.widget.load_data()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(output, Table)\n        self.assertEqual(iris.X.shape, output.X.shape)\n        self.assertTrue(sp.issparse(output.X))\n\n    def test_drop_data_when_everything_skipped(self):\n        \"\"\"\n        No data when everything is skipped. Otherwise Select Rows crashes.\n        GH-2237\n        \"\"\"\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertTrue(len(data), 150)\n        self.assertTrue(len(data.domain), 5)\n        for i in range(5):\n            idx = self.widget.domain_editor.model().createIndex(i, 2)\n            self.widget.domain_editor.model().setData(idx, \"skip\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsNone(data)\n\n    def test_call_deprecated_dialog_formats(self):\n        with self.assertWarns(OrangeDeprecationWarning):\n            self.assertIn(\"Tab\", dialog_formats())\n\n    def test_add_new_format(self):\n        # test adding file formats after registering the widget\n        called = False\n        with named_file(\"\", suffix=\".tab\") as filename:\n            def test_format(_sd, _sf, ff, **_):\n                nonlocal called\n                called = True\n                self.assertIn(FailedSheetsFormat, ff)\n                return filename, TabReader, \"\"\n            with patch(\"Orange.widgets.data.owfile.open_filename_dialog\", test_format):\n                self.widget.browse_file()\n        self.assertTrue(called)\n\n    def test_domain_editor_conversions(self):\n        dat = \"\"\"V0\\tV1\\tV2\\tV3\\tV4\\tV5\\tV6\n                 c\\tc\\td\\td\\tc\\td\\td\n                  \\t \\t \\t \\t \\t \\t\n                 3.0\\t1.0\\t4\\ta\\t0.0\\tx\\t1.0\n                 1.0\\t2.0\\t4\\tb\\t0.0\\ty\\t2.0\n                 2.0\\t1.0\\t7\\ta\\t0.0\\ty\\t2.0\n                 0.0\\t2.0\\t7\\ta\\t0.0\\tz\\t2.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            data1 = self.get_output(self.widget.Outputs.data)\n            model = self.widget.domain_editor.model()\n            # check the ordering of attributes\n            for i, a in enumerate(data1.domain.attributes):\n                self.assertEqual(str(a), model.data(model.createIndex(i, 0), Qt.DisplayRole))\n            # make conversions\n            model.setData(model.createIndex(0, 1), \"categorical\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(2, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(3, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(6, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n            data2 = self.get_output(self.widget.Outputs.data)\n            # round continuous values should be converted to integers (3.0 -> 3, \"3\")\n            self.assertEqual(len(data2.domain.attributes[0].values[0]), 1)\n            self.assertEqual(len(data2[0].metas[0]), 1)\n            # discrete integer values should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][2].value), data2[0][1])\n            # discrete round floats should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][6].value), data2[0][5])\n\n    def test_domaineditor_continuous_to_string(self):\n        # GH 2744\n        dat = \"\"\"V0\\nc\\n\\n1.0\\nnan\\n3.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertSequenceEqual(data.metas.ravel().tolist(), ['1', '', '3'])\n\n    def test_domaineditor_makes_variables(self):\n        # Variables created with domain editor should be interchangeable\n        # with variables read from file.\n\n        dat = \"\"\"V0\\tV1\\nc\\td\\n\\n1.0\\t2\"\"\"\n        v0 = StringVariable.make(\"V0\")\n        v1 = ContinuousVariable.make(\"V1\")\n\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertEqual(data.domain[\"V0\"], v0)\n            self.assertEqual(data.domain[\"V1\"], v1)\n\n    def test_url_no_scheme(self):\n        mock_urlreader = Mock(side_effect=ValueError())\n        url = 'foo.bar/xxx.csv'\n\n        with patch('Orange.widgets.data.owfile.UrlReader', mock_urlreader):\n            self.widget.url_combo.insertItem(0, url)\n            self.widget.url_combo.activated.emit(0)\n\n        mock_urlreader.assert_called_once_with('http://' + url)\n\n    def test_adds_origin(self):\n        self.open_dataset(\"origin1/images\")\n        data1 = self.get_output(self.widget.Outputs.data)\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n        self.open_dataset(\"origin2/images\")\n        data2 = self.get_output(self.widget.Outputs.data)\n        attrs = data2.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin2\", attrs[\"origin\"])\n\n        # Make sure that variable in data1 still contains correct origin\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n    def test_summary(self):\n        \"\"\"Check if the status bar is updated when data is received\"\"\"\n        output_sum = self.widget.info.set_output_summary = Mock()\n        self.open_dataset(\"iris\")\n        output = self.get_output(self.widget.Outputs.data)\n        output_sum.assert_called_with(len(output),\n                                      format_summary_details(output))\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_open_moved_workflow(self):\n        \"\"\"Test opening workflow that has been moved to another location\n        (i.e. sent by email), considering data file is stored in the same\n        directory as the workflow.\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n            self.assertEqual(w.file_combo.count(), 1)\n            self.assertFalse(w.Error.file_not_found.is_shown())\n        finally:\n            remove(file_name)\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_files_relocated(self):\n        \"\"\"\n        This test testes if paths are relocated correctly\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n\n            # relocation is called already\n            # if it works correctly relative path should be same than base name\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n\n            w.workflowEnvChanged(\"basedir\", base_name, base_name)\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n        finally:\n            remove(file_name)\n\n    def test_sheets(self):\n        # pylint: disable=protected-access\n        widget = self.widget\n        combo = widget.sheet_combo\n        widget.last_path = \\\n            lambda: path.join(path.dirname(__file__), '..', \"..\", '..',\n                              'tests', 'xlsx_files', 'header_0_sheet.xlsx')\n        widget._try_load()\n        widget.reader.sheet = \"my_sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.itemText(0), \"Sheet1\")\n        self.assertEqual(combo.itemText(1), \"my_sheet\")\n        self.assertEqual(combo.itemText(2), \"Sheet3\")\n        self.assertEqual(combo.currentIndex(), 1)\n\n        widget.reader.sheet = \"no such sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.currentIndex(), 0)\n\n    @patch(\"os.path.exists\", new=lambda _: True)\n    def test_warning_from_another_thread(self):\n        class AnotherWidget(QObject):\n            # This must be a method, not a staticmethod to run in the thread\n            def issue_warning(self):  # pylint: disable=no-self-use\n                time.sleep(0.1)\n                warnings.warn(\"warning from another thread\")\n                warning_thread.quit()\n\n        def read():\n            warning_thread.start()\n            time.sleep(0.2)\n            return Table(TITANIC_PATH)\n\n        warning_thread = QThread()\n        another_widget = AnotherWidget()\n        another_widget.moveToThread(warning_thread)\n        warning_thread.started.connect(another_widget.issue_warning)\n\n        reader = Mock()\n        reader.read = read\n        self.widget._get_reader = lambda: reader\n        self.widget.last_path = lambda: \"foo\"\n        self.widget._update_sheet_combo = Mock()\n\n        # Warning must be caught by unit tests, but not the widget\n        with self.assertWarns(UserWarning):\n            self.widget._try_load()\n            self.assertFalse(self.widget.Warning.load_warning.is_shown())\n\n\n    @patch(\"os.path.exists\", new=lambda _: True)\n    def test_warning_from_this_thread(self):\n        WARNING_MSG = \"warning from this thread\"\n\n        def read():\n            warnings.warn(WARNING_MSG)\n            return Table(TITANIC_PATH)\n\n        reader = Mock()\n        reader.read = read\n        self.widget._get_reader = lambda: reader\n        self.widget.last_path = lambda: \"foo\"\n        self.widget._update_sheet_combo = Mock()\n\n        self.widget._try_load()\n        self.assertTrue(self.widget.Warning.load_warning.is_shown())\n        self.assertIn(WARNING_MSG, str(self.widget.Warning.load_warning))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 660,
                            "end_lineno": 675,
                            "parent": {
                                "file_name": "Orange/widgets/data/tests/test_owfile.py",
                                "type": "class",
                                "name": "TestOWFile",
                                "content": "class TestOWFile(WidgetTest):\n    # Attribute used to store event data so it does not get garbage\n    # collected before event is processed.\n    event_data = None\n\n    def setUp(self):\n        self.widget = self.create_widget(OWFile)  # type: OWFile\n        dataset_dirs.append(dirname(__file__))\n\n    def tearDown(self):\n        dataset_dirs.pop()\n\n    def test_dragEnterEvent_accepts_urls(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dragEnterEvent(event)\n        self.assertTrue(event.isAccepted())\n\n    def test_dragEnterEvent_skips_osx_file_references(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('/.file/id=12345'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def test_dragEnterEvent_skips_usupported_files(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('file.unsupported'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def _drag_enter_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n        return QDragEnterEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier)\n\n    def test_dropEvent_selects_file(self):\n        self.widget.load_data = Mock()\n        self.widget.source = OWFile.URL\n\n        event = self._drop_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dropEvent(event)\n\n        self.assertEqual(self.widget.source, OWFile.LOCAL_FILE)\n        self.assertTrue(path.samefile(self.widget.last_path(), TITANIC_PATH))\n        self.widget.load_data.assert_called_with()\n\n    def _drop_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n\n        return QDropEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier, QDropEvent.Drop)\n\n    def test_check_file_size(self):\n        self.assertFalse(self.widget.Warning.file_too_big.is_shown())\n        self.widget.SIZE_LIMIT = 4000\n        self.widget.__init__()\n        self.assertTrue(self.widget.Warning.file_too_big.is_shown())\n\n    def test_domain_changes_are_stored(self):\n        assert isinstance(self.widget, OWFile)\n\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n        self.open_dataset(\"zoo\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(data.name, \"zoo\")\n\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n    def test_rename_duplicates(self):\n        self.open_dataset(\"iris\")\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n        self.widget.domain_editor.model().setData(idx, \"iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"iris (1)\", data.domain)\n        self.assertIn(\"iris (2)\", data.domain)\n        self.assertTrue(self.widget.Warning.renamed_vars.is_shown())\n\n        self.widget.domain_editor.model().setData(idx, \"different iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n\n    def test_variable_name_change(self):\n        \"\"\"\n        Test whether the name of the variable is changed correctly by\n        the domaineditor.\n        \"\"\"\n        self.open_dataset(\"iris\")\n\n        # just rename\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"a\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"a\", data.domain)\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.widget.domain_editor.model().setData(idx, \"d\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"d\", data.domain)\n\n        # rename and change to text\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"b\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"b\", data.domain)\n        self.assertIsInstance(data.domain[\"b\"], StringVariable)\n\n        # rename and change to discrete\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(\n            idx, \"categorical\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], DiscreteVariable)\n\n        # rename and change to continuous\n        self.open_dataset(\"zoo\")\n        idx = self.widget.domain_editor.model().createIndex(0, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(0, 1)\n        self.widget.domain_editor.model().setData(idx, \"numeric\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], ContinuousVariable)\n\n    def open_dataset(self, name):\n        filename = FileFormat.locate(name, dataset_dirs)\n        self.widget.add_path(filename)\n        self.widget.load_data()\n\n    def test_no_last_path(self):\n        self.widget =\\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n        # Doesn't crash and contains a single item, (none).\n        self.assertEqual(self.widget.file_combo.count(), 1)\n\n    def test_file_not_found(self):\n        # Create a dummy file\n        file_name = \"test_owfile_data.tab\"\n        domainA = Domain([DiscreteVariable(\"d1\", values=(\"a\", \"b\"))],\n                         DiscreteVariable(\"c1\", values=(\"aaa\", \"bbb\")))\n        dataA = Table(domainA, np.array([[0], [1], [0], [np.nan]]),\n                      np.array([0, 1, 0, 1]))\n        dataA.save(file_name)\n\n        # Open the file with the widget\n        self.open_dataset(file_name)\n        self.assertEqual(self.get_output(self.widget.Outputs.data).domain, dataA.domain)\n\n        # Delete the file and try to reload it\n        remove(file_name)\n        self.widget.load_data()\n        self.assertEqual(file_name, path.basename(self.widget.last_path()))\n        self.assertTrue(self.widget.Error.file_not_found.is_shown())\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n        self.assertEqual(self.widget.infolabel.text(), \"No data.\")\n\n        # Open a sample dataset\n        self.open_dataset(\"iris\")\n        self.assertFalse(self.widget.Error.file_not_found.is_shown())\n\n    def test_nothing_selected(self):\n        # pylint: disable=protected-access\n        widget = self.widget = \\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n\n        widget.Outputs.data.send = Mock()\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n        widget.Outputs.data.send.reset_mock()\n        widget.source = widget.URL\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n    def test_check_column_noname(self):\n        \"\"\"\n        Column name cannot be changed to an empty string or a string with whitespaces.\n        GH-2039\n        \"\"\"\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(1, 0)\n        temp = self.widget.domain_editor.model().data(idx, Qt.DisplayRole)\n        self.widget.domain_editor.model().setData(idx, \"   \", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n        self.widget.domain_editor.model().setData(idx, \"\", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n\n    def test_invalid_role_mode(self):\n        self.open_dataset(\"iris\")\n        model = self.widget.domain_editor.model()\n        idx = model.createIndex(1, 0)\n        self.assertFalse(model.setData(idx, Qt.StatusTipRole, \"\"))\n        self.assertIsNone(model.data(idx, Qt.StatusTipRole))\n\n    def test_context_match_includes_variable_values(self):\n        file1 = \"\"\"\\\nvar\na b\n\na\n\"\"\"\n        file2 = \"\"\"\\\nvar\na b c\n\na\n\"\"\"\n        editor = self.widget.domain_editor\n        idx = self.widget.domain_editor.model().createIndex(0, 3)\n\n        with named_file(file1, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b\")\n\n        with named_file(file2, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b, c\")\n\n    def test_check_datetime_disabled(self):\n        \"\"\"\n        Datetime option is disable if numerical is disabled as well.\n        GH-2050 (code fixes)\n        GH-2120\n        \"\"\"\n        dat = \"\"\"\\\n            01.08.16\\t42.15\\tneumann\\t2017-02-20\n            03.08.16\\t16.08\\tneumann\\t2017-02-21\n            04.08.16\\t23.04\\tneumann\\t2017-02-22\n            03.09.16\\t48.84\\tturing\\t2017-02-23\n            02.02.17\\t23.16\\tturing\\t2017-02-24\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            domain_editor = self.widget.domain_editor\n            idx = lambda x: self.widget.domain_editor.model().createIndex(x, 1)\n\n            qcombobox = QComboBox()\n            combo = ComboDelegate(domain_editor,\n                                  VarTableModel.typenames).createEditor(qcombobox, None, idx(2))\n            vartype_delegate = VarTypeDelegate(domain_editor, VarTableModel.typenames)\n\n            vartype_delegate.setEditorData(combo, idx(2))\n            counts = [4, 2, 4, 2]\n            for i in range(4):\n                vartype_delegate.setEditorData(combo, idx(i))\n                self.assertEqual(combo.count(), counts[i])\n\n    def test_reader_custom_tab(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            qname = MyCustomTabReader.qualified_name()\n            reader = RecentPath(fn, None, None, file_format=qname)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [reader]})\n            self.widget.load_data()\n        self.assertFalse(self.widget.Error.missing_reader.is_shown())\n        outdata = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(outdata), 150)  # loaded iris\n\n    def test_no_reader_extension(self):\n        with named_file(\"\", suffix=\".xyz_unknown\") as fn:\n            no_reader = RecentPath(fn, None, None)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_reader]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_fail_sheets(self):\n        with named_file(\"\", suffix=\".failed_sheet\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Error.sheet_error.is_shown())\n\n    def test_with_warnings(self):\n        with named_file(\"\", suffix=\".with_warning\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Warning.load_warning.is_shown())\n\n    def test_fail(self):\n        with named_file(\"name\\nc\\n\\nstring\", suffix=\".tab\") as fn, \\\n                patch(\"Orange.widgets.data.owfile.log.exception\") as log:\n            self.open_dataset(fn)\n            log.assert_called()\n        self.assertTrue(self.widget.Error.unknown.is_shown())\n\n    def test_read_format(self):\n        iris = Table(\"iris\")\n\n        def open_iris_with_no_spec_format(_a, _b, _c, filters, _e):\n            return iris.__file__, filters.split(\";;\")[0]\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_no_spec_format):\n            self.widget.browse_file()\n\n        self.assertIsNone(self.widget.recent_paths[0].file_format)\n\n        def open_iris_with_tab(*_):\n            return iris.__file__, format_filter(TabReader)\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_tab):\n            self.widget.browse_file()\n\n        self.assertEqual(self.widget.recent_paths[0].file_format, \"Orange.data.io.TabReader\")\n\n    def test_no_specified_reader(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            no_class = RecentPath(fn, None, None, file_format=\"not.a.file.reader.class\")\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_class]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_domain_edit_no_changes(self):\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        # When no changes have been made in the domain editor,\n        # output data should be the same object (and not recreated)\n        self.assertTrue(data is self.widget.data)\n\n    def test_domain_edit_on_sparse_data(self):\n        iris = Table(\"iris\").to_sparse()\n\n        f = tempfile.NamedTemporaryFile(suffix='.pickle', delete=False)\n        pickle.dump(iris, f)\n        f.close()\n\n        self.widget.add_path(f.name)\n        self.widget.load_data()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(output, Table)\n        self.assertEqual(iris.X.shape, output.X.shape)\n        self.assertTrue(sp.issparse(output.X))\n\n    def test_drop_data_when_everything_skipped(self):\n        \"\"\"\n        No data when everything is skipped. Otherwise Select Rows crashes.\n        GH-2237\n        \"\"\"\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertTrue(len(data), 150)\n        self.assertTrue(len(data.domain), 5)\n        for i in range(5):\n            idx = self.widget.domain_editor.model().createIndex(i, 2)\n            self.widget.domain_editor.model().setData(idx, \"skip\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsNone(data)\n\n    def test_call_deprecated_dialog_formats(self):\n        with self.assertWarns(OrangeDeprecationWarning):\n            self.assertIn(\"Tab\", dialog_formats())\n\n    def test_add_new_format(self):\n        # test adding file formats after registering the widget\n        called = False\n        with named_file(\"\", suffix=\".tab\") as filename:\n            def test_format(_sd, _sf, ff, **_):\n                nonlocal called\n                called = True\n                self.assertIn(FailedSheetsFormat, ff)\n                return filename, TabReader, \"\"\n            with patch(\"Orange.widgets.data.owfile.open_filename_dialog\", test_format):\n                self.widget.browse_file()\n        self.assertTrue(called)\n\n    def test_domain_editor_conversions(self):\n        dat = \"\"\"V0\\tV1\\tV2\\tV3\\tV4\\tV5\\tV6\n                 c\\tc\\td\\td\\tc\\td\\td\n                  \\t \\t \\t \\t \\t \\t\n                 3.0\\t1.0\\t4\\ta\\t0.0\\tx\\t1.0\n                 1.0\\t2.0\\t4\\tb\\t0.0\\ty\\t2.0\n                 2.0\\t1.0\\t7\\ta\\t0.0\\ty\\t2.0\n                 0.0\\t2.0\\t7\\ta\\t0.0\\tz\\t2.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            data1 = self.get_output(self.widget.Outputs.data)\n            model = self.widget.domain_editor.model()\n            # check the ordering of attributes\n            for i, a in enumerate(data1.domain.attributes):\n                self.assertEqual(str(a), model.data(model.createIndex(i, 0), Qt.DisplayRole))\n            # make conversions\n            model.setData(model.createIndex(0, 1), \"categorical\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(2, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(3, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(6, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n            data2 = self.get_output(self.widget.Outputs.data)\n            # round continuous values should be converted to integers (3.0 -> 3, \"3\")\n            self.assertEqual(len(data2.domain.attributes[0].values[0]), 1)\n            self.assertEqual(len(data2[0].metas[0]), 1)\n            # discrete integer values should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][2].value), data2[0][1])\n            # discrete round floats should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][6].value), data2[0][5])\n\n    def test_domaineditor_continuous_to_string(self):\n        # GH 2744\n        dat = \"\"\"V0\\nc\\n\\n1.0\\nnan\\n3.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertSequenceEqual(data.metas.ravel().tolist(), ['1', '', '3'])\n\n    def test_domaineditor_makes_variables(self):\n        # Variables created with domain editor should be interchangeable\n        # with variables read from file.\n\n        dat = \"\"\"V0\\tV1\\nc\\td\\n\\n1.0\\t2\"\"\"\n        v0 = StringVariable.make(\"V0\")\n        v1 = ContinuousVariable.make(\"V1\")\n\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertEqual(data.domain[\"V0\"], v0)\n            self.assertEqual(data.domain[\"V1\"], v1)\n\n    def test_url_no_scheme(self):\n        mock_urlreader = Mock(side_effect=ValueError())\n        url = 'foo.bar/xxx.csv'\n\n        with patch('Orange.widgets.data.owfile.UrlReader', mock_urlreader):\n            self.widget.url_combo.insertItem(0, url)\n            self.widget.url_combo.activated.emit(0)\n\n        mock_urlreader.assert_called_once_with('http://' + url)\n\n    def test_adds_origin(self):\n        self.open_dataset(\"origin1/images\")\n        data1 = self.get_output(self.widget.Outputs.data)\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n        self.open_dataset(\"origin2/images\")\n        data2 = self.get_output(self.widget.Outputs.data)\n        attrs = data2.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin2\", attrs[\"origin\"])\n\n        # Make sure that variable in data1 still contains correct origin\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n    def test_summary(self):\n        \"\"\"Check if the status bar is updated when data is received\"\"\"\n        output_sum = self.widget.info.set_output_summary = Mock()\n        self.open_dataset(\"iris\")\n        output = self.get_output(self.widget.Outputs.data)\n        output_sum.assert_called_with(len(output),\n                                      format_summary_details(output))\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_open_moved_workflow(self):\n        \"\"\"Test opening workflow that has been moved to another location\n        (i.e. sent by email), considering data file is stored in the same\n        directory as the workflow.\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n            self.assertEqual(w.file_combo.count(), 1)\n            self.assertFalse(w.Error.file_not_found.is_shown())\n        finally:\n            remove(file_name)\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_files_relocated(self):\n        \"\"\"\n        This test testes if paths are relocated correctly\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n\n            # relocation is called already\n            # if it works correctly relative path should be same than base name\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n\n            w.workflowEnvChanged(\"basedir\", base_name, base_name)\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n        finally:\n            remove(file_name)\n\n    def test_sheets(self):\n        # pylint: disable=protected-access\n        widget = self.widget\n        combo = widget.sheet_combo\n        widget.last_path = \\\n            lambda: path.join(path.dirname(__file__), '..', \"..\", '..',\n                              'tests', 'xlsx_files', 'header_0_sheet.xlsx')\n        widget._try_load()\n        widget.reader.sheet = \"my_sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.itemText(0), \"Sheet1\")\n        self.assertEqual(combo.itemText(1), \"my_sheet\")\n        self.assertEqual(combo.itemText(2), \"Sheet3\")\n        self.assertEqual(combo.currentIndex(), 1)\n\n        widget.reader.sheet = \"no such sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.currentIndex(), 0)\n\n    @patch(\"os.path.exists\", new=lambda _: True)\n    def test_warning_from_another_thread(self):\n        class AnotherWidget(QObject):\n            # This must be a method, not a staticmethod to run in the thread\n            def issue_warning(self):  # pylint: disable=no-self-use\n                time.sleep(0.1)\n                warnings.warn(\"warning from another thread\")\n                warning_thread.quit()\n\n        def read():\n            warning_thread.start()\n            time.sleep(0.2)\n            return Table(TITANIC_PATH)\n\n        warning_thread = QThread()\n        another_widget = AnotherWidget()\n        another_widget.moveToThread(warning_thread)\n        warning_thread.started.connect(another_widget.issue_warning)\n\n        reader = Mock()\n        reader.read = read\n        self.widget._get_reader = lambda: reader\n        self.widget.last_path = lambda: \"foo\"\n        self.widget._update_sheet_combo = Mock()\n\n        # Warning must be caught by unit tests, but not the widget\n        with self.assertWarns(UserWarning):\n            self.widget._try_load()\n            self.assertFalse(self.widget.Warning.load_warning.is_shown())\n\n\n    @patch(\"os.path.exists\", new=lambda _: True)\n    def test_warning_from_this_thread(self):\n        WARNING_MSG = \"warning from this thread\"\n\n        def read():\n            warnings.warn(WARNING_MSG)\n            return Table(TITANIC_PATH)\n\n        reader = Mock()\n        reader.read = read\n        self.widget._get_reader = lambda: reader\n        self.widget.last_path = lambda: \"foo\"\n        self.widget._update_sheet_combo = Mock()\n\n        self.widget._try_load()\n        self.assertTrue(self.widget.Warning.load_warning.is_shown())\n        self.assertIn(WARNING_MSG, str(self.widget.Warning.load_warning))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 68,
                                "end_lineno": 675,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "efd8e00095e8af065248c9182022c1cd5f2ee489^",
    "new_commit_hash": "efd8e00095e8af065248c9182022c1cd5f2ee489",
    "commit_message": "File: Prevent showing warnings from other threads",
    "commit_date": "2021-02-26T14:13:37+01:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "efd8e00095e8af065248c9182022c1cd5f2ee489",
    "test_file_codes": [
        "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring,protected-access\nfrom os import path, remove, getcwd\nfrom os.path import dirname\nimport unittest\nfrom unittest.mock import Mock, patch\nimport pickle\nimport tempfile\nimport warnings\nimport time\n\nimport numpy as np\nimport scipy.sparse as sp\n\nfrom AnyQt.QtCore import QMimeData, QPoint, Qt, QUrl, QThread, QObject\nfrom AnyQt.QtGui import QDragEnterEvent, QDropEvent\nfrom AnyQt.QtWidgets import QComboBox\n\nimport Orange\n\nfrom Orange.data import FileFormat, dataset_dirs, StringVariable, Table, \\\n    Domain, DiscreteVariable, ContinuousVariable\nfrom Orange.util import OrangeDeprecationWarning\n\nfrom Orange.data.io import TabReader\nfrom Orange.tests import named_file\nfrom Orange.widgets.data.owfile import OWFile\nfrom Orange.widgets.utils.filedialogs import dialog_formats, format_filter, RecentPath\nfrom Orange.widgets.utils.state_summary import format_summary_details\nfrom Orange.widgets.tests.base import WidgetTest\nfrom Orange.widgets.utils.domaineditor import ComboDelegate, VarTypeDelegate, VarTableModel\n\nTITANIC_PATH = path.join(path.dirname(Orange.__file__), 'datasets', 'titanic.tab')\norig_path_exists = path.exists\n\n\nclass FailedSheetsFormat(FileFormat):\n    EXTENSIONS = ('.failed_sheet',)\n    DESCRIPTION = \"Make a sheet function that fails\"\n\n    def read(self):\n        pass\n\n    def sheets(self):\n        raise Exception(\"Not working\")\n\n\nclass WithWarnings(FileFormat):\n    EXTENSIONS = ('.with_warning',)\n    DESCRIPTION = \"Warning\"\n\n    @staticmethod\n    def read():\n        warnings.warn(\"Some warning\")\n        return Orange.data.Table(\"iris\")\n\n\nclass MyCustomTabReader(FileFormat):\n    EXTENSIONS = ('.tab',)\n    DESCRIPTION = \"Always return iris\"\n    PRIORITY = 999999\n\n    @staticmethod\n    def read():\n        return Orange.data.Table(\"iris\")\n\n\nclass TestOWFile(WidgetTest):\n    # Attribute used to store event data so it does not get garbage\n    # collected before event is processed.\n    event_data = None\n\n    def setUp(self):\n        self.widget = self.create_widget(OWFile)  # type: OWFile\n        dataset_dirs.append(dirname(__file__))\n\n    def tearDown(self):\n        dataset_dirs.pop()\n\n    def test_dragEnterEvent_accepts_urls(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dragEnterEvent(event)\n        self.assertTrue(event.isAccepted())\n\n    def test_dragEnterEvent_skips_osx_file_references(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('/.file/id=12345'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def test_dragEnterEvent_skips_usupported_files(self):\n        event = self._drag_enter_event(QUrl.fromLocalFile('file.unsupported'))\n        self.widget.dragEnterEvent(event)\n        self.assertFalse(event.isAccepted())\n\n    def _drag_enter_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n        return QDragEnterEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier)\n\n    def test_dropEvent_selects_file(self):\n        self.widget.load_data = Mock()\n        self.widget.source = OWFile.URL\n\n        event = self._drop_event(QUrl.fromLocalFile(TITANIC_PATH))\n        self.widget.dropEvent(event)\n\n        self.assertEqual(self.widget.source, OWFile.LOCAL_FILE)\n        self.assertTrue(path.samefile(self.widget.last_path(), TITANIC_PATH))\n        self.widget.load_data.assert_called_with()\n\n    def _drop_event(self, url):\n        # make sure data does not get garbage collected before it used\n        self.event_data = data = QMimeData()\n        data.setUrls([QUrl(url)])\n\n        return QDropEvent(\n            QPoint(0, 0), Qt.MoveAction, data,\n            Qt.NoButton, Qt.NoModifier, QDropEvent.Drop)\n\n    def test_check_file_size(self):\n        self.assertFalse(self.widget.Warning.file_too_big.is_shown())\n        self.widget.SIZE_LIMIT = 4000\n        self.widget.__init__()\n        self.assertTrue(self.widget.Warning.file_too_big.is_shown())\n\n    def test_domain_changes_are_stored(self):\n        assert isinstance(self.widget, OWFile)\n\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n        self.open_dataset(\"zoo\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(data.name, \"zoo\")\n\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(data.domain[\"iris\"], StringVariable)\n\n    def test_rename_duplicates(self):\n        self.open_dataset(\"iris\")\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n        self.widget.domain_editor.model().setData(idx, \"iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"iris (1)\", data.domain)\n        self.assertIn(\"iris (2)\", data.domain)\n        self.assertTrue(self.widget.Warning.renamed_vars.is_shown())\n\n        self.widget.domain_editor.model().setData(idx, \"different iris\", Qt.EditRole)\n        self.widget.apply_button.click()\n        self.assertFalse(self.widget.Warning.renamed_vars.is_shown())\n\n    def test_variable_name_change(self):\n        \"\"\"\n        Test whether the name of the variable is changed correctly by\n        the domaineditor.\n        \"\"\"\n        self.open_dataset(\"iris\")\n\n        # just rename\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"a\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"a\", data.domain)\n\n        idx = self.widget.domain_editor.model().createIndex(3, 0)\n        self.widget.domain_editor.model().setData(idx, \"d\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"d\", data.domain)\n\n        # rename and change to text\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"b\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(idx, \"text\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"b\", data.domain)\n        self.assertIsInstance(data.domain[\"b\"], StringVariable)\n\n        # rename and change to discrete\n        idx = self.widget.domain_editor.model().createIndex(4, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(4, 1)\n        self.widget.domain_editor.model().setData(\n            idx, \"categorical\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], DiscreteVariable)\n\n        # rename and change to continuous\n        self.open_dataset(\"zoo\")\n        idx = self.widget.domain_editor.model().createIndex(0, 0)\n        self.widget.domain_editor.model().setData(idx, \"c\", Qt.EditRole)\n        idx = self.widget.domain_editor.model().createIndex(0, 1)\n        self.widget.domain_editor.model().setData(idx, \"numeric\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIn(\"c\", data.domain)\n        self.assertIsInstance(data.domain[\"c\"], ContinuousVariable)\n\n    def open_dataset(self, name):\n        filename = FileFormat.locate(name, dataset_dirs)\n        self.widget.add_path(filename)\n        self.widget.load_data()\n\n    def test_no_last_path(self):\n        self.widget =\\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n        # Doesn't crash and contains a single item, (none).\n        self.assertEqual(self.widget.file_combo.count(), 1)\n\n    def test_file_not_found(self):\n        # Create a dummy file\n        file_name = \"test_owfile_data.tab\"\n        domainA = Domain([DiscreteVariable(\"d1\", values=(\"a\", \"b\"))],\n                         DiscreteVariable(\"c1\", values=(\"aaa\", \"bbb\")))\n        dataA = Table(domainA, np.array([[0], [1], [0], [np.nan]]),\n                      np.array([0, 1, 0, 1]))\n        dataA.save(file_name)\n\n        # Open the file with the widget\n        self.open_dataset(file_name)\n        self.assertEqual(self.get_output(self.widget.Outputs.data).domain, dataA.domain)\n\n        # Delete the file and try to reload it\n        remove(file_name)\n        self.widget.load_data()\n        self.assertEqual(file_name, path.basename(self.widget.last_path()))\n        self.assertTrue(self.widget.Error.file_not_found.is_shown())\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n        self.assertEqual(self.widget.infolabel.text(), \"No data.\")\n\n        # Open a sample dataset\n        self.open_dataset(\"iris\")\n        self.assertFalse(self.widget.Error.file_not_found.is_shown())\n\n    def test_nothing_selected(self):\n        # pylint: disable=protected-access\n        widget = self.widget = \\\n            self.create_widget(OWFile, stored_settings={\"recent_paths\": []})\n\n        widget.Outputs.data.send = Mock()\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n        widget.Outputs.data.send.reset_mock()\n        widget.source = widget.URL\n        widget._try_load()\n        widget.Outputs.data.send.assert_called_with(None)\n\n    def test_check_column_noname(self):\n        \"\"\"\n        Column name cannot be changed to an empty string or a string with whitespaces.\n        GH-2039\n        \"\"\"\n        self.open_dataset(\"iris\")\n        idx = self.widget.domain_editor.model().createIndex(1, 0)\n        temp = self.widget.domain_editor.model().data(idx, Qt.DisplayRole)\n        self.widget.domain_editor.model().setData(idx, \"   \", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n        self.widget.domain_editor.model().setData(idx, \"\", Qt.EditRole)\n        self.assertEqual(self.widget.domain_editor.model().data(idx, Qt.DisplayRole), temp)\n\n    def test_invalid_role_mode(self):\n        self.open_dataset(\"iris\")\n        model = self.widget.domain_editor.model()\n        idx = model.createIndex(1, 0)\n        self.assertFalse(model.setData(idx, Qt.StatusTipRole, \"\"))\n        self.assertIsNone(model.data(idx, Qt.StatusTipRole))\n\n    def test_context_match_includes_variable_values(self):\n        file1 = \"\"\"\\\nvar\na b\n\na\n\"\"\"\n        file2 = \"\"\"\\\nvar\na b c\n\na\n\"\"\"\n        editor = self.widget.domain_editor\n        idx = self.widget.domain_editor.model().createIndex(0, 3)\n\n        with named_file(file1, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b\")\n\n        with named_file(file2, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            self.assertEqual(editor.model().data(idx, Qt.DisplayRole), \"a, b, c\")\n\n    def test_check_datetime_disabled(self):\n        \"\"\"\n        Datetime option is disable if numerical is disabled as well.\n        GH-2050 (code fixes)\n        GH-2120\n        \"\"\"\n        dat = \"\"\"\\\n            01.08.16\\t42.15\\tneumann\\t2017-02-20\n            03.08.16\\t16.08\\tneumann\\t2017-02-21\n            04.08.16\\t23.04\\tneumann\\t2017-02-22\n            03.09.16\\t48.84\\tturing\\t2017-02-23\n            02.02.17\\t23.16\\tturing\\t2017-02-24\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            domain_editor = self.widget.domain_editor\n            idx = lambda x: self.widget.domain_editor.model().createIndex(x, 1)\n\n            qcombobox = QComboBox()\n            combo = ComboDelegate(domain_editor,\n                                  VarTableModel.typenames).createEditor(qcombobox, None, idx(2))\n            vartype_delegate = VarTypeDelegate(domain_editor, VarTableModel.typenames)\n\n            vartype_delegate.setEditorData(combo, idx(2))\n            counts = [4, 2, 4, 2]\n            for i in range(4):\n                vartype_delegate.setEditorData(combo, idx(i))\n                self.assertEqual(combo.count(), counts[i])\n\n    def test_reader_custom_tab(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            qname = MyCustomTabReader.qualified_name()\n            reader = RecentPath(fn, None, None, file_format=qname)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [reader]})\n            self.widget.load_data()\n        self.assertFalse(self.widget.Error.missing_reader.is_shown())\n        outdata = self.get_output(self.widget.Outputs.data)\n        self.assertEqual(len(outdata), 150)  # loaded iris\n\n    def test_no_reader_extension(self):\n        with named_file(\"\", suffix=\".xyz_unknown\") as fn:\n            no_reader = RecentPath(fn, None, None)\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_reader]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_fail_sheets(self):\n        with named_file(\"\", suffix=\".failed_sheet\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Error.sheet_error.is_shown())\n\n    def test_with_warnings(self):\n        with named_file(\"\", suffix=\".with_warning\") as fn:\n            self.open_dataset(fn)\n        self.assertTrue(self.widget.Warning.load_warning.is_shown())\n\n    def test_fail(self):\n        with named_file(\"name\\nc\\n\\nstring\", suffix=\".tab\") as fn, \\\n                patch(\"Orange.widgets.data.owfile.log.exception\") as log:\n            self.open_dataset(fn)\n            log.assert_called()\n        self.assertTrue(self.widget.Error.unknown.is_shown())\n\n    def test_read_format(self):\n        iris = Table(\"iris\")\n\n        def open_iris_with_no_spec_format(_a, _b, _c, filters, _e):\n            return iris.__file__, filters.split(\";;\")[0]\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_no_spec_format):\n            self.widget.browse_file()\n\n        self.assertIsNone(self.widget.recent_paths[0].file_format)\n\n        def open_iris_with_tab(*_):\n            return iris.__file__, format_filter(TabReader)\n\n        with patch(\"AnyQt.QtWidgets.QFileDialog.getOpenFileName\",\n                   open_iris_with_tab):\n            self.widget.browse_file()\n\n        self.assertEqual(self.widget.recent_paths[0].file_format, \"Orange.data.io.TabReader\")\n\n    def test_no_specified_reader(self):\n        with named_file(\"\", suffix=\".tab\") as fn:\n            no_class = RecentPath(fn, None, None, file_format=\"not.a.file.reader.class\")\n            self.widget = self.create_widget(OWFile,\n                                             stored_settings={\"recent_paths\": [no_class]})\n            self.widget.load_data()\n        self.assertTrue(self.widget.Error.missing_reader.is_shown())\n\n    def test_domain_edit_no_changes(self):\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        # When no changes have been made in the domain editor,\n        # output data should be the same object (and not recreated)\n        self.assertTrue(data is self.widget.data)\n\n    def test_domain_edit_on_sparse_data(self):\n        iris = Table(\"iris\").to_sparse()\n\n        f = tempfile.NamedTemporaryFile(suffix='.pickle', delete=False)\n        pickle.dump(iris, f)\n        f.close()\n\n        self.widget.add_path(f.name)\n        self.widget.load_data()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIsInstance(output, Table)\n        self.assertEqual(iris.X.shape, output.X.shape)\n        self.assertTrue(sp.issparse(output.X))\n\n    def test_drop_data_when_everything_skipped(self):\n        \"\"\"\n        No data when everything is skipped. Otherwise Select Rows crashes.\n        GH-2237\n        \"\"\"\n        self.open_dataset(\"iris\")\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertTrue(len(data), 150)\n        self.assertTrue(len(data.domain), 5)\n        for i in range(5):\n            idx = self.widget.domain_editor.model().createIndex(i, 2)\n            self.widget.domain_editor.model().setData(idx, \"skip\", Qt.EditRole)\n        self.widget.apply_button.click()\n        data = self.get_output(self.widget.Outputs.data)\n        self.assertIsNone(data)\n\n    def test_call_deprecated_dialog_formats(self):\n        with self.assertWarns(OrangeDeprecationWarning):\n            self.assertIn(\"Tab\", dialog_formats())\n\n    def test_add_new_format(self):\n        # test adding file formats after registering the widget\n        called = False\n        with named_file(\"\", suffix=\".tab\") as filename:\n            def test_format(_sd, _sf, ff, **_):\n                nonlocal called\n                called = True\n                self.assertIn(FailedSheetsFormat, ff)\n                return filename, TabReader, \"\"\n            with patch(\"Orange.widgets.data.owfile.open_filename_dialog\", test_format):\n                self.widget.browse_file()\n        self.assertTrue(called)\n\n    def test_domain_editor_conversions(self):\n        dat = \"\"\"V0\\tV1\\tV2\\tV3\\tV4\\tV5\\tV6\n                 c\\tc\\td\\td\\tc\\td\\td\n                  \\t \\t \\t \\t \\t \\t\n                 3.0\\t1.0\\t4\\ta\\t0.0\\tx\\t1.0\n                 1.0\\t2.0\\t4\\tb\\t0.0\\ty\\t2.0\n                 2.0\\t1.0\\t7\\ta\\t0.0\\ty\\t2.0\n                 0.0\\t2.0\\t7\\ta\\t0.0\\tz\\t2.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n            data1 = self.get_output(self.widget.Outputs.data)\n            model = self.widget.domain_editor.model()\n            # check the ordering of attributes\n            for i, a in enumerate(data1.domain.attributes):\n                self.assertEqual(str(a), model.data(model.createIndex(i, 0), Qt.DisplayRole))\n            # make conversions\n            model.setData(model.createIndex(0, 1), \"categorical\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(2, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(3, 1), \"numeric\", Qt.EditRole)\n            model.setData(model.createIndex(6, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n            data2 = self.get_output(self.widget.Outputs.data)\n            # round continuous values should be converted to integers (3.0 -> 3, \"3\")\n            self.assertEqual(len(data2.domain.attributes[0].values[0]), 1)\n            self.assertEqual(len(data2[0].metas[0]), 1)\n            # discrete integer values should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][2].value), data2[0][1])\n            # discrete round floats should stay the same after conversion to continuous\n            self.assertAlmostEqual(float(data1[0][6].value), data2[0][5])\n\n    def test_domaineditor_continuous_to_string(self):\n        # GH 2744\n        dat = \"\"\"V0\\nc\\n\\n1.0\\nnan\\n3.0\"\"\"\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertSequenceEqual(data.metas.ravel().tolist(), ['1', '', '3'])\n\n    def test_domaineditor_makes_variables(self):\n        # Variables created with domain editor should be interchangeable\n        # with variables read from file.\n\n        dat = \"\"\"V0\\tV1\\nc\\td\\n\\n1.0\\t2\"\"\"\n        v0 = StringVariable.make(\"V0\")\n        v1 = ContinuousVariable.make(\"V1\")\n\n        with named_file(dat, suffix=\".tab\") as filename:\n            self.open_dataset(filename)\n\n            model = self.widget.domain_editor.model()\n            model.setData(model.createIndex(0, 1), \"text\", Qt.EditRole)\n            model.setData(model.createIndex(1, 1), \"numeric\", Qt.EditRole)\n            self.widget.apply_button.click()\n\n            data = self.get_output(self.widget.Outputs.data)\n            self.assertEqual(data.domain[\"V0\"], v0)\n            self.assertEqual(data.domain[\"V1\"], v1)\n\n    def test_url_no_scheme(self):\n        mock_urlreader = Mock(side_effect=ValueError())\n        url = 'foo.bar/xxx.csv'\n\n        with patch('Orange.widgets.data.owfile.UrlReader', mock_urlreader):\n            self.widget.url_combo.insertItem(0, url)\n            self.widget.url_combo.activated.emit(0)\n\n        mock_urlreader.assert_called_once_with('http://' + url)\n\n    def test_adds_origin(self):\n        self.open_dataset(\"origin1/images\")\n        data1 = self.get_output(self.widget.Outputs.data)\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n        self.open_dataset(\"origin2/images\")\n        data2 = self.get_output(self.widget.Outputs.data)\n        attrs = data2.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin2\", attrs[\"origin\"])\n\n        # Make sure that variable in data1 still contains correct origin\n        attrs = data1.domain[\"image\"].attributes\n        self.assertIn(\"origin\", attrs)\n        self.assertIn(\"origin1\", attrs[\"origin\"])\n\n    def test_summary(self):\n        \"\"\"Check if the status bar is updated when data is received\"\"\"\n        output_sum = self.widget.info.set_output_summary = Mock()\n        self.open_dataset(\"iris\")\n        output = self.get_output(self.widget.Outputs.data)\n        output_sum.assert_called_with(len(output),\n                                      format_summary_details(output))\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_open_moved_workflow(self):\n        \"\"\"Test opening workflow that has been moved to another location\n        (i.e. sent by email), considering data file is stored in the same\n        directory as the workflow.\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n            self.assertEqual(w.file_combo.count(), 1)\n            self.assertFalse(w.Error.file_not_found.is_shown())\n        finally:\n            remove(file_name)\n\n    @patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n           Mock(return_value={\"basedir\": getcwd()}))\n    def test_files_relocated(self):\n        \"\"\"\n        This test testes if paths are relocated correctly\n        \"\"\"\n        temp_file = tempfile.NamedTemporaryFile(dir=getcwd(), delete=False)\n        file_name = temp_file.name\n        temp_file.close()\n        base_name = path.basename(file_name)\n        try:\n            recent_path = RecentPath(\n                path.join(\"temp/datasets\", base_name), \"\",\n                path.join(\"datasets\", base_name)\n            )\n            stored_settings = {\"recent_paths\": [recent_path]}\n            w = self.create_widget(OWFile, stored_settings=stored_settings)\n            w.load_data()\n\n            # relocation is called already\n            # if it works correctly relative path should be same than base name\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n\n            w.workflowEnvChanged(\"basedir\", base_name, base_name)\n            self.assertEqual(w.recent_paths[0].relpath, base_name)\n        finally:\n            remove(file_name)\n\n    def test_sheets(self):\n        # pylint: disable=protected-access\n        widget = self.widget\n        combo = widget.sheet_combo\n        widget.last_path = \\\n            lambda: path.join(path.dirname(__file__), '..', \"..\", '..',\n                              'tests', 'xlsx_files', 'header_0_sheet.xlsx')\n        widget._try_load()\n        widget.reader.sheet = \"my_sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.itemText(0), \"Sheet1\")\n        self.assertEqual(combo.itemText(1), \"my_sheet\")\n        self.assertEqual(combo.itemText(2), \"Sheet3\")\n        self.assertEqual(combo.currentIndex(), 1)\n\n        widget.reader.sheet = \"no such sheet\"\n        widget._select_active_sheet()\n        self.assertEqual(combo.currentIndex(), 0)\n\n    @patch(\"os.path.exists\", new=lambda _: True)\n    def test_warning_from_another_thread(self):\n        class AnotherWidget(QObject):\n            # This must be a method, not a staticmethod to run in the thread\n            def issue_warning(self):  # pylint: disable=no-self-use\n                time.sleep(0.1)\n                warnings.warn(\"warning from another thread\")\n                warning_thread.quit()\n\n        def read():\n            warning_thread.start()\n            time.sleep(0.2)\n            return Table(TITANIC_PATH)\n\n        warning_thread = QThread()\n        another_widget = AnotherWidget()\n        another_widget.moveToThread(warning_thread)\n        warning_thread.started.connect(another_widget.issue_warning)\n\n        reader = Mock()\n        reader.read = read\n        self.widget._get_reader = lambda: reader\n        self.widget.last_path = lambda: \"foo\"\n        self.widget._update_sheet_combo = Mock()\n\n        # Warning must be caught by unit tests, but not the widget\n        with self.assertWarns(UserWarning):\n            self.widget._try_load()\n            self.assertFalse(self.widget.Warning.load_warning.is_shown())\n\n\n    @patch(\"os.path.exists\", new=lambda _: True)\n    def test_warning_from_this_thread(self):\n        WARNING_MSG = \"warning from this thread\"\n\n        def read():\n            warnings.warn(WARNING_MSG)\n            return Table(TITANIC_PATH)\n\n        reader = Mock()\n        reader.read = read\n        self.widget._get_reader = lambda: reader\n        self.widget.last_path = lambda: \"foo\"\n        self.widget._update_sheet_combo = Mock()\n\n        self.widget._try_load()\n        self.assertTrue(self.widget.Warning.load_warning.is_shown())\n        self.assertIn(WARNING_MSG, str(self.widget.Warning.load_warning))\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n"
    ],
    "test_file_names": [
        "test_1.py"
    ],
    "setup_res_code": 0,
    "setup_res_stdout": "Starting Orange installation attempts...\nAttempting installation with Python 3.7...\nrunning build_ext\nCompiling Orange/classification/_tree_scorers.pyx because it changed.\nCompiling Orange/data/_contingency.pyx because it changed.\nCompiling Orange/data/_io.pyx because it changed.\nCompiling Orange/data/_valuecount.pyx because it changed.\nCompiling Orange/data/_variable.pyx because it changed.\nCompiling Orange/distance/_distance.pyx because it changed.\nCompiling Orange/preprocess/_discretize.pyx because it changed.\nCompiling Orange/preprocess/_relieff.pyx because it changed.\nCompiling Orange/projection/_som.pyx because it changed.\n[1/9] Cythonizing Orange/classification/_tree_scorers.pyx\n[2/9] Cythonizing Orange/data/_contingency.pyx\n[3/9] Cythonizing Orange/data/_io.pyx\n[4/9] Cythonizing Orange/data/_valuecount.pyx\n[5/9] Cythonizing Orange/data/_variable.pyx\n[6/9] Cythonizing Orange/distance/_distance.pyx\n[7/9] Cythonizing Orange/preprocess/_discretize.pyx\n[8/9] Cythonizing Orange/preprocess/_relieff.pyx\n[9/9] Cythonizing Orange/projection/_som.pyx\nbuilding 'Orange.classification._tree_scorers' extension\ncreating build\ncreating build/temp.linux-x86_64-3.7\ncreating build/temp.linux-x86_64-3.7/Orange\ncreating build/temp.linux-x86_64-3.7/Orange/classification\ncc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.28.0.dev0+efd8e00 to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489\nProcessing dependencies for Orange3==3.28.0.dev0+efd8e00\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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages\nSearching for pyqtgraph==0.12.4\nBest match: pyqtgraph 0.12.4\nAdding pyqtgraph 0.12.4 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages\nSearching for httpx==0.16.1\nBest match: httpx 0.16.1\nAdding httpx 0.16.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\nInstalling pyrcc5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\nInstalling pyuic5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages\nSearching for httpcore==0.12.3\nBest match: httpcore 0.12.3\nAdding httpcore 0.12.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages\nSearching for rfc3986==1.5.0\nBest match: rfc3986 1.5.0\nAdding rfc3986 1.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.28.0.dev0+efd8e00\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 149ms\nPrepared 18 packages in 1ms\nInstalled 18 packages in 110ms\n + cython==0.29.37\n + exceptiongroup==1.2.2\n + importlib-metadata==6.7.0\n + iniconfig==2.0.0\n + numpy==1.17.5\n + packaging==24.0\n + pluggy==1.2.0\n + pyqt5==5.15.10\n + pyqt5-qt5==5.15.16\n + pyqt5-sip==12.13.0\n + pyqtwebengine==5.15.6\n + pyqtwebengine-qt5==5.15.16\n + pytest==7.4.4\n + setuptools==59.8.0\n + tomli==2.0.1\n + typing-extensions==4.7.1\n + wheel==0.42.0\n + zipp==3.15.0\nResolved 53 packages in 279ms\nInstalled 47 packages in 412ms\n + baycomp==1.0.3\n + bottleneck==1.4.0\n + certifi==2024.12.14\n + cffi==1.15.1\n + chardet==5.2.0\n + charset-normalizer==3.4.1\n + cryptography==44.0.0\n + cycler==0.11.0\n + et-xmlfile==1.1.0\n + fonttools==4.38.0\n + h11==0.14.0\n + httpcore==0.12.3\n + httpx==0.16.1\n + idna==3.10\n + importlib-resources==5.12.0\n + jaraco-classes==3.2.3\n + jeepney==0.8.0\n + joblib==1.3.2\n + keyring==24.1.1\n + keyrings-alt==4.2.0\n + kiwisolver==1.4.5\n + matplotlib==3.5.3\n + more-itertools==9.1.0\n + networkx==2.6.3\n + openpyxl==3.1.3\n + opentsne==1.0.1\n + pandas==1.3.5\n + pillow==9.5.0\n + pip==24.0\n + pycparser==2.21\n + pyparsing==3.1.4\n + python-dateutil==2.9.0.post0\n + python-louvain==0.16\n + pytz==2024.2\n + pyyaml==6.0.1\n + requests==2.31.0\n + rfc3986==1.5.0\n + scikit-learn==1.0.2\n + scipy==1.7.3\n + secretstorage==3.3.3\n + serverfiles==0.3.1\n + six==1.17.0\n + sniffio==1.3.1\n + threadpoolctl==3.1.0\n + urllib3==2.0.7\n + xlrd==2.0.1\n + xlsxwriter==3.2.0\nResolved 39 packages in 110ms\nInstalled 13 packages in 251ms\n + anyqt==0.2.0\n + attrs==24.2.0\n + cattrs==23.1.2\n + commonmark==0.9.1\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + orange-canvas-core==0.1.35\n + orange-widget-base==4.22.0\n + platformdirs==4.0.0\n + pyqtgraph==0.12.4\n + qasync==0.25.0\n + requests-cache==1.1.1\n + url-normalize==1.4.3\nResolved 2 packages in 3ms\nInstalled 2 packages in 32ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nResolved 19 packages in 84ms\nInstalled 5 packages in 1.65s\n + catboost==1.2.7\n + graphviz==0.20.1\n + plotly==5.18.0\n + tenacity==8.2.3\n + xgboost==1.6.2\nAudited 2 packages in 1ms\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning \"Using deprecated NumPy API, disable it with \" \"#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION\" [-Wcpp]\n   17 | #warning \"Using deprecated NumPy API, disable it with \" \\\n      |  ^~~~~~~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_2find_threshold_entropy’:\nOrange/classification/_tree_scorers.c:3413:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 3413 |   __pyx_t_7 = ((__pyx_v_N <= __pyx_v_min_leaf) != 0);\n      |                           ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_6find_threshold_MSE’:\nOrange/classification/_tree_scorers.c:4869:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 4869 |   __pyx_t_1 = ((__pyx_v_N <= __pyx_v_min_leaf) != 0);\n      |                           ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_8find_binarization_MSE’:\nOrange/classification/_tree_scorers.c:5615:43: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5615 |           for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) {\n      |                                           ^\nOrange/classification/_tree_scorers.c:5736:39: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5736 |           __pyx_t_20 = ((__pyx_v_left >= __pyx_v_min_leaf) != 0);\n      |                                       ^~\nOrange/classification/_tree_scorers.c:5742:53: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5742 |           __pyx_t_20 = (((__pyx_v_N - __pyx_v_left) >= __pyx_v_min_leaf) != 0);\n      |                                                     ^~\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_14compute_predictions_csr’:\nOrange/classification/_tree_scorers.c:7202:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7202 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c: In function ‘__pyx_pf_6Orange_14classification_13_tree_scorers_16compute_predictions_csc’:\nOrange/classification/_tree_scorers.c:7857:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7857 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c:7917:143: warning: comparison of integer expressions of different signedness: ‘__pyx_t_5numpy_int32_t’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]\n 7917 |               __pyx_t_15 = (((*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_14 * __pyx_v_indices.strides[0]) ))) != __pyx_v_i) != 0);\n      |                                                                                                                                               ^~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.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_efd8e00095e8af065248c9182022c1cd5f2ee489/.venv/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.\n  setuptools.SetuptoolsDeprecationWarning,\nwarning: no files found matching 'README*' under directory 'Orange'\nwarning: no files found matching 'LICENSE' under directory 'Orange'\nwarning: no files found matching '*.basket' under directory 'Orange/datasets'\nwarning: no files found matching '*.js' under directory 'Orange/widgets'\nwarning: no files found matching '*.css' under directory 'Orange/widgets'\nwarning: no files found matching '*.html' under directory 'Orange/widgets'\nwarning: no files found matching 'COPYING'\n",
    "new_commit_res_code": 1,
    "new_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489\ncollected 44 items\n\nr2e_tests/test_1.py sss.F......................F.........F....FF         [100%]\n\n=================================== FAILURES ===================================\n_________________________ TestOWFile.test_adds_origin __________________________\n\nself = <r2e_tests.test_1.TestOWFile testMethod=test_adds_origin>\n\n    def test_adds_origin(self):\n>       self.open_dataset(\"origin1/images\")\n\nr2e_tests/test_1.py:532: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \nr2e_tests/test_1.py:216: in open_dataset\n    filename = FileFormat.locate(name, dataset_dirs)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\ncls = <class 'Orange.data.io.FileFormat'>, filename = 'origin1/images'\nsearch_dirs = ['', '/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/Orange/datasets']\n\n    @classmethod\n    def locate(cls, filename, search_dirs=('.',)):\n        \"\"\"Locate a file with given filename that can be opened by one\n        of the available readers.\n    \n        Parameters\n        ----------\n        filename : str\n        search_dirs : Iterable[str]\n    \n        Returns\n        -------\n        str\n            Absolute path to the file\n        \"\"\"\n        if path.exists(filename):\n            return filename\n    \n        for directory in search_dirs:\n            absolute_filename = path.join(directory, filename)\n            if path.exists(absolute_filename):\n                break\n            for ext in cls.readers:\n                if fnmatch(path.basename(filename), '*' + ext):\n                    break\n                # glob uses fnmatch internally\n                matching_files = glob(absolute_filename + ext)\n                if matching_files:\n                    absolute_filename = matching_files[0]\n                    break\n            if path.exists(absolute_filename):\n                break\n        else:\n            absolute_filename = \"\"\n    \n        if not path.exists(absolute_filename):\n>           raise IOError('File \"{}\" was not found.'.format(filename))\nE           OSError: File \"origin1/images\" was not found.\n\nOrange/data/io_base.py:788: OSError\n_________________________ TestOWFile.test_minimum_size _________________________\n\nself = <r2e_tests.test_1.TestOWFile 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: 1520 not less than 800\n____________________________ TestOWFile.test_sheets ____________________________\n\nself = <r2e_tests.test_1.TestOWFile testMethod=test_sheets>\n\n    def test_sheets(self):\n        # pylint: disable=protected-access\n        widget = self.widget\n        combo = widget.sheet_combo\n        widget.last_path = \\\n            lambda: path.join(path.dirname(__file__), '..', \"..\", '..',\n                              'tests', 'xlsx_files', 'header_0_sheet.xlsx')\n        widget._try_load()\n        widget.reader.sheet = \"my_sheet\"\n        widget._select_active_sheet()\n>       self.assertEqual(combo.itemText(0), \"Sheet1\")\nE       AssertionError: '' != 'Sheet1'\nE       + Sheet1\n\nr2e_tests/test_1.py:619: AssertionError\n___________________ TestOWFile.test_warning_from_this_thread ___________________\n\nself = <r2e_tests.test_1.TestOWFile testMethod=test_warning_from_this_thread>\n\n    @patch(\"os.path.exists\", new=lambda _: True)\n    def test_warning_from_this_thread(self):\n        WARNING_MSG = \"warning from this thread\"\n    \n        def read():\n            warnings.warn(WARNING_MSG)\n            return Table(TITANIC_PATH)\n    \n        reader = Mock()\n        reader.read = read\n        self.widget._get_reader = lambda: reader\n        self.widget.last_path = lambda: \"foo\"\n        self.widget._update_sheet_combo = Mock()\n    \n        self.widget._try_load()\n>       self.assertTrue(self.widget.Warning.load_warning.is_shown())\nE       AssertionError: False is not true\n\nr2e_tests/test_1.py:674: AssertionError\n________________________ TestOWFile.test_with_warnings _________________________\n\nself = <r2e_tests.test_1.TestOWFile testMethod=test_with_warnings>\n\n    def test_with_warnings(self):\n        with named_file(\"\", suffix=\".with_warning\") as fn:\n            self.open_dataset(fn)\n>       self.assertTrue(self.widget.Warning.load_warning.is_shown())\nE       AssertionError: False is not true\n\nr2e_tests/test_1.py:364: AssertionError\n==================================== PASSES ====================================\n___________________ TestOWFile.test_check_datetime_disabled ____________________\n----------------------------- Captured stderr call -----------------------------\nThis plugin does not support raise()\nThis plugin does not support grabbing the keyboard\nThis plugin does not support raise()\nThis plugin does not support raise()\nThis plugin does not support raise()\nThis plugin does not support raise()\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWFile::test_add_new_format\nPASSED r2e_tests/test_1.py::TestOWFile::test_call_deprecated_dialog_formats\nPASSED r2e_tests/test_1.py::TestOWFile::test_check_column_noname\nPASSED r2e_tests/test_1.py::TestOWFile::test_check_datetime_disabled\nPASSED r2e_tests/test_1.py::TestOWFile::test_check_file_size\nPASSED r2e_tests/test_1.py::TestOWFile::test_context_match_includes_variable_values\nPASSED r2e_tests/test_1.py::TestOWFile::test_domain_changes_are_stored\nPASSED r2e_tests/test_1.py::TestOWFile::test_domain_edit_no_changes\nPASSED r2e_tests/test_1.py::TestOWFile::test_domain_edit_on_sparse_data\nPASSED r2e_tests/test_1.py::TestOWFile::test_domain_editor_conversions\nPASSED r2e_tests/test_1.py::TestOWFile::test_domaineditor_continuous_to_string\nPASSED r2e_tests/test_1.py::TestOWFile::test_domaineditor_makes_variables\nPASSED r2e_tests/test_1.py::TestOWFile::test_dragEnterEvent_accepts_urls\nPASSED r2e_tests/test_1.py::TestOWFile::test_dragEnterEvent_skips_osx_file_references\nPASSED r2e_tests/test_1.py::TestOWFile::test_dragEnterEvent_skips_usupported_files\nPASSED r2e_tests/test_1.py::TestOWFile::test_dropEvent_selects_file\nPASSED r2e_tests/test_1.py::TestOWFile::test_drop_data_when_everything_skipped\nPASSED r2e_tests/test_1.py::TestOWFile::test_fail\nPASSED r2e_tests/test_1.py::TestOWFile::test_fail_sheets\nPASSED r2e_tests/test_1.py::TestOWFile::test_file_not_found\nPASSED r2e_tests/test_1.py::TestOWFile::test_files_relocated\nPASSED r2e_tests/test_1.py::TestOWFile::test_image_export\nPASSED r2e_tests/test_1.py::TestOWFile::test_invalid_role_mode\nPASSED r2e_tests/test_1.py::TestOWFile::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWFile::test_no_last_path\nPASSED r2e_tests/test_1.py::TestOWFile::test_no_reader_extension\nPASSED r2e_tests/test_1.py::TestOWFile::test_no_specified_reader\nPASSED r2e_tests/test_1.py::TestOWFile::test_nothing_selected\nPASSED r2e_tests/test_1.py::TestOWFile::test_open_moved_workflow\nPASSED r2e_tests/test_1.py::TestOWFile::test_read_format\nPASSED r2e_tests/test_1.py::TestOWFile::test_reader_custom_tab\nPASSED r2e_tests/test_1.py::TestOWFile::test_rename_duplicates\nPASSED r2e_tests/test_1.py::TestOWFile::test_summary\nPASSED r2e_tests/test_1.py::TestOWFile::test_url_no_scheme\nPASSED r2e_tests/test_1.py::TestOWFile::test_variable_name_change\nPASSED r2e_tests/test_1.py::TestOWFile::test_warning_from_another_thread\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::TestOWFile::test_adds_origin - OSError: File \"ori...\nFAILED r2e_tests/test_1.py::TestOWFile::test_minimum_size - AssertionError: 1...\nFAILED r2e_tests/test_1.py::TestOWFile::test_sheets - AssertionError: '' != '...\nFAILED r2e_tests/test_1.py::TestOWFile::test_warning_from_this_thread - Asser...\nFAILED r2e_tests/test_1.py::TestOWFile::test_with_warnings - AssertionError: ...\n=================== 5 failed, 36 passed, 3 skipped in 7.20s ====================\nWidgets left: 0    Max widgets: 4032 \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_efd8e00095e8af065248c9182022c1cd5f2ee489\ncollected 44 items\n\nr2e_tests/test_1.py sss.F......................F.........F...FFF         [100%]\n\n=================================== FAILURES ===================================\n_________________________ TestOWFile.test_adds_origin __________________________\n\nself = <r2e_tests.test_1.TestOWFile testMethod=test_adds_origin>\n\n    def test_adds_origin(self):\n>       self.open_dataset(\"origin1/images\")\n\nr2e_tests/test_1.py:532: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \nr2e_tests/test_1.py:216: in open_dataset\n    filename = FileFormat.locate(name, dataset_dirs)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\ncls = <class 'Orange.data.io.FileFormat'>, filename = 'origin1/images'\nsearch_dirs = ['', '/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_efd8e00095e8af065248c9182022c1cd5f2ee489/Orange/datasets']\n\n    @classmethod\n    def locate(cls, filename, search_dirs=('.',)):\n        \"\"\"Locate a file with given filename that can be opened by one\n        of the available readers.\n    \n        Parameters\n        ----------\n        filename : str\n        search_dirs : Iterable[str]\n    \n        Returns\n        -------\n        str\n            Absolute path to the file\n        \"\"\"\n        if path.exists(filename):\n            return filename\n    \n        for directory in search_dirs:\n            absolute_filename = path.join(directory, filename)\n            if path.exists(absolute_filename):\n                break\n            for ext in cls.readers:\n                if fnmatch(path.basename(filename), '*' + ext):\n                    break\n                # glob uses fnmatch internally\n                matching_files = glob(absolute_filename + ext)\n                if matching_files:\n                    absolute_filename = matching_files[0]\n                    break\n            if path.exists(absolute_filename):\n                break\n        else:\n            absolute_filename = \"\"\n    \n        if not path.exists(absolute_filename):\n>           raise IOError('File \"{}\" was not found.'.format(filename))\nE           OSError: File \"origin1/images\" was not found.\n\nOrange/data/io_base.py:788: OSError\n_________________________ TestOWFile.test_minimum_size _________________________\n\nself = <r2e_tests.test_1.TestOWFile 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: 1520 not less than 800\n____________________________ TestOWFile.test_sheets ____________________________\n\nself = <r2e_tests.test_1.TestOWFile testMethod=test_sheets>\n\n    def test_sheets(self):\n        # pylint: disable=protected-access\n        widget = self.widget\n        combo = widget.sheet_combo\n        widget.last_path = \\\n            lambda: path.join(path.dirname(__file__), '..', \"..\", '..',\n                              'tests', 'xlsx_files', 'header_0_sheet.xlsx')\n        widget._try_load()\n        widget.reader.sheet = \"my_sheet\"\n        widget._select_active_sheet()\n>       self.assertEqual(combo.itemText(0), \"Sheet1\")\nE       AssertionError: '' != 'Sheet1'\nE       + Sheet1\n\nr2e_tests/test_1.py:619: AssertionError\n_________________ TestOWFile.test_warning_from_another_thread __________________\n\nself = <r2e_tests.test_1.TestOWFile testMethod=test_warning_from_another_thread>\n\n    @patch(\"os.path.exists\", new=lambda _: True)\n    def test_warning_from_another_thread(self):\n        class AnotherWidget(QObject):\n            # This must be a method, not a staticmethod to run in the thread\n            def issue_warning(self):  # pylint: disable=no-self-use\n                time.sleep(0.1)\n                warnings.warn(\"warning from another thread\")\n                warning_thread.quit()\n    \n        def read():\n            warning_thread.start()\n            time.sleep(0.2)\n            return Table(TITANIC_PATH)\n    \n        warning_thread = QThread()\n        another_widget = AnotherWidget()\n        another_widget.moveToThread(warning_thread)\n        warning_thread.started.connect(another_widget.issue_warning)\n    \n        reader = Mock()\n        reader.read = read\n        self.widget._get_reader = lambda: reader\n        self.widget.last_path = lambda: \"foo\"\n        self.widget._update_sheet_combo = Mock()\n    \n        # Warning must be caught by unit tests, but not the widget\n        with self.assertWarns(UserWarning):\n            self.widget._try_load()\n>           self.assertFalse(self.widget.Warning.load_warning.is_shown())\nE           AssertionError: True is not false\n\nr2e_tests/test_1.py:656: AssertionError\n___________________ TestOWFile.test_warning_from_this_thread ___________________\n\nself = <r2e_tests.test_1.TestOWFile testMethod=test_warning_from_this_thread>\n\n    @patch(\"os.path.exists\", new=lambda _: True)\n    def test_warning_from_this_thread(self):\n        WARNING_MSG = \"warning from this thread\"\n    \n        def read():\n            warnings.warn(WARNING_MSG)\n            return Table(TITANIC_PATH)\n    \n        reader = Mock()\n        reader.read = read\n        self.widget._get_reader = lambda: reader\n        self.widget.last_path = lambda: \"foo\"\n        self.widget._update_sheet_combo = Mock()\n    \n        self.widget._try_load()\n>       self.assertTrue(self.widget.Warning.load_warning.is_shown())\nE       AssertionError: False is not true\n\nr2e_tests/test_1.py:674: AssertionError\n________________________ TestOWFile.test_with_warnings _________________________\n\nself = <r2e_tests.test_1.TestOWFile testMethod=test_with_warnings>\n\n    def test_with_warnings(self):\n        with named_file(\"\", suffix=\".with_warning\") as fn:\n            self.open_dataset(fn)\n>       self.assertTrue(self.widget.Warning.load_warning.is_shown())\nE       AssertionError: False is not true\n\nr2e_tests/test_1.py:364: AssertionError\n==================================== PASSES ====================================\n___________________ TestOWFile.test_check_datetime_disabled ____________________\n----------------------------- Captured stderr call -----------------------------\nThis plugin does not support raise()\nThis plugin does not support grabbing the keyboard\nThis plugin does not support raise()\nThis plugin does not support raise()\nThis plugin does not support raise()\nThis plugin does not support raise()\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWFile::test_add_new_format\nPASSED r2e_tests/test_1.py::TestOWFile::test_call_deprecated_dialog_formats\nPASSED r2e_tests/test_1.py::TestOWFile::test_check_column_noname\nPASSED r2e_tests/test_1.py::TestOWFile::test_check_datetime_disabled\nPASSED r2e_tests/test_1.py::TestOWFile::test_check_file_size\nPASSED r2e_tests/test_1.py::TestOWFile::test_context_match_includes_variable_values\nPASSED r2e_tests/test_1.py::TestOWFile::test_domain_changes_are_stored\nPASSED r2e_tests/test_1.py::TestOWFile::test_domain_edit_no_changes\nPASSED r2e_tests/test_1.py::TestOWFile::test_domain_edit_on_sparse_data\nPASSED r2e_tests/test_1.py::TestOWFile::test_domain_editor_conversions\nPASSED r2e_tests/test_1.py::TestOWFile::test_domaineditor_continuous_to_string\nPASSED r2e_tests/test_1.py::TestOWFile::test_domaineditor_makes_variables\nPASSED r2e_tests/test_1.py::TestOWFile::test_dragEnterEvent_accepts_urls\nPASSED r2e_tests/test_1.py::TestOWFile::test_dragEnterEvent_skips_osx_file_references\nPASSED r2e_tests/test_1.py::TestOWFile::test_dragEnterEvent_skips_usupported_files\nPASSED r2e_tests/test_1.py::TestOWFile::test_dropEvent_selects_file\nPASSED r2e_tests/test_1.py::TestOWFile::test_drop_data_when_everything_skipped\nPASSED r2e_tests/test_1.py::TestOWFile::test_fail\nPASSED r2e_tests/test_1.py::TestOWFile::test_fail_sheets\nPASSED r2e_tests/test_1.py::TestOWFile::test_file_not_found\nPASSED r2e_tests/test_1.py::TestOWFile::test_files_relocated\nPASSED r2e_tests/test_1.py::TestOWFile::test_image_export\nPASSED r2e_tests/test_1.py::TestOWFile::test_invalid_role_mode\nPASSED r2e_tests/test_1.py::TestOWFile::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWFile::test_no_last_path\nPASSED r2e_tests/test_1.py::TestOWFile::test_no_reader_extension\nPASSED r2e_tests/test_1.py::TestOWFile::test_no_specified_reader\nPASSED r2e_tests/test_1.py::TestOWFile::test_nothing_selected\nPASSED r2e_tests/test_1.py::TestOWFile::test_open_moved_workflow\nPASSED r2e_tests/test_1.py::TestOWFile::test_read_format\nPASSED r2e_tests/test_1.py::TestOWFile::test_reader_custom_tab\nPASSED r2e_tests/test_1.py::TestOWFile::test_rename_duplicates\nPASSED r2e_tests/test_1.py::TestOWFile::test_summary\nPASSED r2e_tests/test_1.py::TestOWFile::test_url_no_scheme\nPASSED r2e_tests/test_1.py::TestOWFile::test_variable_name_change\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::TestOWFile::test_adds_origin - OSError: File \"ori...\nFAILED r2e_tests/test_1.py::TestOWFile::test_minimum_size - AssertionError: 1...\nFAILED r2e_tests/test_1.py::TestOWFile::test_sheets - AssertionError: '' != '...\nFAILED r2e_tests/test_1.py::TestOWFile::test_warning_from_another_thread - As...\nFAILED r2e_tests/test_1.py::TestOWFile::test_warning_from_this_thread - Asser...\nFAILED r2e_tests/test_1.py::TestOWFile::test_with_warnings - AssertionError: ...\n=================== 6 failed, 35 passed, 3 skipped in 4.46s ====================\nWidgets left: 0    Max widgets: 4032 \n\n",
    "old_commit_res_stderr": ""
}
Orange/widgets/data/owfile.py Orange/widgets/data/tests/test_owfile.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
### OWFile widget incorrectly displays warnings from other threads

**Description:**
When a warning is triggered from a background thread, the OWFile widget erroneously displays a warning message. The widget is intended to show warnings only from the main thread to avoid confusing users with irrelevant alerts.

**Example Code:**
```python
import warnings
from PyQt5.QtCore import QObject, QThread
import time

class AnotherWidget(QObject):
    def issue_warning(self):
        time.sleep(0.1)
        warnings.warn('warning from another thread')
        warning_thread.quit()

warning_thread = QThread()
another_widget = AnotherWidget()
another_widget.moveToThread(warning_thread)
warning_thread.started.connect(another_widget.issue_warning)
warning_thread.start()
```

**Expected Behavior:**
Warnings emitted from background threads should be handled silently without displaying any warning messages in the OWFile widget interface.

**Actual Behavior:**
Warnings from non-main threads are displayed in the OWFile widget, leading to unnecessary and potentially confusing warning messages for users.
[/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/owfile.py
import os
import logging
from itertools import chain
from warnings import catch_warnings
from urllib.parse import urlparse
from typing import List

import numpy as np
from AnyQt.QtWidgets import \
    QStyle, QComboBox, QMessageBox, QGridLayout, QLabel, \
    QLineEdit, QSizePolicy as Policy, QCompleter
from AnyQt.QtCore import Qt, QTimer, QSize

from Orange.data.table import Table, get_sample_datasets_dir
from Orange.data.io import FileFormat, UrlReader, class_from_qualified_name
from Orange.widgets import widget, gui
from Orange.widgets.settings import Setting, ContextSetting, \
    PerfectDomainContextHandler, SettingProvider
from Orange.widgets.utils.domaineditor import DomainEditor
from Orange.widgets.utils.itemmodels import PyListModel
from Orange.widgets.utils.filedialogs import RecentPathsWComboMixin, \
    open_filename_dialog
from Orange.widgets.utils.widgetpreview import WidgetPreview
from Orange.widgets.utils.state_summary import format_summary_details
from Orange.widgets.widget import Output, Msg

# Backward compatibility: class RecentPath used to be defined in this module,
# and it is used in saved (pickled) settings. It must be imported into the
# module's namespace so that old saved settings still work
from Orange.widgets.utils.filedialogs import RecentPath


log = logging.getLogger(__name__)


def add_origin(examples, filename):
    """
    Adds attribute with file location to each string variable
    Used for relative filenames stored in string variables (e.g. pictures)
    TODO: we should consider a cleaner solution (special variable type, ...)
    """
    if not filename:
        return
    strings = [var
               for var in examples.domain.variables + examples.domain.metas
               if var.is_string]
    dir_name, _ = os.path.split(filename)
    for var in strings:
        if "type" in var.attributes and "origin" not in var.attributes:
            var.attributes["origin"] = dir_name


class NamedURLModel(PyListModel):
    def __init__(self, mapping):
        self.mapping = mapping
        super().__init__()

    def data(self, index, role=Qt.DisplayRole):
        data = super().data(index, role)
        if role == Qt.DisplayRole:
            return self.mapping.get(data, data)
        return data

    def add_name(self, url, name):
        self.mapping[url] = name
        self.modelReset.emit()


class LineEditSelectOnFocus(QLineEdit):
    def focusInEvent(self, event):
        super().focusInEvent(event)
        # If selectAll is called directly, placing the cursor unselects the text
        QTimer.singleShot(0, self.selectAll)


class OWFile(widget.OWWidget, RecentPathsWComboMixin):
    name = "File"
    id = "orange.widgets.data.file"
    description = "Read data from an input file or network " \
                  "and send a data table to the output."
    icon = "icons/File.svg"
    priority = 10
    category = "Data"
    keywords = ["file", "load", "read", "open"]

    class Outputs:
        data = Output("Data", Table,
                      doc="Attribute-valued dataset read from the input file.")

    want_main_area = False
    buttons_area_orientation = None

    SEARCH_PATHS = [("sample-datasets", get_sample_datasets_dir())]
    SIZE_LIMIT = 1e7
    LOCAL_FILE, URL = range(2)

    settingsHandler = PerfectDomainContextHandler(
        match_values=PerfectDomainContextHandler.MATCH_VALUES_ALL
    )

    # pylint seems to want declarations separated from definitions
    recent_paths: List[RecentPath]
    recent_urls: List[str]
    variables: list

    # Overload RecentPathsWidgetMixin.recent_paths to set defaults
    recent_paths = Setting([
        RecentPath("", "sample-datasets", "iris.tab"),
        RecentPath("", "sample-datasets", "titanic.tab"),
        RecentPath("", "sample-datasets", "housing.tab"),
        RecentPath("", "sample-datasets", "heart_disease.tab"),
        RecentPath("", "sample-datasets", "brown-selected.tab"),
        RecentPath("", "sample-datasets", "zoo.tab"),
    ])
    recent_urls = Setting([])
    source = Setting(LOCAL_FILE)
    sheet_names = Setting({})
    url = Setting("")

    variables = ContextSetting([])

    domain_editor = SettingProvider(DomainEditor)

    class Warning(widget.OWWidget.Warning):
        file_too_big = Msg("The file is too large to load automatically."
                           " Press Reload to load.")
        load_warning = Msg("Read warning:\n{}")
        performance_warning = Msg(
            "Categorical variables with >100 values may decrease performance.")
        renamed_vars = Msg("Some variables have been renamed "
                           "to avoid duplicates.\n{}")
        multiple_targets = Msg("Most widgets do not support multiple targets")

    class Error(widget.OWWidget.Error):
        file_not_found = Msg("File not found.")
        missing_reader = Msg("Missing reader.")
        sheet_error = Msg("Error listing available sheets.")
        unknown = Msg("Read error:\n{}")

    class NoFileSelected:
        pass

    UserAdviceMessages = [
        widget.Message(
            "Use CSV File Import widget for advanced options "
            "for comma-separated files",
            "use-csv-file-import"),
        widget.Message(
            "This widget loads only tabular data. Use other widgets to load "
            "other data types like models, distance matrices and networks.",
            "other-data-types"
        )
    ]

    def __init__(self):
        super().__init__()
        RecentPathsWComboMixin.__init__(self)
        self.domain = None
        self.data = None
        self.loaded_file = ""
        self.reader = None

        layout = QGridLayout()
        layout.setSpacing(4)
        gui.widgetBox(self.controlArea, orientation=layout, box='Source')
        vbox = gui.radioButtons(None, self, "source", box=True,
                                callback=self.load_data, addToLayout=False)

        rb_button = gui.appendRadioButton(vbox, "File:", addToLayout=False)
        layout.addWidget(rb_button, 0, 0, Qt.AlignVCenter)

        box = gui.hBox(None, addToLayout=False, margin=0)
        box.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)
        self.file_combo.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)
        self.file_combo.activated[int].connect(self.select_file)
        box.layout().addWidget(self.file_combo)
        layout.addWidget(box, 0, 1)

        file_button = gui.button(
            None, self, '...', callback=self.browse_file, autoDefault=False)
        file_button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))
        file_button.setSizePolicy(Policy.Maximum, Policy.Fixed)
        layout.addWidget(file_button, 0, 2)

        reload_button = gui.button(
            None, self, "Reload", callback=self.load_data, autoDefault=False)
        reload_button.setIcon(self.style().standardIcon(
            QStyle.SP_BrowserReload))
        reload_button.setSizePolicy(Policy.Fixed, Policy.Fixed)
        layout.addWidget(reload_button, 0, 3)

        self.sheet_box = gui.hBox(None, addToLayout=False, margin=0)
        self.sheet_combo = QComboBox()
        self.sheet_combo.activated[str].connect(self.select_sheet)
        self.sheet_combo.setSizePolicy(
            Policy.MinimumExpanding, Policy.Fixed)
        self.sheet_label = QLabel()
        self.sheet_label.setText('Sheet')
        self.sheet_label.setSizePolicy(
            Policy.MinimumExpanding, Policy.Fixed)
        self.sheet_box.layout().addWidget(
            self.sheet_label, Qt.AlignLeft)
        self.sheet_box.layout().addWidget(
            self.sheet_combo, Qt.AlignVCenter)
        layout.addWidget(self.sheet_box, 2, 1)
        self.sheet_box.hide()

        rb_button = gui.appendRadioButton(vbox, "URL:", addToLayout=False)
        layout.addWidget(rb_button, 3, 0, Qt.AlignVCenter)

        self.url_combo = url_combo = QComboBox()
        url_model = NamedURLModel(self.sheet_names)
        url_model.wrap(self.recent_urls)
        url_combo.setLineEdit(LineEditSelectOnFocus())
        url_combo.setModel(url_model)
        url_combo.setSizePolicy(Policy.Ignored, Policy.Fixed)
        url_combo.setEditable(True)
        url_combo.setInsertPolicy(url_combo.InsertAtTop)
        url_edit = url_combo.lineEdit()
        l, t, r, b = url_edit.getTextMargins()
        url_edit.setTextMargins(l + 5, t, r, b)
        layout.addWidget(url_combo, 3, 1, 1, 3)
        url_combo.activated.connect(self._url_set)
        # whit completer we set that combo box is case sensitive when
        # matching the history
        completer = QCompleter()
        completer.setCaseSensitivity(Qt.CaseSensitive)
        url_combo.setCompleter(completer)

        box = gui.vBox(self.controlArea, "Info")
        self.infolabel = gui.widgetLabel(box, 'No data loaded.')
        self.warnings = gui.widgetLabel(box, '')

        box = gui.widgetBox(self.controlArea, "Columns (Double click to edit)")
        self.domain_editor = DomainEditor(self)
        self.editor_model = self.domain_editor.model()
        box.layout().addWidget(self.domain_editor)

        box = gui.hBox(box)
        gui.button(
            box, self, "Reset", callback=self.reset_domain_edit,
            autoDefault=False
        )
        gui.rubber(box)
        self.apply_button = gui.button(
            box, self, "Apply", callback=self.apply_domain_edit)
        self.apply_button.setEnabled(False)
        self.apply_button.setFixedWidth(170)
        self.editor_model.dataChanged.connect(
            lambda: self.apply_button.setEnabled(True))

        hBox = gui.hBox(self.controlArea)
        gui.rubber(hBox)
        gui.button(
            hBox, self, "Browse documentation datasets",
            callback=lambda: self.browse_file(True), autoDefault=False)
        gui.rubber(hBox)

        self.info.set_output_summary(self.info.NoOutput)

        self.set_file_list()
        # Must not call open_file from within __init__. open_file
        # explicitly re-enters the event loop (by a progress bar)

        self.setAcceptDrops(True)

        if self.source == self.LOCAL_FILE:
            last_path = self.last_path()
            if last_path and os.path.exists(last_path) and \
                    os.path.getsize(last_path) > self.SIZE_LIMIT:
                self.Warning.file_too_big()
                return

        QTimer.singleShot(0, self.load_data)

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

    def select_file(self, n):
        assert n < len(self.recent_paths)
        super().select_file(n)
        if self.recent_paths:
            self.source = self.LOCAL_FILE
            self.load_data()
            self.set_file_list()

    def select_sheet(self):
        self.recent_paths[0].sheet = self.sheet_combo.currentText()
        self.load_data()

    def _url_set(self):
        url = self.url_combo.currentText()
        pos = self.recent_urls.index(url)
        url = url.strip()

        if not urlparse(url).scheme:
            url = 'http://' + url
            self.url_combo.setItemText(pos, url)
            self.recent_urls[pos] = url

        self.source = self.URL
        self.load_data()

    def browse_file(self, in_demos=False):
        if in_demos:
            start_file = get_sample_datasets_dir()
            if not os.path.exists(start_file):
                QMessageBox.information(
                    None, "File",
                    "Cannot find the directory with documentation datasets")
                return
        else:
            start_file = self.last_path() or os.path.expanduser("~/")

        readers = [f for f in FileFormat.formats
                   if getattr(f, 'read', None)
                   and getattr(f, "EXTENSIONS", None)]
        filename, reader, _ = open_filename_dialog(start_file, None, readers)
        if not filename:
            return
        self.add_path(filename)
        if reader is not None:
            self.recent_paths[0].file_format = reader.qualified_name()

        self.source = self.LOCAL_FILE
        self.load_data()

    # Open a file, create data from it and send it over the data channel
    def load_data(self):
        # We need to catch any exception type since anything can happen in
        # file readers
        self.closeContext()
        self.domain_editor.set_domain(None)
        self.apply_button.setEnabled(False)
        self.clear_messages()
        self.set_file_list()

        error = self._try_load()
        if error:
            error()
            self.data = None
            self.sheet_box.hide()
            self.Outputs.data.send(None)
            self.infolabel.setText("No data.")
            self.info.set_output_summary(self.info.NoOutput)

    def _try_load(self):
        # pylint: disable=broad-except
        if self.last_path() and not os.path.exists(self.last_path()):
            return self.Error.file_not_found

        try:
            self.reader = self._get_reader()
            assert self.reader is not None
        except Exception:
            return self.Error.missing_reader

        if self.reader is self.NoFileSelected:
            self.Outputs.data.send(None)
            self.info.set_output_summary(self.info.NoOutput)
            return None

        try:
            self._update_sheet_combo()
        except Exception:
            return self.Error.sheet_error

        with catch_warnings(record=True) as warnings:
            try:
                data = self.reader.read()
            except Exception as ex:
                log.exception(ex)
                return lambda x=ex: self.Error.unknown(str(x))
            if warnings:
                self.Warning.load_warning(warnings[-1].message.args[0])

        self.infolabel.setText(self._describe(data))

        self.loaded_file = self.last_path()
        add_origin(data, self.loaded_file)
        self.data = data
        self.openContext(data.domain)
        self.apply_domain_edit()  # sends data
        return None

    def _get_reader(self) -> FileFormat:
        if self.source == self.LOCAL_FILE:
            path = self.last_path()
            if path is None:
                return self.NoFileSelected
            if self.recent_paths and self.recent_paths[0].file_format:
                qname = self.recent_paths[0].file_format
                reader_class = class_from_qualified_name(qname)
                reader = reader_class(path)
            else:
                reader = FileFormat.get_reader(path)
            if self.recent_paths and self.recent_paths[0].sheet:
                reader.select_sheet(self.recent_paths[0].sheet)
            return reader
        else:
            url = self.url_combo.currentText().strip()
            if url:
                return UrlReader(url)
            else:
                return self.NoFileSelected

    def _update_sheet_combo(self):
        if len(self.reader.sheets) < 2:
            self.sheet_box.hide()
            self.reader.select_sheet(None)
            return

        self.sheet_combo.clear()
        self.sheet_combo.addItems(self.reader.sheets)
        self._select_active_sheet()
        self.sheet_box.show()

    def _select_active_sheet(self):
        try:
            idx = self.reader.sheets.index(self.reader.sheet)
            self.sheet_combo.setCurrentIndex(idx)
        except ValueError:
            # Requested sheet does not exist in this file
            self.reader.select_sheet(None)
            self.sheet_combo.setCurrentIndex(0)

    @staticmethod
    def _describe(table):
        def missing_prop(prop):
            if prop:
                return f"({prop * 100:.1f}% missing values)"
            else:
                return "(no missing values)"

        domain = table.domain
        text = ""

        attrs = getattr(table, "attributes", {})
        descs = [attrs[desc]
                 for desc in ("Name", "Description") if desc in attrs]
        if len(descs) == 2:
            descs[0] = f"<b>{descs[0]}</b>"
        if descs:
            text += f"<p>{'<br/>'.join(descs)}</p>"

        text += f"<p>{len(table)} instance(s)"

        missing_in_attr = missing_prop(table.has_missing_attribute()
                                       and table.get_nan_frequency_attribute())
        missing_in_class = missing_prop(table.has_missing_class()
                                        and table.get_nan_frequency_class())
        text += f"<br/>{len(domain.attributes)} feature(s) {missing_in_attr}"
        if domain.has_continuous_class:
            text += f"<br/>Regression; numerical class {missing_in_class}"
        elif domain.has_discrete_class:
            text += "<br/>Classification; categorical class " \
                f"with {len(domain.class_var.values)} values {missing_in_class}"
        elif table.domain.class_vars:
            text += "<br/>Multi-target; " \
                f"{len(table.domain.class_vars)} target variables " \
                f"{missing_in_class}"
        else:
            text += "<br/>Data has no target variable."
        text += f"<br/>{len(domain.metas)} meta attribute(s)"
        text += "</p>"

        if 'Timestamp' in table.domain:
            # Google Forms uses this header to timestamp responses
            text += f"<p>First entry: {table[0, 'Timestamp']}<br/>" \
                f"Last entry: {table[-1, 'Timestamp']}</p>"
        return text

    def storeSpecificSettings(self):
        self.current_context.modified_variables = self.variables[:]

    def retrieveSpecificSettings(self):
        if hasattr(self.current_context, "modified_variables"):
            self.variables[:] = self.current_context.modified_variables

    def reset_domain_edit(self):
        self.domain_editor.reset_domain()
        self.apply_domain_edit()

    def _inspect_discrete_variables(self, domain):
        for var in chain(domain.variables, domain.metas):
            if var.is_discrete and len(var.values) > 100:
                self.Warning.performance_warning()

    def apply_domain_edit(self):
        self.Warning.performance_warning.clear()
        self.Warning.renamed_vars.clear()
        if self.data is None:
            table = None
        else:
            domain, cols, renamed = \
                self.domain_editor.get_domain(self.data.domain, self.data,
                                              deduplicate=True)
            if not (domain.variables or domain.metas):
                table = None
            elif domain is self.data.domain:
                table = self.data
            else:
                X, y, m = cols
                table = Table.from_numpy(domain, X, y, m, self.data.W)
                table.name = self.data.name
                table.ids = np.array(self.data.ids)
                table.attributes = getattr(self.data, 'attributes', {})
                self._inspect_discrete_variables(domain)
            if renamed:
                self.Warning.renamed_vars(f"Renamed: {', '.join(renamed)}")

        self.Warning.multiple_targets(
            shown=table is not None and len(table.domain.class_vars) > 1)
        summary = len(table) if table else self.info.NoOutput
        details = format_summary_details(table) if table else ""
        self.info.set_output_summary(summary, details)
        self.Outputs.data.send(table)
        self.apply_button.setEnabled(False)

    def get_widget_name_extension(self):
        _, name = os.path.split(self.loaded_file)
        return os.path.splitext(name)[0]

    def send_report(self):
        def get_ext_name(filename):
            try:
                return FileFormat.names[os.path.splitext(filename)[1]]
            except KeyError:
                return "unknown"

        if self.data is None:
            self.report_paragraph("File", "No file.")
            return

        if self.source == self.LOCAL_FILE:
            home = os.path.expanduser("~")
            if self.loaded_file.startswith(home):
                # os.path.join does not like ~
                name = "~" + os.path.sep + \
                       self.loaded_file[len(home):].lstrip("/").lstrip("\\")
            else:
                name = self.loaded_file
            if self.sheet_combo.isVisible():
                name += f" ({self.sheet_combo.currentText()})"
            self.report_items("File", [("File name", name),
                                       ("Format", get_ext_name(name))])
        else:
            self.report_items("Data", [("Resource", self.url),
                                       ("Format", get_ext_name(self.url))])

        self.report_data("Data", self.data)

    @staticmethod
    def dragEnterEvent(event):
        """Accept drops of valid file urls"""
        urls = event.mimeData().urls()
        if urls:
            try:
                FileFormat.get_reader(urls[0].toLocalFile())
                event.acceptProposedAction()
            except IOError:
                pass

    def dropEvent(self, event):
        """Handle file drops"""
        urls = event.mimeData().urls()
        if urls:
            self.add_path(urls[0].toLocalFile())  # add first file
            self.source = self.LOCAL_FILE
            self.load_data()

    def workflowEnvChanged(self, key, value, oldvalue):
        """
        Function called when environment changes (e.g. while saving the scheme)
        It make sure that all environment connected values are modified
        (e.g. relative file paths are changed)
        """
        self.update_file_list(key, value, oldvalue)


if __name__ == "__main__":  # pragma: no cover
    WidgetPreview(OWFile).run()

```
--- 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]
### OWFile widget incorrectly displays warnings from other threads

**Description:**
When a warning is triggered from a background thread, the OWFile widget erroneously displays a warning message. The widget is intended to show warnings only from the main thread to avoid confusing users with irrelevant alerts.

**Example Code:**
```python
import warnings
from PyQt5.QtCore import QObject, QThread
import time

class AnotherWidget(QObject):
    def issue_warning(self):
        time.sleep(0.1)
        warnings.warn('warning from another thread')
        warning_thread.quit()

warning_thread = QThread()
another_widget = AnotherWidget()
another_widget.moveToThread(warning_thread)
warning_thread.started.connect(another_widget.issue_warning)
warning_thread.start()
```

**Expected Behavior:**
Warnings emitted from background threads should be handled silently without displaying any warning messages in the OWFile widget interface.

**Actual Behavior:**
Warnings from non-main threads are displayed in the OWFile widget, leading to unnecessary and potentially confusing warning messages for users.
[/ISSUE]
{
    "TestOWFile.test_add_new_format": "PASSED",
    "TestOWFile.test_call_deprecated_dialog_formats": "PASSED",
    "TestOWFile.test_check_column_noname": "PASSED",
    "TestOWFile.test_check_datetime_disabled": "PASSED",
    "TestOWFile.test_check_file_size": "PASSED",
    "TestOWFile.test_context_match_includes_variable_values": "PASSED",
    "TestOWFile.test_domain_changes_are_stored": "PASSED",
    "TestOWFile.test_domain_edit_no_changes": "PASSED",
    "TestOWFile.test_domain_edit_on_sparse_data": "PASSED",
    "TestOWFile.test_domain_editor_conversions": "PASSED",
    "TestOWFile.test_domaineditor_continuous_to_string": "PASSED",
    "TestOWFile.test_domaineditor_makes_variables": "PASSED",
    "TestOWFile.test_dragEnterEvent_accepts_urls": "PASSED",
    "TestOWFile.test_dragEnterEvent_skips_osx_file_references": "PASSED",
    "TestOWFile.test_dragEnterEvent_skips_usupported_files": "PASSED",
    "TestOWFile.test_dropEvent_selects_file": "PASSED",
    "TestOWFile.test_drop_data_when_everything_skipped": "PASSED",
    "TestOWFile.test_fail": "PASSED",
    "TestOWFile.test_fail_sheets": "PASSED",
    "TestOWFile.test_file_not_found": "PASSED",
    "TestOWFile.test_files_relocated": "PASSED",
    "TestOWFile.test_image_export": "PASSED",
    "TestOWFile.test_invalid_role_mode": "PASSED",
    "TestOWFile.test_msg_base_class": "PASSED",
    "TestOWFile.test_no_last_path": "PASSED",
    "TestOWFile.test_no_reader_extension": "PASSED",
    "TestOWFile.test_no_specified_reader": "PASSED",
    "TestOWFile.test_nothing_selected": "PASSED",
    "TestOWFile.test_open_moved_workflow": "PASSED",
    "TestOWFile.test_read_format": "PASSED",
    "TestOWFile.test_reader_custom_tab": "PASSED",
    "TestOWFile.test_rename_duplicates": "PASSED",
    "TestOWFile.test_summary": "PASSED",
    "TestOWFile.test_url_no_scheme": "PASSED",
    "TestOWFile.test_variable_name_change": "PASSED",
    "TestOWFile.test_warning_from_another_thread": "PASSED",
    "TestOWFile.test_adds_origin": "FAILED",
    "TestOWFile.test_minimum_size": "FAILED",
    "TestOWFile.test_sheets": "FAILED",
    "TestOWFile.test_warning_from_this_thread": "FAILED",
    "TestOWFile.test_with_warnings": "FAILED"
}
diff --git a/Orange/widgets/data/owfile.py b/Orange/widgets/data/owfile.py
index 470cca0e9..31f6ee147 100644
--- a/Orange/widgets/data/owfile.py
+++ b/Orange/widgets/data/owfile.py
@@ -1,7 +1,6 @@
 import os
 import logging
 from itertools import chain
-from warnings import catch_warnings
 from urllib.parse import urlparse
 from typing import List
 
@@ -13,6 +12,7 @@ from AnyQt.QtCore import Qt, QTimer, QSize
 
 from Orange.data.table import Table, get_sample_datasets_dir
 from Orange.data.io import FileFormat, UrlReader, class_from_qualified_name
+from Orange.util import log_warnings
 from Orange.widgets import widget, gui
 from Orange.widgets.settings import Setting, ContextSetting, \
     PerfectDomainContextHandler, SettingProvider
@@ -366,7 +366,7 @@ class OWFile(widget.OWWidget, RecentPathsWComboMixin):
         except Exception:
             return self.Error.sheet_error
 
-        with catch_warnings(record=True) as warnings:
+        with log_warnings() as warnings:
             try:
                 data = self.reader.read()
             except Exception as ex:

{"Orange/widgets/data/owfile.py": "import os\nimport logging\nfrom itertools import chain\nfrom warnings import catch_warnings\nfrom urllib.parse import urlparse\nfrom typing import List\n\nimport numpy as np\nfrom AnyQt.QtWidgets import \\\n    QStyle, QComboBox, QMessageBox, QGridLayout, QLabel, \\\n    QLineEdit, QSizePolicy as Policy, QCompleter\nfrom AnyQt.QtCore import Qt, QTimer, QSize\n\nfrom Orange.data.table import Table, get_sample_datasets_dir\nfrom Orange.data.io import FileFormat, UrlReader, class_from_qualified_name\nfrom Orange.widgets import widget, gui\nfrom Orange.widgets.settings import Setting, ContextSetting, \\\n    PerfectDomainContextHandler, SettingProvider\nfrom Orange.widgets.utils.domaineditor import DomainEditor\nfrom Orange.widgets.utils.itemmodels import PyListModel\nfrom Orange.widgets.utils.filedialogs import RecentPathsWComboMixin, \\\n    open_filename_dialog\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\nfrom Orange.widgets.utils.state_summary import format_summary_details\nfrom Orange.widgets.widget import Output, Msg\n\n# Backward compatibility: class RecentPath used to be defined in this module,\n# and it is used in saved (pickled) settings. It must be imported into the\n# module's namespace so that old saved settings still work\nfrom Orange.widgets.utils.filedialogs import RecentPath\n\n\nlog = logging.getLogger(__name__)\n\n\ndef add_origin(examples, filename):\n    \"\"\"\n    Adds attribute with file location to each string variable\n    Used for relative filenames stored in string variables (e.g. pictures)\n    TODO: we should consider a cleaner solution (special variable type, ...)\n    \"\"\"\n    if not filename:\n        return\n    strings = [var\n               for var in examples.domain.variables + examples.domain.metas\n               if var.is_string]\n    dir_name, _ = os.path.split(filename)\n    for var in strings:\n        if \"type\" in var.attributes and \"origin\" not in var.attributes:\n            var.attributes[\"origin\"] = dir_name\n\n\nclass NamedURLModel(PyListModel):\n    def __init__(self, mapping):\n        self.mapping = mapping\n        super().__init__()\n\n    def data(self, index, role=Qt.DisplayRole):\n        data = super().data(index, role)\n        if role == Qt.DisplayRole:\n            return self.mapping.get(data, data)\n        return data\n\n    def add_name(self, url, name):\n        self.mapping[url] = name\n        self.modelReset.emit()\n\n\nclass LineEditSelectOnFocus(QLineEdit):\n    def focusInEvent(self, event):\n        super().focusInEvent(event)\n        # If selectAll is called directly, placing the cursor unselects the text\n        QTimer.singleShot(0, self.selectAll)\n\n\nclass OWFile(widget.OWWidget, RecentPathsWComboMixin):\n    name = \"File\"\n    id = \"orange.widgets.data.file\"\n    description = \"Read data from an input file or network \" \\\n                  \"and send a data table to the output.\"\n    icon = \"icons/File.svg\"\n    priority = 10\n    category = \"Data\"\n    keywords = [\"file\", \"load\", \"read\", \"open\"]\n\n    class Outputs:\n        data = Output(\"Data\", Table,\n                      doc=\"Attribute-valued dataset read from the input file.\")\n\n    want_main_area = False\n    buttons_area_orientation = None\n\n    SEARCH_PATHS = [(\"sample-datasets\", get_sample_datasets_dir())]\n    SIZE_LIMIT = 1e7\n    LOCAL_FILE, URL = range(2)\n\n    settingsHandler = PerfectDomainContextHandler(\n        match_values=PerfectDomainContextHandler.MATCH_VALUES_ALL\n    )\n\n    # pylint seems to want declarations separated from definitions\n    recent_paths: List[RecentPath]\n    recent_urls: List[str]\n    variables: list\n\n    # Overload RecentPathsWidgetMixin.recent_paths to set defaults\n    recent_paths = Setting([\n        RecentPath(\"\", \"sample-datasets\", \"iris.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"titanic.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"housing.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"heart_disease.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"brown-selected.tab\"),\n        RecentPath(\"\", \"sample-datasets\", \"zoo.tab\"),\n    ])\n    recent_urls = Setting([])\n    source = Setting(LOCAL_FILE)\n    sheet_names = Setting({})\n    url = Setting(\"\")\n\n    variables = ContextSetting([])\n\n    domain_editor = SettingProvider(DomainEditor)\n\n    class Warning(widget.OWWidget.Warning):\n        file_too_big = Msg(\"The file is too large to load automatically.\"\n                           \" Press Reload to load.\")\n        load_warning = Msg(\"Read warning:\\n{}\")\n        performance_warning = Msg(\n            \"Categorical variables with >100 values may decrease performance.\")\n        renamed_vars = Msg(\"Some variables have been renamed \"\n                           \"to avoid duplicates.\\n{}\")\n        multiple_targets = Msg(\"Most widgets do not support multiple targets\")\n\n    class Error(widget.OWWidget.Error):\n        file_not_found = Msg(\"File not found.\")\n        missing_reader = Msg(\"Missing reader.\")\n        sheet_error = Msg(\"Error listing available sheets.\")\n        unknown = Msg(\"Read error:\\n{}\")\n\n    class NoFileSelected:\n        pass\n\n    UserAdviceMessages = [\n        widget.Message(\n            \"Use CSV File Import widget for advanced options \"\n            \"for comma-separated files\",\n            \"use-csv-file-import\"),\n        widget.Message(\n            \"This widget loads only tabular data. Use other widgets to load \"\n            \"other data types like models, distance matrices and networks.\",\n            \"other-data-types\"\n        )\n    ]\n\n    def __init__(self):\n        super().__init__()\n        RecentPathsWComboMixin.__init__(self)\n        self.domain = None\n        self.data = None\n        self.loaded_file = \"\"\n        self.reader = None\n\n        layout = QGridLayout()\n        layout.setSpacing(4)\n        gui.widgetBox(self.controlArea, orientation=layout, box='Source')\n        vbox = gui.radioButtons(None, self, \"source\", box=True,\n                                callback=self.load_data, addToLayout=False)\n\n        rb_button = gui.appendRadioButton(vbox, \"File:\", addToLayout=False)\n        layout.addWidget(rb_button, 0, 0, Qt.AlignVCenter)\n\n        box = gui.hBox(None, addToLayout=False, margin=0)\n        box.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)\n        self.file_combo.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)\n        self.file_combo.activated[int].connect(self.select_file)\n        box.layout().addWidget(self.file_combo)\n        layout.addWidget(box, 0, 1)\n\n        file_button = gui.button(\n            None, self, '...', callback=self.browse_file, autoDefault=False)\n        file_button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))\n        file_button.setSizePolicy(Policy.Maximum, Policy.Fixed)\n        layout.addWidget(file_button, 0, 2)\n\n        reload_button = gui.button(\n            None, self, \"Reload\", callback=self.load_data, autoDefault=False)\n        reload_button.setIcon(self.style().standardIcon(\n            QStyle.SP_BrowserReload))\n        reload_button.setSizePolicy(Policy.Fixed, Policy.Fixed)\n        layout.addWidget(reload_button, 0, 3)\n\n        self.sheet_box = gui.hBox(None, addToLayout=False, margin=0)\n        self.sheet_combo = QComboBox()\n        self.sheet_combo.activated[str].connect(self.select_sheet)\n        self.sheet_combo.setSizePolicy(\n            Policy.MinimumExpanding, Policy.Fixed)\n        self.sheet_label = QLabel()\n        self.sheet_label.setText('Sheet')\n        self.sheet_label.setSizePolicy(\n            Policy.MinimumExpanding, Policy.Fixed)\n        self.sheet_box.layout().addWidget(\n            self.sheet_label, Qt.AlignLeft)\n        self.sheet_box.layout().addWidget(\n            self.sheet_combo, Qt.AlignVCenter)\n        layout.addWidget(self.sheet_box, 2, 1)\n        self.sheet_box.hide()\n\n        rb_button = gui.appendRadioButton(vbox, \"URL:\", addToLayout=False)\n        layout.addWidget(rb_button, 3, 0, Qt.AlignVCenter)\n\n        self.url_combo = url_combo = QComboBox()\n        url_model = NamedURLModel(self.sheet_names)\n        url_model.wrap(self.recent_urls)\n        url_combo.setLineEdit(LineEditSelectOnFocus())\n        url_combo.setModel(url_model)\n        url_combo.setSizePolicy(Policy.Ignored, Policy.Fixed)\n        url_combo.setEditable(True)\n        url_combo.setInsertPolicy(url_combo.InsertAtTop)\n        url_edit = url_combo.lineEdit()\n        l, t, r, b = url_edit.getTextMargins()\n        url_edit.setTextMargins(l + 5, t, r, b)\n        layout.addWidget(url_combo, 3, 1, 1, 3)\n        url_combo.activated.connect(self._url_set)\n        # whit completer we set that combo box is case sensitive when\n        # matching the history\n        completer = QCompleter()\n        completer.setCaseSensitivity(Qt.CaseSensitive)\n        url_combo.setCompleter(completer)\n\n        box = gui.vBox(self.controlArea, \"Info\")\n        self.infolabel = gui.widgetLabel(box, 'No data loaded.')\n        self.warnings = gui.widgetLabel(box, '')\n\n        box = gui.widgetBox(self.controlArea, \"Columns (Double click to edit)\")\n        self.domain_editor = DomainEditor(self)\n        self.editor_model = self.domain_editor.model()\n        box.layout().addWidget(self.domain_editor)\n\n        box = gui.hBox(box)\n        gui.button(\n            box, self, \"Reset\", callback=self.reset_domain_edit,\n            autoDefault=False\n        )\n        gui.rubber(box)\n        self.apply_button = gui.button(\n            box, self, \"Apply\", callback=self.apply_domain_edit)\n        self.apply_button.setEnabled(False)\n        self.apply_button.setFixedWidth(170)\n        self.editor_model.dataChanged.connect(\n            lambda: self.apply_button.setEnabled(True))\n\n        hBox = gui.hBox(self.controlArea)\n        gui.rubber(hBox)\n        gui.button(\n            hBox, self, \"Browse documentation datasets\",\n            callback=lambda: self.browse_file(True), autoDefault=False)\n        gui.rubber(hBox)\n\n        self.info.set_output_summary(self.info.NoOutput)\n\n        self.set_file_list()\n        # Must not call open_file from within __init__. open_file\n        # explicitly re-enters the event loop (by a progress bar)\n\n        self.setAcceptDrops(True)\n\n        if self.source == self.LOCAL_FILE:\n            last_path = self.last_path()\n            if last_path and os.path.exists(last_path) and \\\n                    os.path.getsize(last_path) > self.SIZE_LIMIT:\n                self.Warning.file_too_big()\n                return\n\n        QTimer.singleShot(0, self.load_data)\n\n    @staticmethod\n    def sizeHint():\n        return QSize(600, 550)\n\n    def select_file(self, n):\n        assert n < len(self.recent_paths)\n        super().select_file(n)\n        if self.recent_paths:\n            self.source = self.LOCAL_FILE\n            self.load_data()\n            self.set_file_list()\n\n    def select_sheet(self):\n        self.recent_paths[0].sheet = self.sheet_combo.currentText()\n        self.load_data()\n\n    def _url_set(self):\n        url = self.url_combo.currentText()\n        pos = self.recent_urls.index(url)\n        url = url.strip()\n\n        if not urlparse(url).scheme:\n            url = 'http://' + url\n            self.url_combo.setItemText(pos, url)\n            self.recent_urls[pos] = url\n\n        self.source = self.URL\n        self.load_data()\n\n    def browse_file(self, in_demos=False):\n        if in_demos:\n            start_file = get_sample_datasets_dir()\n            if not os.path.exists(start_file):\n                QMessageBox.information(\n                    None, \"File\",\n                    \"Cannot find the directory with documentation datasets\")\n                return\n        else:\n            start_file = self.last_path() or os.path.expanduser(\"~/\")\n\n        readers = [f for f in FileFormat.formats\n                   if getattr(f, 'read', None)\n                   and getattr(f, \"EXTENSIONS\", None)]\n        filename, reader, _ = open_filename_dialog(start_file, None, readers)\n        if not filename:\n            return\n        self.add_path(filename)\n        if reader is not None:\n            self.recent_paths[0].file_format = reader.qualified_name()\n\n        self.source = self.LOCAL_FILE\n        self.load_data()\n\n    # Open a file, create data from it and send it over the data channel\n    def load_data(self):\n        # We need to catch any exception type since anything can happen in\n        # file readers\n        self.closeContext()\n        self.domain_editor.set_domain(None)\n        self.apply_button.setEnabled(False)\n        self.clear_messages()\n        self.set_file_list()\n\n        error = self._try_load()\n        if error:\n            error()\n            self.data = None\n            self.sheet_box.hide()\n            self.Outputs.data.send(None)\n            self.infolabel.setText(\"No data.\")\n            self.info.set_output_summary(self.info.NoOutput)\n\n    def _try_load(self):\n        # pylint: disable=broad-except\n        if self.last_path() and not os.path.exists(self.last_path()):\n            return self.Error.file_not_found\n\n        try:\n            self.reader = self._get_reader()\n            assert self.reader is not None\n        except Exception:\n            return self.Error.missing_reader\n\n        if self.reader is self.NoFileSelected:\n            self.Outputs.data.send(None)\n            self.info.set_output_summary(self.info.NoOutput)\n            return None\n\n        try:\n            self._update_sheet_combo()\n        except Exception:\n            return self.Error.sheet_error\n\n        with catch_warnings(record=True) as warnings:\n            try:\n                data = self.reader.read()\n            except Exception as ex:\n                log.exception(ex)\n                return lambda x=ex: self.Error.unknown(str(x))\n            if warnings:\n                self.Warning.load_warning(warnings[-1].message.args[0])\n\n        self.infolabel.setText(self._describe(data))\n\n        self.loaded_file = self.last_path()\n        add_origin(data, self.loaded_file)\n        self.data = data\n        self.openContext(data.domain)\n        self.apply_domain_edit()  # sends data\n        return None\n\n    def _get_reader(self) -> FileFormat:\n        if self.source == self.LOCAL_FILE:\n            path = self.last_path()\n            if path is None:\n                return self.NoFileSelected\n            if self.recent_paths and self.recent_paths[0].file_format:\n                qname = self.recent_paths[0].file_format\n                reader_class = class_from_qualified_name(qname)\n                reader = reader_class(path)\n            else:\n                reader = FileFormat.get_reader(path)\n            if self.recent_paths and self.recent_paths[0].sheet:\n                reader.select_sheet(self.recent_paths[0].sheet)\n            return reader\n        else:\n            url = self.url_combo.currentText().strip()\n            if url:\n                return UrlReader(url)\n            else:\n                return self.NoFileSelected\n\n    def _update_sheet_combo(self):\n        if len(self.reader.sheets) < 2:\n            self.sheet_box.hide()\n            self.reader.select_sheet(None)\n            return\n\n        self.sheet_combo.clear()\n        self.sheet_combo.addItems(self.reader.sheets)\n        self._select_active_sheet()\n        self.sheet_box.show()\n\n    def _select_active_sheet(self):\n        try:\n            idx = self.reader.sheets.index(self.reader.sheet)\n            self.sheet_combo.setCurrentIndex(idx)\n        except ValueError:\n            # Requested sheet does not exist in this file\n            self.reader.select_sheet(None)\n            self.sheet_combo.setCurrentIndex(0)\n\n    @staticmethod\n    def _describe(table):\n        def missing_prop(prop):\n            if prop:\n                return f\"({prop * 100:.1f}% missing values)\"\n            else:\n                return \"(no missing values)\"\n\n        domain = table.domain\n        text = \"\"\n\n        attrs = getattr(table, \"attributes\", {})\n        descs = [attrs[desc]\n                 for desc in (\"Name\", \"Description\") if desc in attrs]\n        if len(descs) == 2:\n            descs[0] = f\"<b>{descs[0]}</b>\"\n        if descs:\n            text += f\"<p>{'<br/>'.join(descs)}</p>\"\n\n        text += f\"<p>{len(table)} instance(s)\"\n\n        missing_in_attr = missing_prop(table.has_missing_attribute()\n                                       and table.get_nan_frequency_attribute())\n        missing_in_class = missing_prop(table.has_missing_class()\n                                        and table.get_nan_frequency_class())\n        text += f\"<br/>{len(domain.attributes)} feature(s) {missing_in_attr}\"\n        if domain.has_continuous_class:\n            text += f\"<br/>Regression; numerical class {missing_in_class}\"\n        elif domain.has_discrete_class:\n            text += \"<br/>Classification; categorical class \" \\\n                f\"with {len(domain.class_var.values)} values {missing_in_class}\"\n        elif table.domain.class_vars:\n            text += \"<br/>Multi-target; \" \\\n                f\"{len(table.domain.class_vars)} target variables \" \\\n                f\"{missing_in_class}\"\n        else:\n            text += \"<br/>Data has no target variable.\"\n        text += f\"<br/>{len(domain.metas)} meta attribute(s)\"\n        text += \"</p>\"\n\n        if 'Timestamp' in table.domain:\n            # Google Forms uses this header to timestamp responses\n            text += f\"<p>First entry: {table[0, 'Timestamp']}<br/>\" \\\n                f\"Last entry: {table[-1, 'Timestamp']}</p>\"\n        return text\n\n    def storeSpecificSettings(self):\n        self.current_context.modified_variables = self.variables[:]\n\n    def retrieveSpecificSettings(self):\n        if hasattr(self.current_context, \"modified_variables\"):\n            self.variables[:] = self.current_context.modified_variables\n\n    def reset_domain_edit(self):\n        self.domain_editor.reset_domain()\n        self.apply_domain_edit()\n\n    def _inspect_discrete_variables(self, domain):\n        for var in chain(domain.variables, domain.metas):\n            if var.is_discrete and len(var.values) > 100:\n                self.Warning.performance_warning()\n\n    def apply_domain_edit(self):\n        self.Warning.performance_warning.clear()\n        self.Warning.renamed_vars.clear()\n        if self.data is None:\n            table = None\n        else:\n            domain, cols, renamed = \\\n                self.domain_editor.get_domain(self.data.domain, self.data,\n                                              deduplicate=True)\n            if not (domain.variables or domain.metas):\n                table = None\n            elif domain is self.data.domain:\n                table = self.data\n            else:\n                X, y, m = cols\n                table = Table.from_numpy(domain, X, y, m, self.data.W)\n                table.name = self.data.name\n                table.ids = np.array(self.data.ids)\n                table.attributes = getattr(self.data, 'attributes', {})\n                self._inspect_discrete_variables(domain)\n            if renamed:\n                self.Warning.renamed_vars(f\"Renamed: {', '.join(renamed)}\")\n\n        self.Warning.multiple_targets(\n            shown=table is not None and len(table.domain.class_vars) > 1)\n        summary = len(table) if table else self.info.NoOutput\n        details = format_summary_details(table) if table else \"\"\n        self.info.set_output_summary(summary, details)\n        self.Outputs.data.send(table)\n        self.apply_button.setEnabled(False)\n\n    def get_widget_name_extension(self):\n        _, name = os.path.split(self.loaded_file)\n        return os.path.splitext(name)[0]\n\n    def send_report(self):\n        def get_ext_name(filename):\n            try:\n                return FileFormat.names[os.path.splitext(filename)[1]]\n            except KeyError:\n                return \"unknown\"\n\n        if self.data is None:\n            self.report_paragraph(\"File\", \"No file.\")\n            return\n\n        if self.source == self.LOCAL_FILE:\n            home = os.path.expanduser(\"~\")\n            if self.loaded_file.startswith(home):\n                # os.path.join does not like ~\n                name = \"~\" + os.path.sep + \\\n                       self.loaded_file[len(home):].lstrip(\"/\").lstrip(\"\\\\\")\n            else:\n                name = self.loaded_file\n            if self.sheet_combo.isVisible():\n                name += f\" ({self.sheet_combo.currentText()})\"\n            self.report_items(\"File\", [(\"File name\", name),\n                                       (\"Format\", get_ext_name(name))])\n        else:\n            self.report_items(\"Data\", [(\"Resource\", self.url),\n                                       (\"Format\", get_ext_name(self.url))])\n\n        self.report_data(\"Data\", self.data)\n\n    @staticmethod\n    def dragEnterEvent(event):\n        \"\"\"Accept drops of valid file urls\"\"\"\n        urls = event.mimeData().urls()\n        if urls:\n            try:\n                FileFormat.get_reader(urls[0].toLocalFile())\n                event.acceptProposedAction()\n            except IOError:\n                pass\n\n    def dropEvent(self, event):\n        \"\"\"Handle file drops\"\"\"\n        urls = event.mimeData().urls()\n        if urls:\n            self.add_path(urls[0].toLocalFile())  # add first file\n            self.source = self.LOCAL_FILE\n            self.load_data()\n\n    def workflowEnvChanged(self, key, value, oldvalue):\n        \"\"\"\n        Function called when environment changes (e.g. while saving the scheme)\n        It make sure that all environment connected values are modified\n        (e.g. relative file paths are changed)\n        \"\"\"\n        self.update_file_list(key, value, oldvalue)\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    WidgetPreview(OWFile).run()\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]
### OWFile widget incorrectly displays warnings from other threads

**Description:**
When a warning is triggered from a background thread, the OWFile widget erroneously displays a warning message. The widget is intended to show warnings only from the main thread to avoid confusing users with irrelevant alerts.

**Example Code:**
```python
import warnings
from PyQt5.QtCore import QObject, QThread
import time

class AnotherWidget(QObject):
    def issue_warning(self):
        time.sleep(0.1)
        warnings.warn('warning from another thread')
        warning_thread.quit()

warning_thread = QThread()
another_widget = AnotherWidget()
another_widget.moveToThread(warning_thread)
warning_thread.started.connect(another_widget.issue_warning)
warning_thread.start()
```

**Expected Behavior:**
Warnings emitted from background threads should be handled silently without displaying any warning messages in the OWFile widget interface.

**Actual Behavior:**
Warnings from non-main threads are displayed in the OWFile widget, leading to unnecessary and potentially confusing warning messages for users.
[/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/owfile.py
import os
import logging
from itertools import chain
from warnings import catch_warnings
from urllib.parse import urlparse
from typing import List

import numpy as np
from AnyQt.QtWidgets import \
    QStyle, QComboBox, QMessageBox, QGridLayout, QLabel, \
    QLineEdit, QSizePolicy as Policy, QCompleter
from AnyQt.QtCore import Qt, QTimer, QSize

from Orange.data.table import Table, get_sample_datasets_dir
from Orange.data.io import FileFormat, UrlReader, class_from_qualified_name
from Orange.widgets import widget, gui
from Orange.widgets.settings import Setting, ContextSetting, \
    PerfectDomainContextHandler, SettingProvider
from Orange.widgets.utils.domaineditor import DomainEditor
from Orange.widgets.utils.itemmodels import PyListModel
from Orange.widgets.utils.filedialogs import RecentPathsWComboMixin, \
    open_filename_dialog
from Orange.widgets.utils.widgetpreview import WidgetPreview
from Orange.widgets.utils.state_summary import format_summary_details
from Orange.widgets.widget import Output, Msg

# Backward compatibility: class RecentPath used to be defined in this module,
# and it is used in saved (pickled) settings. It must be imported into the
# module's namespace so that old saved settings still work
from Orange.widgets.utils.filedialogs import RecentPath


log = logging.getLogger(__name__)


def add_origin(examples, filename):
    """
    Adds attribute with file location to each string variable
    Used for relative filenames stored in string variables (e.g. pictures)
    TODO: we should consider a cleaner solution (special variable type, ...)
    """
    if not filename:
        return
    strings = [var
               for var in examples.domain.variables + examples.domain.metas
               if var.is_string]
    dir_name, _ = os.path.split(filename)
    for var in strings:
        if "type" in var.attributes and "origin" not in var.attributes:
            var.attributes["origin"] = dir_name


class NamedURLModel(PyListModel):
    def __init__(self, mapping):
        self.mapping = mapping
        super().__init__()

    def data(self, index, role=Qt.DisplayRole):
        data = super().data(index, role)
        if role == Qt.DisplayRole:
            return self.mapping.get(data, data)
        return data

    def add_name(self, url, name):
        self.mapping[url] = name
        self.modelReset.emit()


class LineEditSelectOnFocus(QLineEdit):
    def focusInEvent(self, event):
        super().focusInEvent(event)
        # If selectAll is called directly, placing the cursor unselects the text
        QTimer.singleShot(0, self.selectAll)


class OWFile(widget.OWWidget, RecentPathsWComboMixin):
    name = "File"
    id = "orange.widgets.data.file"
    description = "Read data from an input file or network " \
                  "and send a data table to the output."
    icon = "icons/File.svg"
    priority = 10
    category = "Data"
    keywords = ["file", "load", "read", "open"]

    class Outputs:
        data = Output("Data", Table,
                      doc="Attribute-valued dataset read from the input file.")

    want_main_area = False
    buttons_area_orientation = None

    SEARCH_PATHS = [("sample-datasets", get_sample_datasets_dir())]
    SIZE_LIMIT = 1e7
    LOCAL_FILE, URL = range(2)

    settingsHandler = PerfectDomainContextHandler(
        match_values=PerfectDomainContextHandler.MATCH_VALUES_ALL
    )

    # pylint seems to want declarations separated from definitions
    recent_paths: List[RecentPath]
    recent_urls: List[str]
    variables: list

    # Overload RecentPathsWidgetMixin.recent_paths to set defaults
    recent_paths = Setting([
        RecentPath("", "sample-datasets", "iris.tab"),
        RecentPath("", "sample-datasets", "titanic.tab"),
        RecentPath("", "sample-datasets", "housing.tab"),
        RecentPath("", "sample-datasets", "heart_disease.tab"),
        RecentPath("", "sample-datasets", "brown-selected.tab"),
        RecentPath("", "sample-datasets", "zoo.tab"),
    ])
    recent_urls = Setting([])
    source = Setting(LOCAL_FILE)
    sheet_names = Setting({})
    url = Setting("")

    variables = ContextSetting([])

    domain_editor = SettingProvider(DomainEditor)

    class Warning(widget.OWWidget.Warning):
        file_too_big = Msg("The file is too large to load automatically."
                           " Press Reload to load.")
        load_warning = Msg("Read warning:\n{}")
        performance_warning = Msg(
            "Categorical variables with >100 values may decrease performance.")
        renamed_vars = Msg("Some variables have been renamed "
                           "to avoid duplicates.\n{}")
        multiple_targets = Msg("Most widgets do not support multiple targets")

    class Error(widget.OWWidget.Error):
        file_not_found = Msg("File not found.")
        missing_reader = Msg("Missing reader.")
        sheet_error = Msg("Error listing available sheets.")
        unknown = Msg("Read error:\n{}")

    class NoFileSelected:
        pass

    UserAdviceMessages = [
        widget.Message(
            "Use CSV File Import widget for advanced options "
            "for comma-separated files",
            "use-csv-file-import"),
        widget.Message(
            "This widget loads only tabular data. Use other widgets to load "
            "other data types like models, distance matrices and networks.",
            "other-data-types"
        )
    ]

    def __init__(self):
        super().__init__()
        RecentPathsWComboMixin.__init__(self)
        self.domain = None
        self.data = None
        self.loaded_file = ""
        self.reader = None

        layout = QGridLayout()
        layout.setSpacing(4)
        gui.widgetBox(self.controlArea, orientation=layout, box='Source')
        vbox = gui.radioButtons(None, self, "source", box=True,
                                callback=self.load_data, addToLayout=False)

        rb_button = gui.appendRadioButton(vbox, "File:", addToLayout=False)
        layout.addWidget(rb_button, 0, 0, Qt.AlignVCenter)

        box = gui.hBox(None, addToLayout=False, margin=0)
        box.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)
        self.file_combo.setSizePolicy(Policy.MinimumExpanding, Policy.Fixed)
        self.file_combo.activated[int].connect(self.select_file)
        box.layout().addWidget(self.file_combo)
        layout.addWidget(box, 0, 1)

        file_button = gui.button(
            None, self, '...', callback=self.browse_file, autoDefault=False)
        file_button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))
        file_button.setSizePolicy(Policy.Maximum, Policy.Fixed)
        layout.addWidget(file_button, 0, 2)

        reload_button = gui.button(
            None, self, "Reload", callback=self.load_data, autoDefault=False)
        reload_button.setIcon(self.style().standardIcon(
            QStyle.SP_BrowserReload))
        reload_button.setSizePolicy(Policy.Fixed, Policy.Fixed)
        layout.addWidget(reload_button, 0, 3)

        self.sheet_box = gui.hBox(None, addToLayout=False, margin=0)
        self.sheet_combo = QComboBox()
        self.sheet_combo.activated[str].connect(self.select_sheet)
        self.sheet_combo.setSizePolicy(
            Policy.MinimumExpanding, Policy.Fixed)
        self.sheet_label = QLabel()
        self.sheet_label.setText('Sheet')
        self.sheet_label.setSizePolicy(
            Policy.MinimumExpanding, Policy.Fixed)
        self.sheet_box.layout().addWidget(
            self.sheet_label, Qt.AlignLeft)
        self.sheet_box.layout().addWidget(
            self.sheet_combo, Qt.AlignVCenter)
        layout.addWidget(self.sheet_box, 2, 1)
        self.sheet_box.hide()

        rb_button = gui.appendRadioButton(vbox, "URL:", addToLayout=False)
        layout.addWidget(rb_button, 3, 0, Qt.AlignVCenter)

        self.url_combo = url_combo = QComboBox()
        url_model = NamedURLModel(self.sheet_names)
        url_model.wrap(self.recent_urls)
        url_combo.setLineEdit(LineEditSelectOnFocus())
        url_combo.setModel(url_model)
        url_combo.setSizePolicy(Policy.Ignored, Policy.Fixed)
        url_combo.setEditable(True)
        url_combo.setInsertPolicy(url_combo.InsertAtTop)
        url_edit = url_combo.lineEdit()
        l, t, r, b = url_edit.getTextMargins()
        url_edit.setTextMargins(l + 5, t, r, b)
        layout.addWidget(url_combo, 3, 1, 1, 3)
        url_combo.activated.connect(self._url_set)
        # whit completer we set that combo box is case sensitive when
        # matching the history
        completer = QCompleter()
        completer.setCaseSensitivity(Qt.CaseSensitive)
        url_combo.setCompleter(completer)

        box = gui.vBox(self.controlArea, "Info")
        self.infolabel = gui.widgetLabel(box, 'No data loaded.')
        self.warnings = gui.widgetLabel(box, '')

        box = gui.widgetBox(self.controlArea, "Columns (Double click to edit)")
        self.domain_editor = DomainEditor(self)
        self.editor_model = self.domain_editor.model()
        box.layout().addWidget(self.domain_editor)

        box = gui.hBox(box)
        gui.button(
            box, self, "Reset", callback=self.reset_domain_edit,
            autoDefault=False
        )
        gui.rubber(box)
        self.apply_button = gui.button(
            box, self, "Apply", callback=self.apply_domain_edit)
        self.apply_button.setEnabled(False)
        self.apply_button.setFixedWidth(170)
        self.editor_model.dataChanged.connect(
            lambda: self.apply_button.setEnabled(True))

        hBox = gui.hBox(self.controlArea)
        gui.rubber(hBox)
        gui.button(
            hBox, self, "Browse documentation datasets",
            callback=lambda: self.browse_file(True), autoDefault=False)
        gui.rubber(hBox)

        self.info.set_output_summary(self.info.NoOutput)

        self.set_file_list()
        # Must not call open_file from within __init__. open_file
        # explicitly re-enters the event loop (by a progress bar)

        self.setAcceptDrops(True)

        if self.source == self.LOCAL_FILE:
            last_path = self.last_path()
            if last_path and os.path.exists(last_path) and \
                    os.path.getsize(last_path) > self.SIZE_LIMIT:
                self.Warning.file_too_big()
                return

        QTimer.singleShot(0, self.load_data)

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

    def select_file(self, n):
        assert n < len(self.recent_paths)
        super().select_file(n)
        if self.recent_paths:
            self.source = self.LOCAL_FILE
            self.load_data()
            self.set_file_list()

    def select_sheet(self):
        self.recent_paths[0].sheet = self.sheet_combo.currentText()
        self.load_data()

    def _url_set(self):
        url = self.url_combo.currentText()
        pos = self.recent_urls.index(url)
        url = url.strip()

        if not urlparse(url).scheme:
            url = 'http://' + url
            self.url_combo.setItemText(pos, url)
            self.recent_urls[pos] = url

        self.source = self.URL
        self.load_data()

    def browse_file(self, in_demos=False):
        if in_demos:
            start_file = get_sample_datasets_dir()
            if not os.path.exists(start_file):
                QMessageBox.information(
                    None, "File",
                    "Cannot find the directory with documentation datasets")
                return
        else:
            start_file = self.last_path() or os.path.expanduser("~/")

        readers = [f for f in FileFormat.formats
                   if getattr(f, 'read', None)
                   and getattr(f, "EXTENSIONS", None)]
        filename, reader, _ = open_filename_dialog(start_file, None, readers)
        if not filename:
            return
        self.add_path(filename)
        if reader is not None:
            self.recent_paths[0].file_format = reader.qualified_name()

        self.source = self.LOCAL_FILE
        self.load_data()

    # Open a file, create data from it and send it over the data channel
    def load_data(self):
        # We need to catch any exception type since anything can happen in
        # file readers
        self.closeContext()
        self.domain_editor.set_domain(None)
        self.apply_button.setEnabled(False)
        self.clear_messages()
        self.set_file_list()

        error = self._try_load()
        if error:
            error()
            self.data = None
            self.sheet_box.hide()
            self.Outputs.data.send(None)
            self.infolabel.setText("No data.")
            self.info.set_output_summary(self.info.NoOutput)

    def _try_load(self):
        # pylint: disable=broad-except
        if self.last_path() and not os.path.exists(self.last_path()):
            return self.Error.file_not_found

        try:
            self.reader = self._get_reader()
            assert self.reader is not None
        except Exception:
            return self.Error.missing_reader

        if self.reader is self.NoFileSelected:
            self.Outputs.data.send(None)
            self.info.set_output_summary(self.info.NoOutput)
            return None

        try:
            self._update_sheet_combo()
        except Exception:
            return self.Error.sheet_error

        with catch_warnings(record=True) as warnings:
            try:
                data = self.reader.read()
            except Exception as ex:
                log.exception(ex)
                return lambda x=ex: self.Error.unknown(str(x))
            if warnings:
                self.Warning.load_warning(warnings[-1].message.args[0])

        self.infolabel.setText(self._describe(data))

        self.loaded_file = self.last_path()
        add_origin(data, self.loaded_file)
        self.data = data
        self.openContext(data.domain)
        self.apply_domain_edit()  # sends data
        return None

    def _get_reader(self) -> FileFormat:
        if self.source == self.LOCAL_FILE:
            path = self.last_path()
            if path is None:
                return self.NoFileSelected
            if self.recent_paths and self.recent_paths[0].file_format:
                qname = self.recent_paths[0].file_format
                reader_class = class_from_qualified_name(qname)
                reader = reader_class(path)
            else:
                reader = FileFormat.get_reader(path)
            if self.recent_paths and self.recent_paths[0].sheet:
                reader.select_sheet(self.recent_paths[0].sheet)
            return reader
        else:
            url = self.url_combo.currentText().strip()
            if url:
                return UrlReader(url)
            else:
                return self.NoFileSelected

    def _update_sheet_combo(self):
        if len(self.reader.sheets) < 2:
            self.sheet_box.hide()
            self.reader.select_sheet(None)
            return

        self.sheet_combo.clear()
        self.sheet_combo.addItems(self.reader.sheets)
        self._select_active_sheet()
        self.sheet_box.show()

    def _select_active_sheet(self):
        try:
            idx = self.reader.sheets.index(self.reader.sheet)
            self.sheet_combo.setCurrentIndex(idx)
        except ValueError:
            # Requested sheet does not exist in this file
            self.reader.select_sheet(None)
            self.sheet_combo.setCurrentIndex(0)

    @staticmethod
    def _describe(table):
        def missing_prop(prop):
            if prop:
                return f"({prop * 100:.1f}% missing values)"
            else:
                return "(no missing values)"

        domain = table.domain
        text = ""

        attrs = getattr(table, "attributes", {})
        descs = [attrs[desc]
                 for desc in ("Name", "Description") if desc in attrs]
        if len(descs) == 2:
            descs[0] = f"<b>{descs[0]}</b>"
        if descs:
            text += f"<p>{'<br/>'.join(descs)}</p>"

        text += f"<p>{len(table)} instance(s)"

        missing_in_attr = missing_prop(table.has_missing_attribute()
                                       and table.get_nan_frequency_attribute())
        missing_in_class = missing_prop(table.has_missing_class()
                                        and table.get_nan_frequency_class())
        text += f"<br/>{len(domain.attributes)} feature(s) {missing_in_attr}"
        if domain.has_continuous_class:
            text += f"<br/>Regression; numerical class {missing_in_class}"
        elif domain.has_discrete_class:
            text += "<br/>Classification; categorical class " \
                f"with {len(domain.class_var.values)} values {missing_in_class}"
        elif table.domain.class_vars:
            text += "<br/>Multi-target; " \
                f"{len(table.domain.class_vars)} target variables " \
                f"{missing_in_class}"
        else:
            text += "<br/>Data has no target variable."
        text += f"<br/>{len(domain.metas)} meta attribute(s)"
        text += "</p>"

        if 'Timestamp' in table.domain:
            # Google Forms uses this header to timestamp responses
            text += f"<p>First entry: {table[0, 'Timestamp']}<br/>" \
                f"Last entry: {table[-1, 'Timestamp']}</p>"
        return text

    def storeSpecificSettings(self):
        self.current_context.modified_variables = self.variables[:]

    def retrieveSpecificSettings(self):
        if hasattr(self.current_context, "modified_variables"):
            self.variables[:] = self.current_context.modified_variables

    def reset_domain_edit(self):
        self.domain_editor.reset_domain()
        self.apply_domain_edit()

    def _inspect_discrete_variables(self, domain):
        for var in chain(domain.variables, domain.metas):
            if var.is_discrete and len(var.values) > 100:
                self.Warning.performance_warning()

    def apply_domain_edit(self):
        self.Warning.performance_warning.clear()
        self.Warning.renamed_vars.clear()
        if self.data is None:
            table = None
        else:
            domain, cols, renamed = \
                self.domain_editor.get_domain(self.data.domain, self.data,
                                              deduplicate=True)
            if not (domain.variables or domain.metas):
                table = None
            elif domain is self.data.domain:
                table = self.data
            else:
                X, y, m = cols
                table = Table.from_numpy(domain, X, y, m, self.data.W)
                table.name = self.data.name
                table.ids = np.array(self.data.ids)
                table.attributes = getattr(self.data, 'attributes', {})
                self._inspect_discrete_variables(domain)
            if renamed:
                self.Warning.renamed_vars(f"Renamed: {', '.join(renamed)}")

        self.Warning.multiple_targets(
            shown=table is not None and len(table.domain.class_vars) > 1)
        summary = len(table) if table else self.info.NoOutput
        details = format_summary_details(table) if table else ""
        self.info.set_output_summary(summary, details)
        self.Outputs.data.send(table)
        self.apply_button.setEnabled(False)

    def get_widget_name_extension(self):
        _, name = os.path.split(self.loaded_file)
        return os.path.splitext(name)[0]

    def send_report(self):
        def get_ext_name(filename):
            try:
                return FileFormat.names[os.path.splitext(filename)[1]]
            except KeyError:
                return "unknown"

        if self.data is None:
            self.report_paragraph("File", "No file.")
            return

        if self.source == self.LOCAL_FILE:
            home = os.path.expanduser("~")
            if self.loaded_file.startswith(home):
                # os.path.join does not like ~
                name = "~" + os.path.sep + \
                       self.loaded_file[len(home):].lstrip("/").lstrip("\\")
            else:
                name = self.loaded_file
            if self.sheet_combo.isVisible():
                name += f" ({self.sheet_combo.currentText()})"
            self.report_items("File", [("File name", name),
                                       ("Format", get_ext_name(name))])
        else:
            self.report_items("Data", [("Resource", self.url),
                                       ("Format", get_ext_name(self.url))])

        self.report_data("Data", self.data)

    @staticmethod
    def dragEnterEvent(event):
        """Accept drops of valid file urls"""
        urls = event.mimeData().urls()
        if urls:
            try:
                FileFormat.get_reader(urls[0].toLocalFile())
                event.acceptProposedAction()
            except IOError:
                pass

    def dropEvent(self, event):
        """Handle file drops"""
        urls = event.mimeData().urls()
        if urls:
            self.add_path(urls[0].toLocalFile())  # add first file
            self.source = self.LOCAL_FILE
            self.load_data()

    def workflowEnvChanged(self, key, value, oldvalue):
        """
        Function called when environment changes (e.g. while saving the scheme)
        It make sure that all environment connected values are modified
        (e.g. relative file paths are changed)
        """
        self.update_file_list(key, value, oldvalue)


if __name__ == "__main__":  # pragma: no cover
    WidgetPreview(OWFile).run()

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