{
    "file_diffs": [
        {
            "old_file_content": "from AnyQt.QtWidgets import QComboBox, QTextEdit, QMessageBox, QApplication\nfrom AnyQt.QtGui import QCursor\nfrom AnyQt.QtCore import Qt\n\nfrom Orange.data import Table\nfrom Orange.data.sql.backend import Backend\nfrom Orange.data.sql.backend.base import BackendError\nfrom Orange.data.sql.table import SqlTable, LARGE_TABLE, AUTO_DL_LIMIT\nfrom Orange.widgets import gui\nfrom Orange.widgets.settings import Setting\nfrom Orange.widgets.utils.itemmodels import PyListModel\nfrom Orange.widgets.utils.owbasesql import OWBaseSql\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\nfrom Orange.widgets.widget import Output, Msg\n\nMAX_DL_LIMIT = 1000000\n\n\ndef is_postgres(backend):\n    return getattr(backend, 'display_name', '') == \"PostgreSQL\"\n\n\nclass TableModel(PyListModel):\n    def data(self, index, role=Qt.DisplayRole):\n        row = index.row()\n        if role == Qt.DisplayRole:\n            return str(self[row])\n        return super().data(index, role)\n\n\nclass BackendModel(PyListModel):\n    def data(self, index, role=Qt.DisplayRole):\n        row = index.row()\n        if role == Qt.DisplayRole:\n            return self[row].display_name\n        return super().data(index, role)\n\n\nclass OWSql(OWBaseSql):\n    name = \"SQL Table\"\n    id = \"orange.widgets.data.sql\"\n    description = \"Load dataset from SQL.\"\n    icon = \"icons/SQLTable.svg\"\n    priority = 30\n    category = \"Data\"\n    keywords = [\"load\"]\n\n    class Outputs:\n        data = Output(\"Data\", Table, doc=\"Attribute-valued dataset read from the input file.\")\n\n    settings_version = 2\n\n    table = Setting(None)\n    sql = Setting(\"\")\n    guess_values = Setting(True)\n    download = Setting(False)\n\n    materialize = Setting(False)\n    materialize_table_name = Setting(\"\")\n\n    class Information(OWBaseSql.Information):\n        data_sampled = Msg(\"Data description was generated from a sample.\")\n\n    class Warning(OWBaseSql.Warning):\n        missing_extension = Msg(\"Database is missing extensions: {}\")\n\n    class Error(OWBaseSql.Error):\n        no_backends = Msg(\"Please install a backend to use this widget.\")\n\n    def __init__(self):\n        # Lint\n        self.backends = None\n        self.backendcombo = None\n        self.tables = None\n        self.tablecombo = None\n        self.sqltext = None\n        self.custom_sql = None\n        self.downloadcb = None\n        super().__init__()\n\n    def _setup_gui(self):\n        super()._setup_gui()\n        self._add_backend_controls()\n        self._add_tables_controls()\n\n    def _add_backend_controls(self):\n        box = self.serverbox\n        self.backends = BackendModel(Backend.available_backends())\n        self.backendcombo = QComboBox(box)\n        if self.backends:\n            self.backendcombo.setModel(self.backends)\n        else:\n            self.Error.no_backends()\n            box.setEnabled(False)\n        box.layout().insertWidget(0, self.backendcombo)\n\n    def _add_tables_controls(self):\n        vbox = gui.vBox(self.controlArea, \"Tables\", addSpace=True)\n        box = gui.vBox(vbox)\n        self.tables = TableModel()\n\n        self.tablecombo = QComboBox(\n            minimumContentsLength=35,\n            sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLength\n        )\n        self.tablecombo.setModel(self.tables)\n        self.tablecombo.setToolTip('table')\n        self.tablecombo.activated[int].connect(self.select_table)\n        box.layout().addWidget(self.tablecombo)\n\n        self.custom_sql = gui.vBox(box)\n        self.custom_sql.setVisible(False)\n        self.sqltext = QTextEdit(self.custom_sql)\n        self.sqltext.setPlainText(self.sql)\n        self.custom_sql.layout().addWidget(self.sqltext)\n\n        mt = gui.hBox(self.custom_sql)\n        cb = gui.checkBox(mt, self, 'materialize', 'Materialize to table ')\n        cb.setToolTip('Save results of the query in a table')\n        le = gui.lineEdit(mt, self, 'materialize_table_name')\n        le.setToolTip('Save results of the query in a table')\n\n        gui.button(self.custom_sql, self, 'Execute', callback=self.open_table)\n\n        box.layout().addWidget(self.custom_sql)\n\n        gui.checkBox(box, self, \"guess_values\",\n                     \"Auto-discover categorical variables\",\n                     callback=self.open_table)\n\n        self.downloadcb = gui.checkBox(box, self, \"download\",\n                                       \"Download data to local memory\",\n                                       callback=self.open_table)\n\n    def highlight_error(self, text=\"\"):\n        err = ['', 'QLineEdit {border: 2px solid red;}']\n        self.servertext.setStyleSheet(err['server' in text or 'host' in text])\n        self.usernametext.setStyleSheet(err['role' in text])\n        self.databasetext.setStyleSheet(err['database' in text])\n\n    def get_backend(self):\n        if self.backendcombo.currentIndex() < 0:\n            return None\n        return self.backends[self.backendcombo.currentIndex()]\n\n    def on_connection_success(self):\n        if getattr(self.backend, 'missing_extension', False):\n            self.Warning.missing_extension(\n                \", \".join(self.backend.missing_extension))\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        if not is_postgres(self.backend):\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        super().on_connection_success()\n        self.refresh_tables()\n        self.select_table()\n\n    def on_connection_error(self, err):\n        super().on_connection_error(err)\n        self.highlight_error(str(err).split(\"\\n\")[0])\n\n    def clear(self):\n        super().clear()\n        self.Warning.missing_extension.clear()\n        self.downloadcb.setEnabled(True)\n        self.highlight_error()\n        self.tablecombo.clear()\n        self.tablecombo.repaint()\n\n    def refresh_tables(self):\n        self.tables.clear()\n        if self.backend is None:\n            self.data_desc_table = None\n            return\n\n        self.tables.append(\"Select a table\")\n        self.tables.append(\"Custom SQL\")\n        self.tables.extend(self.backend.list_tables(self.schema))\n        index = self.tablecombo.findText(str(self.table))\n        self.tablecombo.setCurrentIndex(index if index != -1 else 0)\n        self.tablecombo.repaint()\n\n    # Called on tablecombo selection change:\n    def select_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.custom_sql.setVisible(False)\n            return self.open_table()\n        else:\n            self.custom_sql.setVisible(True)\n            self.data_desc_table = None\n            self.database_desc[\"Table\"] = \"(None)\"\n            self.table = None\n            if len(str(self.sql)) > 14:\n                return self.open_table()\n        return None\n\n    def get_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if curIdx <= 0:\n            if self.database_desc:\n                self.database_desc[\"Table\"] = \"(None)\"\n            self.data_desc_table = None\n            return None\n\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.table = self.tables[self.tablecombo.currentIndex()]\n            self.database_desc[\"Table\"] = self.table\n            if \"Query\" in self.database_desc:\n                del self.database_desc[\"Query\"]\n            what = self.table\n        else:\n            what = self.sql = self.sqltext.toPlainText()\n            self.table = \"Custom SQL\"\n            if self.materialize:\n                if not self.materialize_table_name:\n                    self.Error.connection(\n                        \"Specify a table name to materialize the query\")\n                    return None\n                try:\n                    with self.backend.execute_sql_query(\"DROP TABLE IF EXISTS \" +\n                                                        self.materialize_table_name):\n                        pass\n                    with self.backend.execute_sql_query(\"CREATE TABLE \" +\n                                                        self.materialize_table_name +\n                                                        \" AS \" + self.sql):\n                        pass\n                    with self.backend.execute_sql_query(\"ANALYZE \" + self.materialize_table_name):\n                        pass\n                except BackendError as ex:\n                    self.Error.connection(str(ex))\n                    return None\n\n        try:\n            table = SqlTable(dict(host=self.host,\n                                  port=self.port,\n                                  database=self.database,\n                                  user=self.username,\n                                  password=self.password),\n                             what,\n                             backend=type(self.backend),\n                             inspect_values=False)\n        except BackendError as ex:\n            self.Error.connection(str(ex))\n            return None\n\n        self.Error.connection.clear()\n\n        sample = False\n\n        if table.approx_len() > LARGE_TABLE and self.guess_values:\n            confirm = QMessageBox(self)\n            confirm.setIcon(QMessageBox.Warning)\n            confirm.setText(\"Attribute discovery might take \"\n                            \"a long time on large tables.\\n\"\n                            \"Do you want to auto discover attributes?\")\n            confirm.addButton(\"Yes\", QMessageBox.YesRole)\n            no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n            if is_postgres(self.backend):\n                sample_button = confirm.addButton(\"Yes, on a sample\",\n                                                  QMessageBox.YesRole)\n            confirm.exec()\n            if confirm.clickedButton() == no_button:\n                self.guess_values = False\n            elif is_postgres(self.backend) and \\\n                    confirm.clickedButton() == sample_button:\n                sample = True\n\n        self.Information.clear()\n        if self.guess_values:\n            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))\n            if sample:\n                s = table.sample_time(1)\n                domain = s.get_domain(inspect_values=True)\n                self.Information.data_sampled()\n            else:\n                domain = table.get_domain(inspect_values=True)\n            QApplication.restoreOverrideCursor()\n            table.domain = domain\n\n        if self.download:\n            if table.approx_len() > AUTO_DL_LIMIT:\n                if is_postgres(self.backend):\n                    confirm = QMessageBox(self)\n                    confirm.setIcon(QMessageBox.Warning)\n                    confirm.setText(\"Data appears to be big. Do you really \"\n                                    \"want to download it to local memory?\")\n\n                    if table.approx_len() <= MAX_DL_LIMIT:\n                        confirm.addButton(\"Yes\", QMessageBox.YesRole)\n                    no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n                    sample_button = confirm.addButton(\"Yes, a sample\",\n                                                      QMessageBox.YesRole)\n                    confirm.exec()\n                    if confirm.clickedButton() == no_button:\n                        return None\n                    elif confirm.clickedButton() == sample_button:\n                        table = table.sample_percentage(\n                            AUTO_DL_LIMIT / table.approx_len() * 100)\n                else:\n                    if table.approx_len() > MAX_DL_LIMIT:\n                        QMessageBox.warning(\n                            self, 'Warning', \"Data is too big to download.\\n\")\n                        return None\n                    else:\n                        confirm = QMessageBox.question(\n                            self, 'Question',\n                            \"Data appears to be big. Do you really \"\n                            \"want to download it to local memory?\",\n                            QMessageBox.Yes | QMessageBox.No, QMessageBox.No)\n                        if confirm == QMessageBox.No:\n                            return None\n\n            table.download_data(MAX_DL_LIMIT)\n            table = Table(table)\n\n        return table\n\n    @classmethod\n    def migrate_settings(cls, settings, version):\n        if version < 2:\n            # Until Orange version 3.4.4 username and password had been stored\n            # in Settings.\n            cm = cls._credential_manager(settings[\"host\"], settings[\"port\"])\n            cm.username = settings[\"username\"]\n            cm.password = settings[\"password\"]\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    WidgetPreview(OWSql).run()\n",
            "new_file_content": "from AnyQt.QtWidgets import QComboBox, QTextEdit, QMessageBox, QApplication\nfrom AnyQt.QtGui import QCursor\nfrom AnyQt.QtCore import Qt\n\nfrom Orange.data import Table\nfrom Orange.data.sql.backend import Backend\nfrom Orange.data.sql.backend.base import BackendError\nfrom Orange.data.sql.table import SqlTable, LARGE_TABLE, AUTO_DL_LIMIT\nfrom Orange.widgets import gui\nfrom Orange.widgets.settings import Setting\nfrom Orange.widgets.utils.itemmodels import PyListModel\nfrom Orange.widgets.utils.owbasesql import OWBaseSql\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\nfrom Orange.widgets.widget import Output, Msg\n\nMAX_DL_LIMIT = 1000000\n\n\ndef is_postgres(backend):\n    return getattr(backend, 'display_name', '') == \"PostgreSQL\"\n\n\nclass TableModel(PyListModel):\n    def data(self, index, role=Qt.DisplayRole):\n        row = index.row()\n        if role == Qt.DisplayRole:\n            return str(self[row])\n        return super().data(index, role)\n\n\nclass BackendModel(PyListModel):\n    def data(self, index, role=Qt.DisplayRole):\n        row = index.row()\n        if role == Qt.DisplayRole:\n            return self[row].display_name\n        return super().data(index, role)\n\n\nclass OWSql(OWBaseSql):\n    name = \"SQL Table\"\n    id = \"orange.widgets.data.sql\"\n    description = \"Load dataset from SQL.\"\n    icon = \"icons/SQLTable.svg\"\n    priority = 30\n    category = \"Data\"\n    keywords = [\"load\"]\n\n    class Outputs:\n        data = Output(\"Data\", Table, doc=\"Attribute-valued dataset read from the input file.\")\n\n    settings_version = 2\n\n    selected_backend = Setting(None)\n    table = Setting(None)\n    sql = Setting(\"\")\n    guess_values = Setting(True)\n    download = Setting(False)\n\n    materialize = Setting(False)\n    materialize_table_name = Setting(\"\")\n\n    class Information(OWBaseSql.Information):\n        data_sampled = Msg(\"Data description was generated from a sample.\")\n\n    class Warning(OWBaseSql.Warning):\n        missing_extension = Msg(\"Database is missing extensions: {}\")\n\n    class Error(OWBaseSql.Error):\n        no_backends = Msg(\"Please install a backend to use this widget.\")\n\n    def __init__(self):\n        # Lint\n        self.backends = None\n        self.backendcombo = None\n        self.tables = None\n        self.tablecombo = None\n        self.sqltext = None\n        self.custom_sql = None\n        self.downloadcb = None\n        super().__init__()\n\n    def _setup_gui(self):\n        super()._setup_gui()\n        self._add_backend_controls()\n        self._add_tables_controls()\n\n    def _add_backend_controls(self):\n        box = self.serverbox\n        self.backends = BackendModel(Backend.available_backends())\n        self.backendcombo = QComboBox(box)\n        if self.backends:\n            self.backendcombo.setModel(self.backends)\n            names = [backend.display_name for backend in self.backends]\n            if self.selected_backend and self.selected_backend in names:\n                self.backendcombo.setCurrentText(self.selected_backend)\n        else:\n            self.Error.no_backends()\n            box.setEnabled(False)\n        self.backendcombo.currentTextChanged.connect(self.__backend_changed)\n        box.layout().insertWidget(0, self.backendcombo)\n\n    def __backend_changed(self):\n        backend = self.get_backend()\n        self.selected_backend = backend.display_name if backend else None\n\n    def _add_tables_controls(self):\n        vbox = gui.vBox(self.controlArea, \"Tables\", addSpace=True)\n        box = gui.vBox(vbox)\n        self.tables = TableModel()\n\n        self.tablecombo = QComboBox(\n            minimumContentsLength=35,\n            sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLength\n        )\n        self.tablecombo.setModel(self.tables)\n        self.tablecombo.setToolTip('table')\n        self.tablecombo.activated[int].connect(self.select_table)\n        box.layout().addWidget(self.tablecombo)\n\n        self.custom_sql = gui.vBox(box)\n        self.custom_sql.setVisible(False)\n        self.sqltext = QTextEdit(self.custom_sql)\n        self.sqltext.setPlainText(self.sql)\n        self.custom_sql.layout().addWidget(self.sqltext)\n\n        mt = gui.hBox(self.custom_sql)\n        cb = gui.checkBox(mt, self, 'materialize', 'Materialize to table ')\n        cb.setToolTip('Save results of the query in a table')\n        le = gui.lineEdit(mt, self, 'materialize_table_name')\n        le.setToolTip('Save results of the query in a table')\n\n        gui.button(self.custom_sql, self, 'Execute', callback=self.open_table)\n\n        box.layout().addWidget(self.custom_sql)\n\n        gui.checkBox(box, self, \"guess_values\",\n                     \"Auto-discover categorical variables\",\n                     callback=self.open_table)\n\n        self.downloadcb = gui.checkBox(box, self, \"download\",\n                                       \"Download data to local memory\",\n                                       callback=self.open_table)\n\n    def highlight_error(self, text=\"\"):\n        err = ['', 'QLineEdit {border: 2px solid red;}']\n        self.servertext.setStyleSheet(err['server' in text or 'host' in text])\n        self.usernametext.setStyleSheet(err['role' in text])\n        self.databasetext.setStyleSheet(err['database' in text])\n\n    def get_backend(self):\n        if self.backendcombo.currentIndex() < 0:\n            return None\n        return self.backends[self.backendcombo.currentIndex()]\n\n    def on_connection_success(self):\n        if getattr(self.backend, 'missing_extension', False):\n            self.Warning.missing_extension(\n                \", \".join(self.backend.missing_extension))\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        if not is_postgres(self.backend):\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        super().on_connection_success()\n        self.refresh_tables()\n        self.select_table()\n\n    def on_connection_error(self, err):\n        super().on_connection_error(err)\n        self.highlight_error(str(err).split(\"\\n\")[0])\n\n    def clear(self):\n        super().clear()\n        self.Warning.missing_extension.clear()\n        self.downloadcb.setEnabled(True)\n        self.highlight_error()\n        self.tablecombo.clear()\n        self.tablecombo.repaint()\n\n    def refresh_tables(self):\n        self.tables.clear()\n        if self.backend is None:\n            self.data_desc_table = None\n            return\n\n        self.tables.append(\"Select a table\")\n        self.tables.append(\"Custom SQL\")\n        self.tables.extend(self.backend.list_tables(self.schema))\n        index = self.tablecombo.findText(str(self.table))\n        self.tablecombo.setCurrentIndex(index if index != -1 else 0)\n        self.tablecombo.repaint()\n\n    # Called on tablecombo selection change:\n    def select_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.custom_sql.setVisible(False)\n            return self.open_table()\n        else:\n            self.custom_sql.setVisible(True)\n            self.data_desc_table = None\n            self.database_desc[\"Table\"] = \"(None)\"\n            self.table = None\n            if len(str(self.sql)) > 14:\n                return self.open_table()\n        return None\n\n    def get_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if curIdx <= 0:\n            if self.database_desc:\n                self.database_desc[\"Table\"] = \"(None)\"\n            self.data_desc_table = None\n            return None\n\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.table = self.tables[self.tablecombo.currentIndex()]\n            self.database_desc[\"Table\"] = self.table\n            if \"Query\" in self.database_desc:\n                del self.database_desc[\"Query\"]\n            what = self.table\n        else:\n            what = self.sql = self.sqltext.toPlainText()\n            self.table = \"Custom SQL\"\n            if self.materialize:\n                if not self.materialize_table_name:\n                    self.Error.connection(\n                        \"Specify a table name to materialize the query\")\n                    return None\n                try:\n                    with self.backend.execute_sql_query(\"DROP TABLE IF EXISTS \" +\n                                                        self.materialize_table_name):\n                        pass\n                    with self.backend.execute_sql_query(\"CREATE TABLE \" +\n                                                        self.materialize_table_name +\n                                                        \" AS \" + self.sql):\n                        pass\n                    with self.backend.execute_sql_query(\"ANALYZE \" + self.materialize_table_name):\n                        pass\n                except BackendError as ex:\n                    self.Error.connection(str(ex))\n                    return None\n\n        try:\n            table = SqlTable(dict(host=self.host,\n                                  port=self.port,\n                                  database=self.database,\n                                  user=self.username,\n                                  password=self.password),\n                             what,\n                             backend=type(self.backend),\n                             inspect_values=False)\n        except BackendError as ex:\n            self.Error.connection(str(ex))\n            return None\n\n        self.Error.connection.clear()\n\n        sample = False\n\n        if table.approx_len() > LARGE_TABLE and self.guess_values:\n            confirm = QMessageBox(self)\n            confirm.setIcon(QMessageBox.Warning)\n            confirm.setText(\"Attribute discovery might take \"\n                            \"a long time on large tables.\\n\"\n                            \"Do you want to auto discover attributes?\")\n            confirm.addButton(\"Yes\", QMessageBox.YesRole)\n            no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n            if is_postgres(self.backend):\n                sample_button = confirm.addButton(\"Yes, on a sample\",\n                                                  QMessageBox.YesRole)\n            confirm.exec()\n            if confirm.clickedButton() == no_button:\n                self.guess_values = False\n            elif is_postgres(self.backend) and \\\n                    confirm.clickedButton() == sample_button:\n                sample = True\n\n        self.Information.clear()\n        if self.guess_values:\n            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))\n            if sample:\n                s = table.sample_time(1)\n                domain = s.get_domain(inspect_values=True)\n                self.Information.data_sampled()\n            else:\n                domain = table.get_domain(inspect_values=True)\n            QApplication.restoreOverrideCursor()\n            table.domain = domain\n\n        if self.download:\n            if table.approx_len() > AUTO_DL_LIMIT:\n                if is_postgres(self.backend):\n                    confirm = QMessageBox(self)\n                    confirm.setIcon(QMessageBox.Warning)\n                    confirm.setText(\"Data appears to be big. Do you really \"\n                                    \"want to download it to local memory?\")\n\n                    if table.approx_len() <= MAX_DL_LIMIT:\n                        confirm.addButton(\"Yes\", QMessageBox.YesRole)\n                    no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n                    sample_button = confirm.addButton(\"Yes, a sample\",\n                                                      QMessageBox.YesRole)\n                    confirm.exec()\n                    if confirm.clickedButton() == no_button:\n                        return None\n                    elif confirm.clickedButton() == sample_button:\n                        table = table.sample_percentage(\n                            AUTO_DL_LIMIT / table.approx_len() * 100)\n                else:\n                    if table.approx_len() > MAX_DL_LIMIT:\n                        QMessageBox.warning(\n                            self, 'Warning', \"Data is too big to download.\\n\")\n                        return None\n                    else:\n                        confirm = QMessageBox.question(\n                            self, 'Question',\n                            \"Data appears to be big. Do you really \"\n                            \"want to download it to local memory?\",\n                            QMessageBox.Yes | QMessageBox.No, QMessageBox.No)\n                        if confirm == QMessageBox.No:\n                            return None\n\n            table.download_data(MAX_DL_LIMIT)\n            table = Table(table)\n\n        return table\n\n    @classmethod\n    def migrate_settings(cls, settings, version):\n        if version < 2:\n            # Until Orange version 3.4.4 username and password had been stored\n            # in Settings.\n            cm = cls._credential_manager(settings[\"host\"], settings[\"port\"])\n            cm.username = settings[\"username\"]\n            cm.password = settings[\"password\"]\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    WidgetPreview(OWSql).run()\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/data/owsql.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "a91e2901e",
                "new_commit_hash": "0fbc7c677",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/data/owsql.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/data/owsql.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 50,
                            "length": 6
                        },
                        "new_range": {
                            "start": 50,
                            "length": 7
                        },
                        "section": "class OWSql(OWBaseSql):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    settings_version = 2",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    selected_backend = Setting(None)",
                                "type": "added"
                            },
                            {
                                "content": "    table = Setting(None)",
                                "type": "context"
                            },
                            {
                                "content": "    sql = Setting(\"\")",
                                "type": "context"
                            },
                            {
                                "content": "    guess_values = Setting(True)",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/owsql.py",
                            "type": "class",
                            "name": "OWSql",
                            "content": "class OWSql(OWBaseSql):\n    name = \"SQL Table\"\n    id = \"orange.widgets.data.sql\"\n    description = \"Load dataset from SQL.\"\n    icon = \"icons/SQLTable.svg\"\n    priority = 30\n    category = \"Data\"\n    keywords = [\"load\"]\n\n    class Outputs:\n        data = Output(\"Data\", Table, doc=\"Attribute-valued dataset read from the input file.\")\n\n    settings_version = 2\n\n    selected_backend = Setting(None)\n    table = Setting(None)\n    sql = Setting(\"\")\n    guess_values = Setting(True)\n    download = Setting(False)\n\n    materialize = Setting(False)\n    materialize_table_name = Setting(\"\")\n\n    class Information(OWBaseSql.Information):\n        data_sampled = Msg(\"Data description was generated from a sample.\")\n\n    class Warning(OWBaseSql.Warning):\n        missing_extension = Msg(\"Database is missing extensions: {}\")\n\n    class Error(OWBaseSql.Error):\n        no_backends = Msg(\"Please install a backend to use this widget.\")\n\n    def __init__(self):\n        # Lint\n        self.backends = None\n        self.backendcombo = None\n        self.tables = None\n        self.tablecombo = None\n        self.sqltext = None\n        self.custom_sql = None\n        self.downloadcb = None\n        super().__init__()\n\n    def _setup_gui(self):\n        super()._setup_gui()\n        self._add_backend_controls()\n        self._add_tables_controls()\n\n    def _add_backend_controls(self):\n        box = self.serverbox\n        self.backends = BackendModel(Backend.available_backends())\n        self.backendcombo = QComboBox(box)\n        if self.backends:\n            self.backendcombo.setModel(self.backends)\n            names = [backend.display_name for backend in self.backends]\n            if self.selected_backend and self.selected_backend in names:\n                self.backendcombo.setCurrentText(self.selected_backend)\n        else:\n            self.Error.no_backends()\n            box.setEnabled(False)\n        self.backendcombo.currentTextChanged.connect(self.__backend_changed)\n        box.layout().insertWidget(0, self.backendcombo)\n\n    def __backend_changed(self):\n        backend = self.get_backend()\n        self.selected_backend = backend.display_name if backend else None\n\n    def _add_tables_controls(self):\n        vbox = gui.vBox(self.controlArea, \"Tables\", addSpace=True)\n        box = gui.vBox(vbox)\n        self.tables = TableModel()\n\n        self.tablecombo = QComboBox(\n            minimumContentsLength=35,\n            sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLength\n        )\n        self.tablecombo.setModel(self.tables)\n        self.tablecombo.setToolTip('table')\n        self.tablecombo.activated[int].connect(self.select_table)\n        box.layout().addWidget(self.tablecombo)\n\n        self.custom_sql = gui.vBox(box)\n        self.custom_sql.setVisible(False)\n        self.sqltext = QTextEdit(self.custom_sql)\n        self.sqltext.setPlainText(self.sql)\n        self.custom_sql.layout().addWidget(self.sqltext)\n\n        mt = gui.hBox(self.custom_sql)\n        cb = gui.checkBox(mt, self, 'materialize', 'Materialize to table ')\n        cb.setToolTip('Save results of the query in a table')\n        le = gui.lineEdit(mt, self, 'materialize_table_name')\n        le.setToolTip('Save results of the query in a table')\n\n        gui.button(self.custom_sql, self, 'Execute', callback=self.open_table)\n\n        box.layout().addWidget(self.custom_sql)\n\n        gui.checkBox(box, self, \"guess_values\",\n                     \"Auto-discover categorical variables\",\n                     callback=self.open_table)\n\n        self.downloadcb = gui.checkBox(box, self, \"download\",\n                                       \"Download data to local memory\",\n                                       callback=self.open_table)\n\n    def highlight_error(self, text=\"\"):\n        err = ['', 'QLineEdit {border: 2px solid red;}']\n        self.servertext.setStyleSheet(err['server' in text or 'host' in text])\n        self.usernametext.setStyleSheet(err['role' in text])\n        self.databasetext.setStyleSheet(err['database' in text])\n\n    def get_backend(self):\n        if self.backendcombo.currentIndex() < 0:\n            return None\n        return self.backends[self.backendcombo.currentIndex()]\n\n    def on_connection_success(self):\n        if getattr(self.backend, 'missing_extension', False):\n            self.Warning.missing_extension(\n                \", \".join(self.backend.missing_extension))\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        if not is_postgres(self.backend):\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        super().on_connection_success()\n        self.refresh_tables()\n        self.select_table()\n\n    def on_connection_error(self, err):\n        super().on_connection_error(err)\n        self.highlight_error(str(err).split(\"\\n\")[0])\n\n    def clear(self):\n        super().clear()\n        self.Warning.missing_extension.clear()\n        self.downloadcb.setEnabled(True)\n        self.highlight_error()\n        self.tablecombo.clear()\n        self.tablecombo.repaint()\n\n    def refresh_tables(self):\n        self.tables.clear()\n        if self.backend is None:\n            self.data_desc_table = None\n            return\n\n        self.tables.append(\"Select a table\")\n        self.tables.append(\"Custom SQL\")\n        self.tables.extend(self.backend.list_tables(self.schema))\n        index = self.tablecombo.findText(str(self.table))\n        self.tablecombo.setCurrentIndex(index if index != -1 else 0)\n        self.tablecombo.repaint()\n\n    # Called on tablecombo selection change:\n    def select_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.custom_sql.setVisible(False)\n            return self.open_table()\n        else:\n            self.custom_sql.setVisible(True)\n            self.data_desc_table = None\n            self.database_desc[\"Table\"] = \"(None)\"\n            self.table = None\n            if len(str(self.sql)) > 14:\n                return self.open_table()\n        return None\n\n    def get_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if curIdx <= 0:\n            if self.database_desc:\n                self.database_desc[\"Table\"] = \"(None)\"\n            self.data_desc_table = None\n            return None\n\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.table = self.tables[self.tablecombo.currentIndex()]\n            self.database_desc[\"Table\"] = self.table\n            if \"Query\" in self.database_desc:\n                del self.database_desc[\"Query\"]\n            what = self.table\n        else:\n            what = self.sql = self.sqltext.toPlainText()\n            self.table = \"Custom SQL\"\n            if self.materialize:\n                if not self.materialize_table_name:\n                    self.Error.connection(\n                        \"Specify a table name to materialize the query\")\n                    return None\n                try:\n                    with self.backend.execute_sql_query(\"DROP TABLE IF EXISTS \" +\n                                                        self.materialize_table_name):\n                        pass\n                    with self.backend.execute_sql_query(\"CREATE TABLE \" +\n                                                        self.materialize_table_name +\n                                                        \" AS \" + self.sql):\n                        pass\n                    with self.backend.execute_sql_query(\"ANALYZE \" + self.materialize_table_name):\n                        pass\n                except BackendError as ex:\n                    self.Error.connection(str(ex))\n                    return None\n\n        try:\n            table = SqlTable(dict(host=self.host,\n                                  port=self.port,\n                                  database=self.database,\n                                  user=self.username,\n                                  password=self.password),\n                             what,\n                             backend=type(self.backend),\n                             inspect_values=False)\n        except BackendError as ex:\n            self.Error.connection(str(ex))\n            return None\n\n        self.Error.connection.clear()\n\n        sample = False\n\n        if table.approx_len() > LARGE_TABLE and self.guess_values:\n            confirm = QMessageBox(self)\n            confirm.setIcon(QMessageBox.Warning)\n            confirm.setText(\"Attribute discovery might take \"\n                            \"a long time on large tables.\\n\"\n                            \"Do you want to auto discover attributes?\")\n            confirm.addButton(\"Yes\", QMessageBox.YesRole)\n            no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n            if is_postgres(self.backend):\n                sample_button = confirm.addButton(\"Yes, on a sample\",\n                                                  QMessageBox.YesRole)\n            confirm.exec()\n            if confirm.clickedButton() == no_button:\n                self.guess_values = False\n            elif is_postgres(self.backend) and \\\n                    confirm.clickedButton() == sample_button:\n                sample = True\n\n        self.Information.clear()\n        if self.guess_values:\n            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))\n            if sample:\n                s = table.sample_time(1)\n                domain = s.get_domain(inspect_values=True)\n                self.Information.data_sampled()\n            else:\n                domain = table.get_domain(inspect_values=True)\n            QApplication.restoreOverrideCursor()\n            table.domain = domain\n\n        if self.download:\n            if table.approx_len() > AUTO_DL_LIMIT:\n                if is_postgres(self.backend):\n                    confirm = QMessageBox(self)\n                    confirm.setIcon(QMessageBox.Warning)\n                    confirm.setText(\"Data appears to be big. Do you really \"\n                                    \"want to download it to local memory?\")\n\n                    if table.approx_len() <= MAX_DL_LIMIT:\n                        confirm.addButton(\"Yes\", QMessageBox.YesRole)\n                    no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n                    sample_button = confirm.addButton(\"Yes, a sample\",\n                                                      QMessageBox.YesRole)\n                    confirm.exec()\n                    if confirm.clickedButton() == no_button:\n                        return None\n                    elif confirm.clickedButton() == sample_button:\n                        table = table.sample_percentage(\n                            AUTO_DL_LIMIT / table.approx_len() * 100)\n                else:\n                    if table.approx_len() > MAX_DL_LIMIT:\n                        QMessageBox.warning(\n                            self, 'Warning', \"Data is too big to download.\\n\")\n                        return None\n                    else:\n                        confirm = QMessageBox.question(\n                            self, 'Question',\n                            \"Data appears to be big. Do you really \"\n                            \"want to download it to local memory?\",\n                            QMessageBox.Yes | QMessageBox.No, QMessageBox.No)\n                        if confirm == QMessageBox.No:\n                            return None\n\n            table.download_data(MAX_DL_LIMIT)\n            table = Table(table)\n\n        return table\n\n    @classmethod\n    def migrate_settings(cls, settings, version):\n        if version < 2:\n            # Until Orange version 3.4.4 username and password had been stored\n            # in Settings.\n            cm = cls._credential_manager(settings[\"host\"], settings[\"port\"])\n            cm.username = settings[\"username\"]\n            cm.password = settings[\"password\"]",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 39,
                            "end_lineno": 336,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 89,
                            "length": 11
                        },
                        "new_range": {
                            "start": 90,
                            "length": 19
                        },
                        "section": "class OWSql(OWBaseSql):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        self.backendcombo = QComboBox(box)",
                                "type": "context"
                            },
                            {
                                "content": "        if self.backends:",
                                "type": "context"
                            },
                            {
                                "content": "            self.backendcombo.setModel(self.backends)",
                                "type": "context"
                            },
                            {
                                "content": "            names = [backend.display_name for backend in self.backends]",
                                "type": "added"
                            },
                            {
                                "content": "            if self.selected_backend and self.selected_backend in names:",
                                "type": "added"
                            },
                            {
                                "content": "                self.backendcombo.setCurrentText(self.selected_backend)",
                                "type": "added"
                            },
                            {
                                "content": "        else:",
                                "type": "context"
                            },
                            {
                                "content": "            self.Error.no_backends()",
                                "type": "context"
                            },
                            {
                                "content": "            box.setEnabled(False)",
                                "type": "context"
                            },
                            {
                                "content": "        self.backendcombo.currentTextChanged.connect(self.__backend_changed)",
                                "type": "added"
                            },
                            {
                                "content": "        box.layout().insertWidget(0, self.backendcombo)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def __backend_changed(self):",
                                "type": "added"
                            },
                            {
                                "content": "        backend = self.get_backend()",
                                "type": "added"
                            },
                            {
                                "content": "        self.selected_backend = backend.display_name if backend else None",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "    def _add_tables_controls(self):",
                                "type": "context"
                            },
                            {
                                "content": "        vbox = gui.vBox(self.controlArea, \"Tables\", addSpace=True)",
                                "type": "context"
                            },
                            {
                                "content": "        box = gui.vBox(vbox)",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/owsql.py",
                            "type": "class",
                            "name": "OWSql",
                            "content": "class OWSql(OWBaseSql):\n    name = \"SQL Table\"\n    id = \"orange.widgets.data.sql\"\n    description = \"Load dataset from SQL.\"\n    icon = \"icons/SQLTable.svg\"\n    priority = 30\n    category = \"Data\"\n    keywords = [\"load\"]\n\n    class Outputs:\n        data = Output(\"Data\", Table, doc=\"Attribute-valued dataset read from the input file.\")\n\n    settings_version = 2\n\n    selected_backend = Setting(None)\n    table = Setting(None)\n    sql = Setting(\"\")\n    guess_values = Setting(True)\n    download = Setting(False)\n\n    materialize = Setting(False)\n    materialize_table_name = Setting(\"\")\n\n    class Information(OWBaseSql.Information):\n        data_sampled = Msg(\"Data description was generated from a sample.\")\n\n    class Warning(OWBaseSql.Warning):\n        missing_extension = Msg(\"Database is missing extensions: {}\")\n\n    class Error(OWBaseSql.Error):\n        no_backends = Msg(\"Please install a backend to use this widget.\")\n\n    def __init__(self):\n        # Lint\n        self.backends = None\n        self.backendcombo = None\n        self.tables = None\n        self.tablecombo = None\n        self.sqltext = None\n        self.custom_sql = None\n        self.downloadcb = None\n        super().__init__()\n\n    def _setup_gui(self):\n        super()._setup_gui()\n        self._add_backend_controls()\n        self._add_tables_controls()\n\n    def _add_backend_controls(self):\n        box = self.serverbox\n        self.backends = BackendModel(Backend.available_backends())\n        self.backendcombo = QComboBox(box)\n        if self.backends:\n            self.backendcombo.setModel(self.backends)\n            names = [backend.display_name for backend in self.backends]\n            if self.selected_backend and self.selected_backend in names:\n                self.backendcombo.setCurrentText(self.selected_backend)\n        else:\n            self.Error.no_backends()\n            box.setEnabled(False)\n        self.backendcombo.currentTextChanged.connect(self.__backend_changed)\n        box.layout().insertWidget(0, self.backendcombo)\n\n    def __backend_changed(self):\n        backend = self.get_backend()\n        self.selected_backend = backend.display_name if backend else None\n\n    def _add_tables_controls(self):\n        vbox = gui.vBox(self.controlArea, \"Tables\", addSpace=True)\n        box = gui.vBox(vbox)\n        self.tables = TableModel()\n\n        self.tablecombo = QComboBox(\n            minimumContentsLength=35,\n            sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLength\n        )\n        self.tablecombo.setModel(self.tables)\n        self.tablecombo.setToolTip('table')\n        self.tablecombo.activated[int].connect(self.select_table)\n        box.layout().addWidget(self.tablecombo)\n\n        self.custom_sql = gui.vBox(box)\n        self.custom_sql.setVisible(False)\n        self.sqltext = QTextEdit(self.custom_sql)\n        self.sqltext.setPlainText(self.sql)\n        self.custom_sql.layout().addWidget(self.sqltext)\n\n        mt = gui.hBox(self.custom_sql)\n        cb = gui.checkBox(mt, self, 'materialize', 'Materialize to table ')\n        cb.setToolTip('Save results of the query in a table')\n        le = gui.lineEdit(mt, self, 'materialize_table_name')\n        le.setToolTip('Save results of the query in a table')\n\n        gui.button(self.custom_sql, self, 'Execute', callback=self.open_table)\n\n        box.layout().addWidget(self.custom_sql)\n\n        gui.checkBox(box, self, \"guess_values\",\n                     \"Auto-discover categorical variables\",\n                     callback=self.open_table)\n\n        self.downloadcb = gui.checkBox(box, self, \"download\",\n                                       \"Download data to local memory\",\n                                       callback=self.open_table)\n\n    def highlight_error(self, text=\"\"):\n        err = ['', 'QLineEdit {border: 2px solid red;}']\n        self.servertext.setStyleSheet(err['server' in text or 'host' in text])\n        self.usernametext.setStyleSheet(err['role' in text])\n        self.databasetext.setStyleSheet(err['database' in text])\n\n    def get_backend(self):\n        if self.backendcombo.currentIndex() < 0:\n            return None\n        return self.backends[self.backendcombo.currentIndex()]\n\n    def on_connection_success(self):\n        if getattr(self.backend, 'missing_extension', False):\n            self.Warning.missing_extension(\n                \", \".join(self.backend.missing_extension))\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        if not is_postgres(self.backend):\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        super().on_connection_success()\n        self.refresh_tables()\n        self.select_table()\n\n    def on_connection_error(self, err):\n        super().on_connection_error(err)\n        self.highlight_error(str(err).split(\"\\n\")[0])\n\n    def clear(self):\n        super().clear()\n        self.Warning.missing_extension.clear()\n        self.downloadcb.setEnabled(True)\n        self.highlight_error()\n        self.tablecombo.clear()\n        self.tablecombo.repaint()\n\n    def refresh_tables(self):\n        self.tables.clear()\n        if self.backend is None:\n            self.data_desc_table = None\n            return\n\n        self.tables.append(\"Select a table\")\n        self.tables.append(\"Custom SQL\")\n        self.tables.extend(self.backend.list_tables(self.schema))\n        index = self.tablecombo.findText(str(self.table))\n        self.tablecombo.setCurrentIndex(index if index != -1 else 0)\n        self.tablecombo.repaint()\n\n    # Called on tablecombo selection change:\n    def select_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.custom_sql.setVisible(False)\n            return self.open_table()\n        else:\n            self.custom_sql.setVisible(True)\n            self.data_desc_table = None\n            self.database_desc[\"Table\"] = \"(None)\"\n            self.table = None\n            if len(str(self.sql)) > 14:\n                return self.open_table()\n        return None\n\n    def get_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if curIdx <= 0:\n            if self.database_desc:\n                self.database_desc[\"Table\"] = \"(None)\"\n            self.data_desc_table = None\n            return None\n\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.table = self.tables[self.tablecombo.currentIndex()]\n            self.database_desc[\"Table\"] = self.table\n            if \"Query\" in self.database_desc:\n                del self.database_desc[\"Query\"]\n            what = self.table\n        else:\n            what = self.sql = self.sqltext.toPlainText()\n            self.table = \"Custom SQL\"\n            if self.materialize:\n                if not self.materialize_table_name:\n                    self.Error.connection(\n                        \"Specify a table name to materialize the query\")\n                    return None\n                try:\n                    with self.backend.execute_sql_query(\"DROP TABLE IF EXISTS \" +\n                                                        self.materialize_table_name):\n                        pass\n                    with self.backend.execute_sql_query(\"CREATE TABLE \" +\n                                                        self.materialize_table_name +\n                                                        \" AS \" + self.sql):\n                        pass\n                    with self.backend.execute_sql_query(\"ANALYZE \" + self.materialize_table_name):\n                        pass\n                except BackendError as ex:\n                    self.Error.connection(str(ex))\n                    return None\n\n        try:\n            table = SqlTable(dict(host=self.host,\n                                  port=self.port,\n                                  database=self.database,\n                                  user=self.username,\n                                  password=self.password),\n                             what,\n                             backend=type(self.backend),\n                             inspect_values=False)\n        except BackendError as ex:\n            self.Error.connection(str(ex))\n            return None\n\n        self.Error.connection.clear()\n\n        sample = False\n\n        if table.approx_len() > LARGE_TABLE and self.guess_values:\n            confirm = QMessageBox(self)\n            confirm.setIcon(QMessageBox.Warning)\n            confirm.setText(\"Attribute discovery might take \"\n                            \"a long time on large tables.\\n\"\n                            \"Do you want to auto discover attributes?\")\n            confirm.addButton(\"Yes\", QMessageBox.YesRole)\n            no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n            if is_postgres(self.backend):\n                sample_button = confirm.addButton(\"Yes, on a sample\",\n                                                  QMessageBox.YesRole)\n            confirm.exec()\n            if confirm.clickedButton() == no_button:\n                self.guess_values = False\n            elif is_postgres(self.backend) and \\\n                    confirm.clickedButton() == sample_button:\n                sample = True\n\n        self.Information.clear()\n        if self.guess_values:\n            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))\n            if sample:\n                s = table.sample_time(1)\n                domain = s.get_domain(inspect_values=True)\n                self.Information.data_sampled()\n            else:\n                domain = table.get_domain(inspect_values=True)\n            QApplication.restoreOverrideCursor()\n            table.domain = domain\n\n        if self.download:\n            if table.approx_len() > AUTO_DL_LIMIT:\n                if is_postgres(self.backend):\n                    confirm = QMessageBox(self)\n                    confirm.setIcon(QMessageBox.Warning)\n                    confirm.setText(\"Data appears to be big. Do you really \"\n                                    \"want to download it to local memory?\")\n\n                    if table.approx_len() <= MAX_DL_LIMIT:\n                        confirm.addButton(\"Yes\", QMessageBox.YesRole)\n                    no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n                    sample_button = confirm.addButton(\"Yes, a sample\",\n                                                      QMessageBox.YesRole)\n                    confirm.exec()\n                    if confirm.clickedButton() == no_button:\n                        return None\n                    elif confirm.clickedButton() == sample_button:\n                        table = table.sample_percentage(\n                            AUTO_DL_LIMIT / table.approx_len() * 100)\n                else:\n                    if table.approx_len() > MAX_DL_LIMIT:\n                        QMessageBox.warning(\n                            self, 'Warning', \"Data is too big to download.\\n\")\n                        return None\n                    else:\n                        confirm = QMessageBox.question(\n                            self, 'Question',\n                            \"Data appears to be big. Do you really \"\n                            \"want to download it to local memory?\",\n                            QMessageBox.Yes | QMessageBox.No, QMessageBox.No)\n                        if confirm == QMessageBox.No:\n                            return None\n\n            table.download_data(MAX_DL_LIMIT)\n            table = Table(table)\n\n        return table\n\n    @classmethod\n    def migrate_settings(cls, settings, version):\n        if version < 2:\n            # Until Orange version 3.4.4 username and password had been stored\n            # in Settings.\n            cm = cls._credential_manager(settings[\"host\"], settings[\"port\"])\n            cm.username = settings[\"username\"]\n            cm.password = settings[\"password\"]",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 39,
                            "end_lineno": 336,
                            "parent": null
                        },
                        {
                            "file_name": "Orange/widgets/data/owsql.py",
                            "type": "method",
                            "name": "OWSql._add_backend_controls",
                            "content": "class OWSql(OWBaseSql):\n    name = \"SQL Table\"\n    id = \"orange.widgets.data.sql\"\n    description = \"Load dataset from SQL.\"\n    icon = \"icons/SQLTable.svg\"\n    priority = 30\n    category = \"Data\"\n    keywords = [\"load\"]\n\n    class Outputs:\n        data = Output(\"Data\", Table, doc=\"Attribute-valued dataset read from the input file.\")\n\n    settings_version = 2\n\n    selected_backend = Setting(None)\n    table = Setting(None)\n    sql = Setting(\"\")\n    guess_values = Setting(True)\n    download = Setting(False)\n\n    materialize = Setting(False)\n    materialize_table_name = Setting(\"\")\n\n    class Information(OWBaseSql.Information):\n        data_sampled = Msg(\"Data description was generated from a sample.\")\n\n    class Warning(OWBaseSql.Warning):\n        missing_extension = Msg(\"Database is missing extensions: {}\")\n\n    class Error(OWBaseSql.Error):\n        no_backends = Msg(\"Please install a backend to use this widget.\")\n\n    def __init__(self):\n        # Lint\n        self.backends = None\n        self.backendcombo = None\n        self.tables = None\n        self.tablecombo = None\n        self.sqltext = None\n        self.custom_sql = None\n        self.downloadcb = None\n        super().__init__()\n\n    def _setup_gui(self):\n        super()._setup_gui()\n        self._add_backend_controls()\n        self._add_tables_controls()\n\n    def _add_backend_controls(self):\n        box = self.serverbox\n        self.backends = BackendModel(Backend.available_backends())\n        self.backendcombo = QComboBox(box)\n        if self.backends:\n            self.backendcombo.setModel(self.backends)\n            names = [backend.display_name for backend in self.backends]\n            if self.selected_backend and self.selected_backend in names:\n                self.backendcombo.setCurrentText(self.selected_backend)\n        else:\n            self.Error.no_backends()\n            box.setEnabled(False)\n        self.backendcombo.currentTextChanged.connect(self.__backend_changed)\n        box.layout().insertWidget(0, self.backendcombo)\n\n    def __backend_changed(self):\n        backend = self.get_backend()\n        self.selected_backend = backend.display_name if backend else None\n\n    def _add_tables_controls(self):\n        vbox = gui.vBox(self.controlArea, \"Tables\", addSpace=True)\n        box = gui.vBox(vbox)\n        self.tables = TableModel()\n\n        self.tablecombo = QComboBox(\n            minimumContentsLength=35,\n            sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLength\n        )\n        self.tablecombo.setModel(self.tables)\n        self.tablecombo.setToolTip('table')\n        self.tablecombo.activated[int].connect(self.select_table)\n        box.layout().addWidget(self.tablecombo)\n\n        self.custom_sql = gui.vBox(box)\n        self.custom_sql.setVisible(False)\n        self.sqltext = QTextEdit(self.custom_sql)\n        self.sqltext.setPlainText(self.sql)\n        self.custom_sql.layout().addWidget(self.sqltext)\n\n        mt = gui.hBox(self.custom_sql)\n        cb = gui.checkBox(mt, self, 'materialize', 'Materialize to table ')\n        cb.setToolTip('Save results of the query in a table')\n        le = gui.lineEdit(mt, self, 'materialize_table_name')\n        le.setToolTip('Save results of the query in a table')\n\n        gui.button(self.custom_sql, self, 'Execute', callback=self.open_table)\n\n        box.layout().addWidget(self.custom_sql)\n\n        gui.checkBox(box, self, \"guess_values\",\n                     \"Auto-discover categorical variables\",\n                     callback=self.open_table)\n\n        self.downloadcb = gui.checkBox(box, self, \"download\",\n                                       \"Download data to local memory\",\n                                       callback=self.open_table)\n\n    def highlight_error(self, text=\"\"):\n        err = ['', 'QLineEdit {border: 2px solid red;}']\n        self.servertext.setStyleSheet(err['server' in text or 'host' in text])\n        self.usernametext.setStyleSheet(err['role' in text])\n        self.databasetext.setStyleSheet(err['database' in text])\n\n    def get_backend(self):\n        if self.backendcombo.currentIndex() < 0:\n            return None\n        return self.backends[self.backendcombo.currentIndex()]\n\n    def on_connection_success(self):\n        if getattr(self.backend, 'missing_extension', False):\n            self.Warning.missing_extension(\n                \", \".join(self.backend.missing_extension))\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        if not is_postgres(self.backend):\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        super().on_connection_success()\n        self.refresh_tables()\n        self.select_table()\n\n    def on_connection_error(self, err):\n        super().on_connection_error(err)\n        self.highlight_error(str(err).split(\"\\n\")[0])\n\n    def clear(self):\n        super().clear()\n        self.Warning.missing_extension.clear()\n        self.downloadcb.setEnabled(True)\n        self.highlight_error()\n        self.tablecombo.clear()\n        self.tablecombo.repaint()\n\n    def refresh_tables(self):\n        self.tables.clear()\n        if self.backend is None:\n            self.data_desc_table = None\n            return\n\n        self.tables.append(\"Select a table\")\n        self.tables.append(\"Custom SQL\")\n        self.tables.extend(self.backend.list_tables(self.schema))\n        index = self.tablecombo.findText(str(self.table))\n        self.tablecombo.setCurrentIndex(index if index != -1 else 0)\n        self.tablecombo.repaint()\n\n    # Called on tablecombo selection change:\n    def select_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.custom_sql.setVisible(False)\n            return self.open_table()\n        else:\n            self.custom_sql.setVisible(True)\n            self.data_desc_table = None\n            self.database_desc[\"Table\"] = \"(None)\"\n            self.table = None\n            if len(str(self.sql)) > 14:\n                return self.open_table()\n        return None\n\n    def get_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if curIdx <= 0:\n            if self.database_desc:\n                self.database_desc[\"Table\"] = \"(None)\"\n            self.data_desc_table = None\n            return None\n\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.table = self.tables[self.tablecombo.currentIndex()]\n            self.database_desc[\"Table\"] = self.table\n            if \"Query\" in self.database_desc:\n                del self.database_desc[\"Query\"]\n            what = self.table\n        else:\n            what = self.sql = self.sqltext.toPlainText()\n            self.table = \"Custom SQL\"\n            if self.materialize:\n                if not self.materialize_table_name:\n                    self.Error.connection(\n                        \"Specify a table name to materialize the query\")\n                    return None\n                try:\n                    with self.backend.execute_sql_query(\"DROP TABLE IF EXISTS \" +\n                                                        self.materialize_table_name):\n                        pass\n                    with self.backend.execute_sql_query(\"CREATE TABLE \" +\n                                                        self.materialize_table_name +\n                                                        \" AS \" + self.sql):\n                        pass\n                    with self.backend.execute_sql_query(\"ANALYZE \" + self.materialize_table_name):\n                        pass\n                except BackendError as ex:\n                    self.Error.connection(str(ex))\n                    return None\n\n        try:\n            table = SqlTable(dict(host=self.host,\n                                  port=self.port,\n                                  database=self.database,\n                                  user=self.username,\n                                  password=self.password),\n                             what,\n                             backend=type(self.backend),\n                             inspect_values=False)\n        except BackendError as ex:\n            self.Error.connection(str(ex))\n            return None\n\n        self.Error.connection.clear()\n\n        sample = False\n\n        if table.approx_len() > LARGE_TABLE and self.guess_values:\n            confirm = QMessageBox(self)\n            confirm.setIcon(QMessageBox.Warning)\n            confirm.setText(\"Attribute discovery might take \"\n                            \"a long time on large tables.\\n\"\n                            \"Do you want to auto discover attributes?\")\n            confirm.addButton(\"Yes\", QMessageBox.YesRole)\n            no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n            if is_postgres(self.backend):\n                sample_button = confirm.addButton(\"Yes, on a sample\",\n                                                  QMessageBox.YesRole)\n            confirm.exec()\n            if confirm.clickedButton() == no_button:\n                self.guess_values = False\n            elif is_postgres(self.backend) and \\\n                    confirm.clickedButton() == sample_button:\n                sample = True\n\n        self.Information.clear()\n        if self.guess_values:\n            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))\n            if sample:\n                s = table.sample_time(1)\n                domain = s.get_domain(inspect_values=True)\n                self.Information.data_sampled()\n            else:\n                domain = table.get_domain(inspect_values=True)\n            QApplication.restoreOverrideCursor()\n            table.domain = domain\n\n        if self.download:\n            if table.approx_len() > AUTO_DL_LIMIT:\n                if is_postgres(self.backend):\n                    confirm = QMessageBox(self)\n                    confirm.setIcon(QMessageBox.Warning)\n                    confirm.setText(\"Data appears to be big. Do you really \"\n                                    \"want to download it to local memory?\")\n\n                    if table.approx_len() <= MAX_DL_LIMIT:\n                        confirm.addButton(\"Yes\", QMessageBox.YesRole)\n                    no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n                    sample_button = confirm.addButton(\"Yes, a sample\",\n                                                      QMessageBox.YesRole)\n                    confirm.exec()\n                    if confirm.clickedButton() == no_button:\n                        return None\n                    elif confirm.clickedButton() == sample_button:\n                        table = table.sample_percentage(\n                            AUTO_DL_LIMIT / table.approx_len() * 100)\n                else:\n                    if table.approx_len() > MAX_DL_LIMIT:\n                        QMessageBox.warning(\n                            self, 'Warning', \"Data is too big to download.\\n\")\n                        return None\n                    else:\n                        confirm = QMessageBox.question(\n                            self, 'Question',\n                            \"Data appears to be big. Do you really \"\n                            \"want to download it to local memory?\",\n                            QMessageBox.Yes | QMessageBox.No, QMessageBox.No)\n                        if confirm == QMessageBox.No:\n                            return None\n\n            table.download_data(MAX_DL_LIMIT)\n            table = Table(table)\n\n        return table\n\n    @classmethod\n    def migrate_settings(cls, settings, version):\n        if version < 2:\n            # Until Orange version 3.4.4 username and password had been stored\n            # in Settings.\n            cm = cls._credential_manager(settings[\"host\"], settings[\"port\"])\n            cm.username = settings[\"username\"]\n            cm.password = settings[\"password\"]",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 87,
                            "end_lineno": 100,
                            "parent": {
                                "file_name": "Orange/widgets/data/owsql.py",
                                "type": "class",
                                "name": "OWSql",
                                "content": "class OWSql(OWBaseSql):\n    name = \"SQL Table\"\n    id = \"orange.widgets.data.sql\"\n    description = \"Load dataset from SQL.\"\n    icon = \"icons/SQLTable.svg\"\n    priority = 30\n    category = \"Data\"\n    keywords = [\"load\"]\n\n    class Outputs:\n        data = Output(\"Data\", Table, doc=\"Attribute-valued dataset read from the input file.\")\n\n    settings_version = 2\n\n    selected_backend = Setting(None)\n    table = Setting(None)\n    sql = Setting(\"\")\n    guess_values = Setting(True)\n    download = Setting(False)\n\n    materialize = Setting(False)\n    materialize_table_name = Setting(\"\")\n\n    class Information(OWBaseSql.Information):\n        data_sampled = Msg(\"Data description was generated from a sample.\")\n\n    class Warning(OWBaseSql.Warning):\n        missing_extension = Msg(\"Database is missing extensions: {}\")\n\n    class Error(OWBaseSql.Error):\n        no_backends = Msg(\"Please install a backend to use this widget.\")\n\n    def __init__(self):\n        # Lint\n        self.backends = None\n        self.backendcombo = None\n        self.tables = None\n        self.tablecombo = None\n        self.sqltext = None\n        self.custom_sql = None\n        self.downloadcb = None\n        super().__init__()\n\n    def _setup_gui(self):\n        super()._setup_gui()\n        self._add_backend_controls()\n        self._add_tables_controls()\n\n    def _add_backend_controls(self):\n        box = self.serverbox\n        self.backends = BackendModel(Backend.available_backends())\n        self.backendcombo = QComboBox(box)\n        if self.backends:\n            self.backendcombo.setModel(self.backends)\n            names = [backend.display_name for backend in self.backends]\n            if self.selected_backend and self.selected_backend in names:\n                self.backendcombo.setCurrentText(self.selected_backend)\n        else:\n            self.Error.no_backends()\n            box.setEnabled(False)\n        self.backendcombo.currentTextChanged.connect(self.__backend_changed)\n        box.layout().insertWidget(0, self.backendcombo)\n\n    def __backend_changed(self):\n        backend = self.get_backend()\n        self.selected_backend = backend.display_name if backend else None\n\n    def _add_tables_controls(self):\n        vbox = gui.vBox(self.controlArea, \"Tables\", addSpace=True)\n        box = gui.vBox(vbox)\n        self.tables = TableModel()\n\n        self.tablecombo = QComboBox(\n            minimumContentsLength=35,\n            sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLength\n        )\n        self.tablecombo.setModel(self.tables)\n        self.tablecombo.setToolTip('table')\n        self.tablecombo.activated[int].connect(self.select_table)\n        box.layout().addWidget(self.tablecombo)\n\n        self.custom_sql = gui.vBox(box)\n        self.custom_sql.setVisible(False)\n        self.sqltext = QTextEdit(self.custom_sql)\n        self.sqltext.setPlainText(self.sql)\n        self.custom_sql.layout().addWidget(self.sqltext)\n\n        mt = gui.hBox(self.custom_sql)\n        cb = gui.checkBox(mt, self, 'materialize', 'Materialize to table ')\n        cb.setToolTip('Save results of the query in a table')\n        le = gui.lineEdit(mt, self, 'materialize_table_name')\n        le.setToolTip('Save results of the query in a table')\n\n        gui.button(self.custom_sql, self, 'Execute', callback=self.open_table)\n\n        box.layout().addWidget(self.custom_sql)\n\n        gui.checkBox(box, self, \"guess_values\",\n                     \"Auto-discover categorical variables\",\n                     callback=self.open_table)\n\n        self.downloadcb = gui.checkBox(box, self, \"download\",\n                                       \"Download data to local memory\",\n                                       callback=self.open_table)\n\n    def highlight_error(self, text=\"\"):\n        err = ['', 'QLineEdit {border: 2px solid red;}']\n        self.servertext.setStyleSheet(err['server' in text or 'host' in text])\n        self.usernametext.setStyleSheet(err['role' in text])\n        self.databasetext.setStyleSheet(err['database' in text])\n\n    def get_backend(self):\n        if self.backendcombo.currentIndex() < 0:\n            return None\n        return self.backends[self.backendcombo.currentIndex()]\n\n    def on_connection_success(self):\n        if getattr(self.backend, 'missing_extension', False):\n            self.Warning.missing_extension(\n                \", \".join(self.backend.missing_extension))\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        if not is_postgres(self.backend):\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        super().on_connection_success()\n        self.refresh_tables()\n        self.select_table()\n\n    def on_connection_error(self, err):\n        super().on_connection_error(err)\n        self.highlight_error(str(err).split(\"\\n\")[0])\n\n    def clear(self):\n        super().clear()\n        self.Warning.missing_extension.clear()\n        self.downloadcb.setEnabled(True)\n        self.highlight_error()\n        self.tablecombo.clear()\n        self.tablecombo.repaint()\n\n    def refresh_tables(self):\n        self.tables.clear()\n        if self.backend is None:\n            self.data_desc_table = None\n            return\n\n        self.tables.append(\"Select a table\")\n        self.tables.append(\"Custom SQL\")\n        self.tables.extend(self.backend.list_tables(self.schema))\n        index = self.tablecombo.findText(str(self.table))\n        self.tablecombo.setCurrentIndex(index if index != -1 else 0)\n        self.tablecombo.repaint()\n\n    # Called on tablecombo selection change:\n    def select_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.custom_sql.setVisible(False)\n            return self.open_table()\n        else:\n            self.custom_sql.setVisible(True)\n            self.data_desc_table = None\n            self.database_desc[\"Table\"] = \"(None)\"\n            self.table = None\n            if len(str(self.sql)) > 14:\n                return self.open_table()\n        return None\n\n    def get_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if curIdx <= 0:\n            if self.database_desc:\n                self.database_desc[\"Table\"] = \"(None)\"\n            self.data_desc_table = None\n            return None\n\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.table = self.tables[self.tablecombo.currentIndex()]\n            self.database_desc[\"Table\"] = self.table\n            if \"Query\" in self.database_desc:\n                del self.database_desc[\"Query\"]\n            what = self.table\n        else:\n            what = self.sql = self.sqltext.toPlainText()\n            self.table = \"Custom SQL\"\n            if self.materialize:\n                if not self.materialize_table_name:\n                    self.Error.connection(\n                        \"Specify a table name to materialize the query\")\n                    return None\n                try:\n                    with self.backend.execute_sql_query(\"DROP TABLE IF EXISTS \" +\n                                                        self.materialize_table_name):\n                        pass\n                    with self.backend.execute_sql_query(\"CREATE TABLE \" +\n                                                        self.materialize_table_name +\n                                                        \" AS \" + self.sql):\n                        pass\n                    with self.backend.execute_sql_query(\"ANALYZE \" + self.materialize_table_name):\n                        pass\n                except BackendError as ex:\n                    self.Error.connection(str(ex))\n                    return None\n\n        try:\n            table = SqlTable(dict(host=self.host,\n                                  port=self.port,\n                                  database=self.database,\n                                  user=self.username,\n                                  password=self.password),\n                             what,\n                             backend=type(self.backend),\n                             inspect_values=False)\n        except BackendError as ex:\n            self.Error.connection(str(ex))\n            return None\n\n        self.Error.connection.clear()\n\n        sample = False\n\n        if table.approx_len() > LARGE_TABLE and self.guess_values:\n            confirm = QMessageBox(self)\n            confirm.setIcon(QMessageBox.Warning)\n            confirm.setText(\"Attribute discovery might take \"\n                            \"a long time on large tables.\\n\"\n                            \"Do you want to auto discover attributes?\")\n            confirm.addButton(\"Yes\", QMessageBox.YesRole)\n            no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n            if is_postgres(self.backend):\n                sample_button = confirm.addButton(\"Yes, on a sample\",\n                                                  QMessageBox.YesRole)\n            confirm.exec()\n            if confirm.clickedButton() == no_button:\n                self.guess_values = False\n            elif is_postgres(self.backend) and \\\n                    confirm.clickedButton() == sample_button:\n                sample = True\n\n        self.Information.clear()\n        if self.guess_values:\n            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))\n            if sample:\n                s = table.sample_time(1)\n                domain = s.get_domain(inspect_values=True)\n                self.Information.data_sampled()\n            else:\n                domain = table.get_domain(inspect_values=True)\n            QApplication.restoreOverrideCursor()\n            table.domain = domain\n\n        if self.download:\n            if table.approx_len() > AUTO_DL_LIMIT:\n                if is_postgres(self.backend):\n                    confirm = QMessageBox(self)\n                    confirm.setIcon(QMessageBox.Warning)\n                    confirm.setText(\"Data appears to be big. Do you really \"\n                                    \"want to download it to local memory?\")\n\n                    if table.approx_len() <= MAX_DL_LIMIT:\n                        confirm.addButton(\"Yes\", QMessageBox.YesRole)\n                    no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n                    sample_button = confirm.addButton(\"Yes, a sample\",\n                                                      QMessageBox.YesRole)\n                    confirm.exec()\n                    if confirm.clickedButton() == no_button:\n                        return None\n                    elif confirm.clickedButton() == sample_button:\n                        table = table.sample_percentage(\n                            AUTO_DL_LIMIT / table.approx_len() * 100)\n                else:\n                    if table.approx_len() > MAX_DL_LIMIT:\n                        QMessageBox.warning(\n                            self, 'Warning', \"Data is too big to download.\\n\")\n                        return None\n                    else:\n                        confirm = QMessageBox.question(\n                            self, 'Question',\n                            \"Data appears to be big. Do you really \"\n                            \"want to download it to local memory?\",\n                            QMessageBox.Yes | QMessageBox.No, QMessageBox.No)\n                        if confirm == QMessageBox.No:\n                            return None\n\n            table.download_data(MAX_DL_LIMIT)\n            table = Table(table)\n\n        return table\n\n    @classmethod\n    def migrate_settings(cls, settings, version):\n        if version < 2:\n            # Until Orange version 3.4.4 username and password had been stored\n            # in Settings.\n            cm = cls._credential_manager(settings[\"host\"], settings[\"port\"])\n            cm.username = settings[\"username\"]\n            cm.password = settings[\"password\"]",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 39,
                                "end_lineno": 336,
                                "parent": null
                            }
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "Orange/widgets/data/owsql.py",
                            "type": "method",
                            "name": "OWSql.__backend_changed",
                            "content": "class OWSql(OWBaseSql):\n    name = \"SQL Table\"\n    id = \"orange.widgets.data.sql\"\n    description = \"Load dataset from SQL.\"\n    icon = \"icons/SQLTable.svg\"\n    priority = 30\n    category = \"Data\"\n    keywords = [\"load\"]\n\n    class Outputs:\n        data = Output(\"Data\", Table, doc=\"Attribute-valued dataset read from the input file.\")\n\n    settings_version = 2\n\n    selected_backend = Setting(None)\n    table = Setting(None)\n    sql = Setting(\"\")\n    guess_values = Setting(True)\n    download = Setting(False)\n\n    materialize = Setting(False)\n    materialize_table_name = Setting(\"\")\n\n    class Information(OWBaseSql.Information):\n        data_sampled = Msg(\"Data description was generated from a sample.\")\n\n    class Warning(OWBaseSql.Warning):\n        missing_extension = Msg(\"Database is missing extensions: {}\")\n\n    class Error(OWBaseSql.Error):\n        no_backends = Msg(\"Please install a backend to use this widget.\")\n\n    def __init__(self):\n        # Lint\n        self.backends = None\n        self.backendcombo = None\n        self.tables = None\n        self.tablecombo = None\n        self.sqltext = None\n        self.custom_sql = None\n        self.downloadcb = None\n        super().__init__()\n\n    def _setup_gui(self):\n        super()._setup_gui()\n        self._add_backend_controls()\n        self._add_tables_controls()\n\n    def _add_backend_controls(self):\n        box = self.serverbox\n        self.backends = BackendModel(Backend.available_backends())\n        self.backendcombo = QComboBox(box)\n        if self.backends:\n            self.backendcombo.setModel(self.backends)\n            names = [backend.display_name for backend in self.backends]\n            if self.selected_backend and self.selected_backend in names:\n                self.backendcombo.setCurrentText(self.selected_backend)\n        else:\n            self.Error.no_backends()\n            box.setEnabled(False)\n        self.backendcombo.currentTextChanged.connect(self.__backend_changed)\n        box.layout().insertWidget(0, self.backendcombo)\n\n    def __backend_changed(self):\n        backend = self.get_backend()\n        self.selected_backend = backend.display_name if backend else None\n\n    def _add_tables_controls(self):\n        vbox = gui.vBox(self.controlArea, \"Tables\", addSpace=True)\n        box = gui.vBox(vbox)\n        self.tables = TableModel()\n\n        self.tablecombo = QComboBox(\n            minimumContentsLength=35,\n            sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLength\n        )\n        self.tablecombo.setModel(self.tables)\n        self.tablecombo.setToolTip('table')\n        self.tablecombo.activated[int].connect(self.select_table)\n        box.layout().addWidget(self.tablecombo)\n\n        self.custom_sql = gui.vBox(box)\n        self.custom_sql.setVisible(False)\n        self.sqltext = QTextEdit(self.custom_sql)\n        self.sqltext.setPlainText(self.sql)\n        self.custom_sql.layout().addWidget(self.sqltext)\n\n        mt = gui.hBox(self.custom_sql)\n        cb = gui.checkBox(mt, self, 'materialize', 'Materialize to table ')\n        cb.setToolTip('Save results of the query in a table')\n        le = gui.lineEdit(mt, self, 'materialize_table_name')\n        le.setToolTip('Save results of the query in a table')\n\n        gui.button(self.custom_sql, self, 'Execute', callback=self.open_table)\n\n        box.layout().addWidget(self.custom_sql)\n\n        gui.checkBox(box, self, \"guess_values\",\n                     \"Auto-discover categorical variables\",\n                     callback=self.open_table)\n\n        self.downloadcb = gui.checkBox(box, self, \"download\",\n                                       \"Download data to local memory\",\n                                       callback=self.open_table)\n\n    def highlight_error(self, text=\"\"):\n        err = ['', 'QLineEdit {border: 2px solid red;}']\n        self.servertext.setStyleSheet(err['server' in text or 'host' in text])\n        self.usernametext.setStyleSheet(err['role' in text])\n        self.databasetext.setStyleSheet(err['database' in text])\n\n    def get_backend(self):\n        if self.backendcombo.currentIndex() < 0:\n            return None\n        return self.backends[self.backendcombo.currentIndex()]\n\n    def on_connection_success(self):\n        if getattr(self.backend, 'missing_extension', False):\n            self.Warning.missing_extension(\n                \", \".join(self.backend.missing_extension))\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        if not is_postgres(self.backend):\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        super().on_connection_success()\n        self.refresh_tables()\n        self.select_table()\n\n    def on_connection_error(self, err):\n        super().on_connection_error(err)\n        self.highlight_error(str(err).split(\"\\n\")[0])\n\n    def clear(self):\n        super().clear()\n        self.Warning.missing_extension.clear()\n        self.downloadcb.setEnabled(True)\n        self.highlight_error()\n        self.tablecombo.clear()\n        self.tablecombo.repaint()\n\n    def refresh_tables(self):\n        self.tables.clear()\n        if self.backend is None:\n            self.data_desc_table = None\n            return\n\n        self.tables.append(\"Select a table\")\n        self.tables.append(\"Custom SQL\")\n        self.tables.extend(self.backend.list_tables(self.schema))\n        index = self.tablecombo.findText(str(self.table))\n        self.tablecombo.setCurrentIndex(index if index != -1 else 0)\n        self.tablecombo.repaint()\n\n    # Called on tablecombo selection change:\n    def select_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.custom_sql.setVisible(False)\n            return self.open_table()\n        else:\n            self.custom_sql.setVisible(True)\n            self.data_desc_table = None\n            self.database_desc[\"Table\"] = \"(None)\"\n            self.table = None\n            if len(str(self.sql)) > 14:\n                return self.open_table()\n        return None\n\n    def get_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if curIdx <= 0:\n            if self.database_desc:\n                self.database_desc[\"Table\"] = \"(None)\"\n            self.data_desc_table = None\n            return None\n\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.table = self.tables[self.tablecombo.currentIndex()]\n            self.database_desc[\"Table\"] = self.table\n            if \"Query\" in self.database_desc:\n                del self.database_desc[\"Query\"]\n            what = self.table\n        else:\n            what = self.sql = self.sqltext.toPlainText()\n            self.table = \"Custom SQL\"\n            if self.materialize:\n                if not self.materialize_table_name:\n                    self.Error.connection(\n                        \"Specify a table name to materialize the query\")\n                    return None\n                try:\n                    with self.backend.execute_sql_query(\"DROP TABLE IF EXISTS \" +\n                                                        self.materialize_table_name):\n                        pass\n                    with self.backend.execute_sql_query(\"CREATE TABLE \" +\n                                                        self.materialize_table_name +\n                                                        \" AS \" + self.sql):\n                        pass\n                    with self.backend.execute_sql_query(\"ANALYZE \" + self.materialize_table_name):\n                        pass\n                except BackendError as ex:\n                    self.Error.connection(str(ex))\n                    return None\n\n        try:\n            table = SqlTable(dict(host=self.host,\n                                  port=self.port,\n                                  database=self.database,\n                                  user=self.username,\n                                  password=self.password),\n                             what,\n                             backend=type(self.backend),\n                             inspect_values=False)\n        except BackendError as ex:\n            self.Error.connection(str(ex))\n            return None\n\n        self.Error.connection.clear()\n\n        sample = False\n\n        if table.approx_len() > LARGE_TABLE and self.guess_values:\n            confirm = QMessageBox(self)\n            confirm.setIcon(QMessageBox.Warning)\n            confirm.setText(\"Attribute discovery might take \"\n                            \"a long time on large tables.\\n\"\n                            \"Do you want to auto discover attributes?\")\n            confirm.addButton(\"Yes\", QMessageBox.YesRole)\n            no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n            if is_postgres(self.backend):\n                sample_button = confirm.addButton(\"Yes, on a sample\",\n                                                  QMessageBox.YesRole)\n            confirm.exec()\n            if confirm.clickedButton() == no_button:\n                self.guess_values = False\n            elif is_postgres(self.backend) and \\\n                    confirm.clickedButton() == sample_button:\n                sample = True\n\n        self.Information.clear()\n        if self.guess_values:\n            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))\n            if sample:\n                s = table.sample_time(1)\n                domain = s.get_domain(inspect_values=True)\n                self.Information.data_sampled()\n            else:\n                domain = table.get_domain(inspect_values=True)\n            QApplication.restoreOverrideCursor()\n            table.domain = domain\n\n        if self.download:\n            if table.approx_len() > AUTO_DL_LIMIT:\n                if is_postgres(self.backend):\n                    confirm = QMessageBox(self)\n                    confirm.setIcon(QMessageBox.Warning)\n                    confirm.setText(\"Data appears to be big. Do you really \"\n                                    \"want to download it to local memory?\")\n\n                    if table.approx_len() <= MAX_DL_LIMIT:\n                        confirm.addButton(\"Yes\", QMessageBox.YesRole)\n                    no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n                    sample_button = confirm.addButton(\"Yes, a sample\",\n                                                      QMessageBox.YesRole)\n                    confirm.exec()\n                    if confirm.clickedButton() == no_button:\n                        return None\n                    elif confirm.clickedButton() == sample_button:\n                        table = table.sample_percentage(\n                            AUTO_DL_LIMIT / table.approx_len() * 100)\n                else:\n                    if table.approx_len() > MAX_DL_LIMIT:\n                        QMessageBox.warning(\n                            self, 'Warning', \"Data is too big to download.\\n\")\n                        return None\n                    else:\n                        confirm = QMessageBox.question(\n                            self, 'Question',\n                            \"Data appears to be big. Do you really \"\n                            \"want to download it to local memory?\",\n                            QMessageBox.Yes | QMessageBox.No, QMessageBox.No)\n                        if confirm == QMessageBox.No:\n                            return None\n\n            table.download_data(MAX_DL_LIMIT)\n            table = Table(table)\n\n        return table\n\n    @classmethod\n    def migrate_settings(cls, settings, version):\n        if version < 2:\n            # Until Orange version 3.4.4 username and password had been stored\n            # in Settings.\n            cm = cls._credential_manager(settings[\"host\"], settings[\"port\"])\n            cm.username = settings[\"username\"]\n            cm.password = settings[\"password\"]",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 102,
                            "end_lineno": 104,
                            "parent": {
                                "file_name": "Orange/widgets/data/owsql.py",
                                "type": "class",
                                "name": "OWSql",
                                "content": "class OWSql(OWBaseSql):\n    name = \"SQL Table\"\n    id = \"orange.widgets.data.sql\"\n    description = \"Load dataset from SQL.\"\n    icon = \"icons/SQLTable.svg\"\n    priority = 30\n    category = \"Data\"\n    keywords = [\"load\"]\n\n    class Outputs:\n        data = Output(\"Data\", Table, doc=\"Attribute-valued dataset read from the input file.\")\n\n    settings_version = 2\n\n    selected_backend = Setting(None)\n    table = Setting(None)\n    sql = Setting(\"\")\n    guess_values = Setting(True)\n    download = Setting(False)\n\n    materialize = Setting(False)\n    materialize_table_name = Setting(\"\")\n\n    class Information(OWBaseSql.Information):\n        data_sampled = Msg(\"Data description was generated from a sample.\")\n\n    class Warning(OWBaseSql.Warning):\n        missing_extension = Msg(\"Database is missing extensions: {}\")\n\n    class Error(OWBaseSql.Error):\n        no_backends = Msg(\"Please install a backend to use this widget.\")\n\n    def __init__(self):\n        # Lint\n        self.backends = None\n        self.backendcombo = None\n        self.tables = None\n        self.tablecombo = None\n        self.sqltext = None\n        self.custom_sql = None\n        self.downloadcb = None\n        super().__init__()\n\n    def _setup_gui(self):\n        super()._setup_gui()\n        self._add_backend_controls()\n        self._add_tables_controls()\n\n    def _add_backend_controls(self):\n        box = self.serverbox\n        self.backends = BackendModel(Backend.available_backends())\n        self.backendcombo = QComboBox(box)\n        if self.backends:\n            self.backendcombo.setModel(self.backends)\n            names = [backend.display_name for backend in self.backends]\n            if self.selected_backend and self.selected_backend in names:\n                self.backendcombo.setCurrentText(self.selected_backend)\n        else:\n            self.Error.no_backends()\n            box.setEnabled(False)\n        self.backendcombo.currentTextChanged.connect(self.__backend_changed)\n        box.layout().insertWidget(0, self.backendcombo)\n\n    def __backend_changed(self):\n        backend = self.get_backend()\n        self.selected_backend = backend.display_name if backend else None\n\n    def _add_tables_controls(self):\n        vbox = gui.vBox(self.controlArea, \"Tables\", addSpace=True)\n        box = gui.vBox(vbox)\n        self.tables = TableModel()\n\n        self.tablecombo = QComboBox(\n            minimumContentsLength=35,\n            sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLength\n        )\n        self.tablecombo.setModel(self.tables)\n        self.tablecombo.setToolTip('table')\n        self.tablecombo.activated[int].connect(self.select_table)\n        box.layout().addWidget(self.tablecombo)\n\n        self.custom_sql = gui.vBox(box)\n        self.custom_sql.setVisible(False)\n        self.sqltext = QTextEdit(self.custom_sql)\n        self.sqltext.setPlainText(self.sql)\n        self.custom_sql.layout().addWidget(self.sqltext)\n\n        mt = gui.hBox(self.custom_sql)\n        cb = gui.checkBox(mt, self, 'materialize', 'Materialize to table ')\n        cb.setToolTip('Save results of the query in a table')\n        le = gui.lineEdit(mt, self, 'materialize_table_name')\n        le.setToolTip('Save results of the query in a table')\n\n        gui.button(self.custom_sql, self, 'Execute', callback=self.open_table)\n\n        box.layout().addWidget(self.custom_sql)\n\n        gui.checkBox(box, self, \"guess_values\",\n                     \"Auto-discover categorical variables\",\n                     callback=self.open_table)\n\n        self.downloadcb = gui.checkBox(box, self, \"download\",\n                                       \"Download data to local memory\",\n                                       callback=self.open_table)\n\n    def highlight_error(self, text=\"\"):\n        err = ['', 'QLineEdit {border: 2px solid red;}']\n        self.servertext.setStyleSheet(err['server' in text or 'host' in text])\n        self.usernametext.setStyleSheet(err['role' in text])\n        self.databasetext.setStyleSheet(err['database' in text])\n\n    def get_backend(self):\n        if self.backendcombo.currentIndex() < 0:\n            return None\n        return self.backends[self.backendcombo.currentIndex()]\n\n    def on_connection_success(self):\n        if getattr(self.backend, 'missing_extension', False):\n            self.Warning.missing_extension(\n                \", \".join(self.backend.missing_extension))\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        if not is_postgres(self.backend):\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        super().on_connection_success()\n        self.refresh_tables()\n        self.select_table()\n\n    def on_connection_error(self, err):\n        super().on_connection_error(err)\n        self.highlight_error(str(err).split(\"\\n\")[0])\n\n    def clear(self):\n        super().clear()\n        self.Warning.missing_extension.clear()\n        self.downloadcb.setEnabled(True)\n        self.highlight_error()\n        self.tablecombo.clear()\n        self.tablecombo.repaint()\n\n    def refresh_tables(self):\n        self.tables.clear()\n        if self.backend is None:\n            self.data_desc_table = None\n            return\n\n        self.tables.append(\"Select a table\")\n        self.tables.append(\"Custom SQL\")\n        self.tables.extend(self.backend.list_tables(self.schema))\n        index = self.tablecombo.findText(str(self.table))\n        self.tablecombo.setCurrentIndex(index if index != -1 else 0)\n        self.tablecombo.repaint()\n\n    # Called on tablecombo selection change:\n    def select_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.custom_sql.setVisible(False)\n            return self.open_table()\n        else:\n            self.custom_sql.setVisible(True)\n            self.data_desc_table = None\n            self.database_desc[\"Table\"] = \"(None)\"\n            self.table = None\n            if len(str(self.sql)) > 14:\n                return self.open_table()\n        return None\n\n    def get_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if curIdx <= 0:\n            if self.database_desc:\n                self.database_desc[\"Table\"] = \"(None)\"\n            self.data_desc_table = None\n            return None\n\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.table = self.tables[self.tablecombo.currentIndex()]\n            self.database_desc[\"Table\"] = self.table\n            if \"Query\" in self.database_desc:\n                del self.database_desc[\"Query\"]\n            what = self.table\n        else:\n            what = self.sql = self.sqltext.toPlainText()\n            self.table = \"Custom SQL\"\n            if self.materialize:\n                if not self.materialize_table_name:\n                    self.Error.connection(\n                        \"Specify a table name to materialize the query\")\n                    return None\n                try:\n                    with self.backend.execute_sql_query(\"DROP TABLE IF EXISTS \" +\n                                                        self.materialize_table_name):\n                        pass\n                    with self.backend.execute_sql_query(\"CREATE TABLE \" +\n                                                        self.materialize_table_name +\n                                                        \" AS \" + self.sql):\n                        pass\n                    with self.backend.execute_sql_query(\"ANALYZE \" + self.materialize_table_name):\n                        pass\n                except BackendError as ex:\n                    self.Error.connection(str(ex))\n                    return None\n\n        try:\n            table = SqlTable(dict(host=self.host,\n                                  port=self.port,\n                                  database=self.database,\n                                  user=self.username,\n                                  password=self.password),\n                             what,\n                             backend=type(self.backend),\n                             inspect_values=False)\n        except BackendError as ex:\n            self.Error.connection(str(ex))\n            return None\n\n        self.Error.connection.clear()\n\n        sample = False\n\n        if table.approx_len() > LARGE_TABLE and self.guess_values:\n            confirm = QMessageBox(self)\n            confirm.setIcon(QMessageBox.Warning)\n            confirm.setText(\"Attribute discovery might take \"\n                            \"a long time on large tables.\\n\"\n                            \"Do you want to auto discover attributes?\")\n            confirm.addButton(\"Yes\", QMessageBox.YesRole)\n            no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n            if is_postgres(self.backend):\n                sample_button = confirm.addButton(\"Yes, on a sample\",\n                                                  QMessageBox.YesRole)\n            confirm.exec()\n            if confirm.clickedButton() == no_button:\n                self.guess_values = False\n            elif is_postgres(self.backend) and \\\n                    confirm.clickedButton() == sample_button:\n                sample = True\n\n        self.Information.clear()\n        if self.guess_values:\n            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))\n            if sample:\n                s = table.sample_time(1)\n                domain = s.get_domain(inspect_values=True)\n                self.Information.data_sampled()\n            else:\n                domain = table.get_domain(inspect_values=True)\n            QApplication.restoreOverrideCursor()\n            table.domain = domain\n\n        if self.download:\n            if table.approx_len() > AUTO_DL_LIMIT:\n                if is_postgres(self.backend):\n                    confirm = QMessageBox(self)\n                    confirm.setIcon(QMessageBox.Warning)\n                    confirm.setText(\"Data appears to be big. Do you really \"\n                                    \"want to download it to local memory?\")\n\n                    if table.approx_len() <= MAX_DL_LIMIT:\n                        confirm.addButton(\"Yes\", QMessageBox.YesRole)\n                    no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n                    sample_button = confirm.addButton(\"Yes, a sample\",\n                                                      QMessageBox.YesRole)\n                    confirm.exec()\n                    if confirm.clickedButton() == no_button:\n                        return None\n                    elif confirm.clickedButton() == sample_button:\n                        table = table.sample_percentage(\n                            AUTO_DL_LIMIT / table.approx_len() * 100)\n                else:\n                    if table.approx_len() > MAX_DL_LIMIT:\n                        QMessageBox.warning(\n                            self, 'Warning', \"Data is too big to download.\\n\")\n                        return None\n                    else:\n                        confirm = QMessageBox.question(\n                            self, 'Question',\n                            \"Data appears to be big. Do you really \"\n                            \"want to download it to local memory?\",\n                            QMessageBox.Yes | QMessageBox.No, QMessageBox.No)\n                        if confirm == QMessageBox.No:\n                            return None\n\n            table.download_data(MAX_DL_LIMIT)\n            table = Table(table)\n\n        return table\n\n    @classmethod\n    def migrate_settings(cls, settings, version):\n        if version < 2:\n            # Until Orange version 3.4.4 username and password had been stored\n            # in Settings.\n            cm = cls._credential_manager(settings[\"host\"], settings[\"port\"])\n            cm.username = settings[\"username\"]\n            cm.password = settings[\"password\"]",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 39,
                                "end_lineno": 336,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\n\nimport unittest\nfrom unittest import mock\n\nfrom Orange.data import Table\nfrom Orange.widgets.data.owsql import OWSql\nfrom Orange.widgets.tests.base import WidgetTest\nfrom Orange.tests.sql.base import DataBaseTest as dbt\n\n\nclass TestOWSqlConnected(WidgetTest, dbt):\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        self.widget = self.create_widget(OWSql)\n        self.params, _ = self.create_iris_sql_table()\n        self.iris = Table(\"iris\")\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    @dbt.run_on([\"postgres\"])\n    def test_connection(self):\n        \"\"\"Test if a connection to the database can be established\"\"\"\n        self.set_connection_params()\n        self.widget.connect()\n\n        self.assertFalse(self.widget.Error.connection.is_shown())\n        self.assertIsNotNone(self.widget.database_desc)\n        tables = [\"Select a table\", \"Custom SQL\"]\n        self.assertTrue(set(self.widget.tables).issuperset(set(tables)))\n\n    @dbt.run_on([\"postgres\"])\n    def test_output_iris(self):\n        \"\"\"Test if iris data can be fetched from database\"\"\"\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n        self.set_connection_params()\n        self.widget.connect()\n\n        idx = list(map(str, self.widget.tables)).index(\"iris\")\n        self.widget.tablecombo.setCurrentIndex(idx)\n        self.widget.select_table()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIsNotNone(output)\n        self.assertEqual(len(output), len(self.iris))\n        iris_domain = set(map(str, self.iris.domain.attributes))\n        output_domain = set(map(str, output.domain.attributes))\n        self.assertTrue(output_domain.issuperset(iris_domain))\n\n    def set_connection_params(self):\n        \"\"\"Set database connection parameters on widget\"\"\"\n        port = ''\n        if self.params['port'] is not None:\n            port += ':' + str(self.params['port'])\n        self.widget.servertext.setText(self.params['host'] + port)\n        self.widget.databasetext.setText(self.params['database'])\n        self.widget.usernametext.setText(self.params['user'])\n        self.widget.passwordtext.setText(self.params['password'])\n\n\nclass TestOWSql(WidgetTest):\n\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_missing_extension(self, mock_backends):\n        \"\"\"Test for correctly handled missing backend extension\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"PostgreSQL\"\n        backend().missing_extension = [\"missing extension\"]\n        backend().list_tables.return_value = []\n        mock_backends.available_backends.return_value = [backend]\n\n        settings = {\"host\": \"host\", \"port\": \"port\",\n                    \"database\": \"DB\", \"schema\": \"\",\n                    \"username\": \"username\", \"password\": \"password\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n\n        self.assertTrue(widget.Warning.missing_extension.is_shown())\n        self.assertTrue(widget.download)\n        self.assertFalse(widget.downloadcb.isEnabled())\n\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_non_postgres(self, mock_backends):\n        \"\"\"Test if download is enforced for non postgres backends\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"database\"\n        del backend().missing_extension\n        backend().list_tables.return_value = []\n        mock_backends.available_backends.return_value = [backend]\n\n        settings = {\"host\": \"host\", \"port\": \"port\",\n                    \"database\": \"DB\", \"schema\": \"\",\n                    \"username\": \"username\", \"password\": \"password\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n\n        self.assertTrue(widget.download)\n        self.assertFalse(widget.downloadcb.isEnabled())\n\n    @mock.patch('Orange.widgets.data.owsql.Table')\n    @mock.patch('Orange.widgets.data.owsql.SqlTable')\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_restore_table(self, mock_backends, mock_sqltable, mock_table):\n        \"\"\"Test if selected table is restored from settings\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"database\"\n        del backend().missing_extension\n        backend().list_tables.return_value = [\"a\", \"b\", \"c\"]\n        mock_backends.available_backends.return_value = [backend]\n        mock_sqltable().approx_len.return_value = 100\n\n        settings = {\"host\": \"host\", \"port\": \"port\", \"database\": \"DB\",\n                    \"schema\": \"\", \"username\": \"username\",\n                    \"password\": \"password\", \"table\": \"b\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.tablecombo.currentText(), \"b\")\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\n\nimport unittest\nfrom unittest import mock\n\nfrom Orange.data import Table\nfrom Orange.widgets.data.owsql import OWSql\nfrom Orange.widgets.tests.base import WidgetTest, simulate\nfrom Orange.tests.sql.base import DataBaseTest as dbt\n\n\nclass TestOWSqlConnected(WidgetTest, dbt):\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        self.widget = self.create_widget(OWSql)\n        self.params, _ = self.create_iris_sql_table()\n        self.iris = Table(\"iris\")\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    @dbt.run_on([\"postgres\"])\n    def test_connection(self):\n        \"\"\"Test if a connection to the database can be established\"\"\"\n        self.set_connection_params()\n        self.widget.connect()\n\n        self.assertFalse(self.widget.Error.connection.is_shown())\n        self.assertIsNotNone(self.widget.database_desc)\n        tables = [\"Select a table\", \"Custom SQL\"]\n        self.assertTrue(set(self.widget.tables).issuperset(set(tables)))\n\n    @dbt.run_on([\"postgres\"])\n    def test_output_iris(self):\n        \"\"\"Test if iris data can be fetched from database\"\"\"\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n        self.set_connection_params()\n        self.widget.connect()\n\n        idx = list(map(str, self.widget.tables)).index(\"iris\")\n        self.widget.tablecombo.setCurrentIndex(idx)\n        self.widget.select_table()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIsNotNone(output)\n        self.assertEqual(len(output), len(self.iris))\n        iris_domain = set(map(str, self.iris.domain.attributes))\n        output_domain = set(map(str, output.domain.attributes))\n        self.assertTrue(output_domain.issuperset(iris_domain))\n\n    def set_connection_params(self):\n        \"\"\"Set database connection parameters on widget\"\"\"\n        port = ''\n        if self.params['port'] is not None:\n            port += ':' + str(self.params['port'])\n        self.widget.servertext.setText(self.params['host'] + port)\n        self.widget.databasetext.setText(self.params['database'])\n        self.widget.usernametext.setText(self.params['user'])\n        self.widget.passwordtext.setText(self.params['password'])\n\n\nclass TestOWSql(WidgetTest):\n\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_missing_extension(self, mock_backends):\n        \"\"\"Test for correctly handled missing backend extension\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"PostgreSQL\"\n        backend().missing_extension = [\"missing extension\"]\n        backend().list_tables.return_value = []\n        mock_backends.available_backends.return_value = [backend]\n\n        settings = {\"host\": \"host\", \"port\": \"port\",\n                    \"database\": \"DB\", \"schema\": \"\",\n                    \"username\": \"username\", \"password\": \"password\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n\n        self.assertTrue(widget.Warning.missing_extension.is_shown())\n        self.assertTrue(widget.download)\n        self.assertFalse(widget.downloadcb.isEnabled())\n\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_non_postgres(self, mock_backends):\n        \"\"\"Test if download is enforced for non postgres backends\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"database\"\n        del backend().missing_extension\n        backend().list_tables.return_value = []\n        mock_backends.available_backends.return_value = [backend]\n\n        settings = {\"host\": \"host\", \"port\": \"port\",\n                    \"database\": \"DB\", \"schema\": \"\",\n                    \"username\": \"username\", \"password\": \"password\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n\n        self.assertTrue(widget.download)\n        self.assertFalse(widget.downloadcb.isEnabled())\n\n    @mock.patch('Orange.widgets.data.owsql.Table')\n    @mock.patch('Orange.widgets.data.owsql.SqlTable')\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_restore_table(self, mock_backends, mock_sqltable, mock_table):\n        \"\"\"Test if selected table is restored from settings\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"database\"\n        del backend().missing_extension\n        backend().list_tables.return_value = [\"a\", \"b\", \"c\"]\n        mock_backends.available_backends.return_value = [backend]\n        mock_sqltable().approx_len.return_value = 100\n\n        settings = {\"host\": \"host\", \"port\": \"port\", \"database\": \"DB\",\n                    \"schema\": \"\", \"username\": \"username\",\n                    \"password\": \"password\", \"table\": \"b\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.tablecombo.currentText(), \"b\")\n\n    @mock.patch(\"Orange.data.sql.backend.base.Backend.available_backends\")\n    def test_selected_backend(self, mocked_backends: mock.Mock):\n        b1, b2 = mock.Mock(), mock.Mock()\n        b1.display_name = \"B1\"\n        b2.display_name = \"B2\"\n        mocked_backends.return_value = [b1, b2]\n\n        widget = self.create_widget(OWSql)\n        self.assertEqual(widget.backendcombo.currentText(), \"B1\")\n\n        simulate.combobox_activate_index(widget.backendcombo, 1)\n        self.assertEqual(widget.backendcombo.currentText(), \"B2\")\n\n        settings = widget.settingsHandler.pack_data(widget)\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.backendcombo.currentText(), \"B2\")\n\n        settings = widget.settingsHandler.pack_data(widget)\n        settings[\"selected_backend\"] = \"B3\"\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.backendcombo.currentText(), \"B1\")\n\n        mocked_backends.return_value = []\n        settings = widget.settingsHandler.pack_data(widget)\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.backendcombo.currentText(), \"\")\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/data/tests/test_owsql.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "7d5586f0c",
                "new_commit_hash": "f9a133449",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/data/tests/test_owsql.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/data/tests/test_owsql.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 6,
                            "length": 7
                        },
                        "new_range": {
                            "start": 6,
                            "length": 7
                        },
                        "section": "from unittest import mock"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "from Orange.data import Table",
                                "type": "context"
                            },
                            {
                                "content": "from Orange.widgets.data.owsql import OWSql",
                                "type": "context"
                            },
                            {
                                "content": "from Orange.widgets.tests.base import WidgetTest",
                                "type": "deleted"
                            },
                            {
                                "content": "from Orange.widgets.tests.base import WidgetTest, simulate",
                                "type": "added"
                            },
                            {
                                "content": "from Orange.tests.sql.base import DataBaseTest as dbt",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [],
                    "added_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owsql.py",
                            "type": "statement",
                            "name": "",
                            "content": "from Orange.widgets.tests.base import WidgetTest, simulate",
                            "ast_type_str": "ImportFrom",
                            "start_lineno": 9,
                            "end_lineno": 9,
                            "parent": null
                        }
                    ],
                    "deleted_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owsql.py",
                            "type": "statement",
                            "name": "",
                            "content": "from Orange.widgets.tests.base import WidgetTest",
                            "ast_type_str": "ImportFrom",
                            "start_lineno": 9,
                            "end_lineno": 9,
                            "parent": null
                        }
                    ]
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 116,
                            "length": 6
                        },
                        "new_range": {
                            "start": 116,
                            "length": 33
                        },
                        "section": "class TestOWSql(WidgetTest):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        widget = self.create_widget(OWSql, stored_settings=settings)",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(widget.tablecombo.currentText(), \"b\")",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    @mock.patch(\"Orange.data.sql.backend.base.Backend.available_backends\")",
                                "type": "added"
                            },
                            {
                                "content": "    def test_selected_backend(self, mocked_backends: mock.Mock):",
                                "type": "added"
                            },
                            {
                                "content": "        b1, b2 = mock.Mock(), mock.Mock()",
                                "type": "added"
                            },
                            {
                                "content": "        b1.display_name = \"B1\"",
                                "type": "added"
                            },
                            {
                                "content": "        b2.display_name = \"B2\"",
                                "type": "added"
                            },
                            {
                                "content": "        mocked_backends.return_value = [b1, b2]",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        widget = self.create_widget(OWSql)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(widget.backendcombo.currentText(), \"B1\")",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        simulate.combobox_activate_index(widget.backendcombo, 1)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(widget.backendcombo.currentText(), \"B2\")",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        settings = widget.settingsHandler.pack_data(widget)",
                                "type": "added"
                            },
                            {
                                "content": "        widget = self.create_widget(OWSql, stored_settings=settings)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(widget.backendcombo.currentText(), \"B2\")",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        settings = widget.settingsHandler.pack_data(widget)",
                                "type": "added"
                            },
                            {
                                "content": "        settings[\"selected_backend\"] = \"B3\"",
                                "type": "added"
                            },
                            {
                                "content": "        widget = self.create_widget(OWSql, stored_settings=settings)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(widget.backendcombo.currentText(), \"B1\")",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "        mocked_backends.return_value = []",
                                "type": "added"
                            },
                            {
                                "content": "        settings = widget.settingsHandler.pack_data(widget)",
                                "type": "added"
                            },
                            {
                                "content": "        widget = self.create_widget(OWSql, stored_settings=settings)",
                                "type": "added"
                            },
                            {
                                "content": "        self.assertEqual(widget.backendcombo.currentText(), \"\")",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "if __name__ == \"__main__\":",
                                "type": "context"
                            },
                            {
                                "content": "    unittest.main()",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owsql.py",
                            "type": "class",
                            "name": "TestOWSql",
                            "content": "class TestOWSql(WidgetTest):\n\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_missing_extension(self, mock_backends):\n        \"\"\"Test for correctly handled missing backend extension\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"PostgreSQL\"\n        backend().missing_extension = [\"missing extension\"]\n        backend().list_tables.return_value = []\n        mock_backends.available_backends.return_value = [backend]\n\n        settings = {\"host\": \"host\", \"port\": \"port\",\n                    \"database\": \"DB\", \"schema\": \"\",\n                    \"username\": \"username\", \"password\": \"password\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n\n        self.assertTrue(widget.Warning.missing_extension.is_shown())\n        self.assertTrue(widget.download)\n        self.assertFalse(widget.downloadcb.isEnabled())\n\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_non_postgres(self, mock_backends):\n        \"\"\"Test if download is enforced for non postgres backends\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"database\"\n        del backend().missing_extension\n        backend().list_tables.return_value = []\n        mock_backends.available_backends.return_value = [backend]\n\n        settings = {\"host\": \"host\", \"port\": \"port\",\n                    \"database\": \"DB\", \"schema\": \"\",\n                    \"username\": \"username\", \"password\": \"password\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n\n        self.assertTrue(widget.download)\n        self.assertFalse(widget.downloadcb.isEnabled())\n\n    @mock.patch('Orange.widgets.data.owsql.Table')\n    @mock.patch('Orange.widgets.data.owsql.SqlTable')\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_restore_table(self, mock_backends, mock_sqltable, mock_table):\n        \"\"\"Test if selected table is restored from settings\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"database\"\n        del backend().missing_extension\n        backend().list_tables.return_value = [\"a\", \"b\", \"c\"]\n        mock_backends.available_backends.return_value = [backend]\n        mock_sqltable().approx_len.return_value = 100\n\n        settings = {\"host\": \"host\", \"port\": \"port\", \"database\": \"DB\",\n                    \"schema\": \"\", \"username\": \"username\",\n                    \"password\": \"password\", \"table\": \"b\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.tablecombo.currentText(), \"b\")\n\n    @mock.patch(\"Orange.data.sql.backend.base.Backend.available_backends\")\n    def test_selected_backend(self, mocked_backends: mock.Mock):\n        b1, b2 = mock.Mock(), mock.Mock()\n        b1.display_name = \"B1\"\n        b2.display_name = \"B2\"\n        mocked_backends.return_value = [b1, b2]\n\n        widget = self.create_widget(OWSql)\n        self.assertEqual(widget.backendcombo.currentText(), \"B1\")\n\n        simulate.combobox_activate_index(widget.backendcombo, 1)\n        self.assertEqual(widget.backendcombo.currentText(), \"B2\")\n\n        settings = widget.settingsHandler.pack_data(widget)\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.backendcombo.currentText(), \"B2\")\n\n        settings = widget.settingsHandler.pack_data(widget)\n        settings[\"selected_backend\"] = \"B3\"\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.backendcombo.currentText(), \"B1\")\n\n        mocked_backends.return_value = []\n        settings = widget.settingsHandler.pack_data(widget)\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.backendcombo.currentText(), \"\")",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 64,
                            "end_lineno": 144,
                            "parent": null
                        }
                    ],
                    "added_entities": [
                        {
                            "file_name": "Orange/widgets/data/tests/test_owsql.py",
                            "type": "method",
                            "name": "TestOWSql.test_selected_backend",
                            "content": "class TestOWSql(WidgetTest):\n\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_missing_extension(self, mock_backends):\n        \"\"\"Test for correctly handled missing backend extension\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"PostgreSQL\"\n        backend().missing_extension = [\"missing extension\"]\n        backend().list_tables.return_value = []\n        mock_backends.available_backends.return_value = [backend]\n\n        settings = {\"host\": \"host\", \"port\": \"port\",\n                    \"database\": \"DB\", \"schema\": \"\",\n                    \"username\": \"username\", \"password\": \"password\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n\n        self.assertTrue(widget.Warning.missing_extension.is_shown())\n        self.assertTrue(widget.download)\n        self.assertFalse(widget.downloadcb.isEnabled())\n\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_non_postgres(self, mock_backends):\n        \"\"\"Test if download is enforced for non postgres backends\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"database\"\n        del backend().missing_extension\n        backend().list_tables.return_value = []\n        mock_backends.available_backends.return_value = [backend]\n\n        settings = {\"host\": \"host\", \"port\": \"port\",\n                    \"database\": \"DB\", \"schema\": \"\",\n                    \"username\": \"username\", \"password\": \"password\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n\n        self.assertTrue(widget.download)\n        self.assertFalse(widget.downloadcb.isEnabled())\n\n    @mock.patch('Orange.widgets.data.owsql.Table')\n    @mock.patch('Orange.widgets.data.owsql.SqlTable')\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_restore_table(self, mock_backends, mock_sqltable, mock_table):\n        \"\"\"Test if selected table is restored from settings\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"database\"\n        del backend().missing_extension\n        backend().list_tables.return_value = [\"a\", \"b\", \"c\"]\n        mock_backends.available_backends.return_value = [backend]\n        mock_sqltable().approx_len.return_value = 100\n\n        settings = {\"host\": \"host\", \"port\": \"port\", \"database\": \"DB\",\n                    \"schema\": \"\", \"username\": \"username\",\n                    \"password\": \"password\", \"table\": \"b\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.tablecombo.currentText(), \"b\")\n\n    @mock.patch(\"Orange.data.sql.backend.base.Backend.available_backends\")\n    def test_selected_backend(self, mocked_backends: mock.Mock):\n        b1, b2 = mock.Mock(), mock.Mock()\n        b1.display_name = \"B1\"\n        b2.display_name = \"B2\"\n        mocked_backends.return_value = [b1, b2]\n\n        widget = self.create_widget(OWSql)\n        self.assertEqual(widget.backendcombo.currentText(), \"B1\")\n\n        simulate.combobox_activate_index(widget.backendcombo, 1)\n        self.assertEqual(widget.backendcombo.currentText(), \"B2\")\n\n        settings = widget.settingsHandler.pack_data(widget)\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.backendcombo.currentText(), \"B2\")\n\n        settings = widget.settingsHandler.pack_data(widget)\n        settings[\"selected_backend\"] = \"B3\"\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.backendcombo.currentText(), \"B1\")\n\n        mocked_backends.return_value = []\n        settings = widget.settingsHandler.pack_data(widget)\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.backendcombo.currentText(), \"\")",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 120,
                            "end_lineno": 144,
                            "parent": {
                                "file_name": "Orange/widgets/data/tests/test_owsql.py",
                                "type": "class",
                                "name": "TestOWSql",
                                "content": "class TestOWSql(WidgetTest):\n\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_missing_extension(self, mock_backends):\n        \"\"\"Test for correctly handled missing backend extension\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"PostgreSQL\"\n        backend().missing_extension = [\"missing extension\"]\n        backend().list_tables.return_value = []\n        mock_backends.available_backends.return_value = [backend]\n\n        settings = {\"host\": \"host\", \"port\": \"port\",\n                    \"database\": \"DB\", \"schema\": \"\",\n                    \"username\": \"username\", \"password\": \"password\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n\n        self.assertTrue(widget.Warning.missing_extension.is_shown())\n        self.assertTrue(widget.download)\n        self.assertFalse(widget.downloadcb.isEnabled())\n\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_non_postgres(self, mock_backends):\n        \"\"\"Test if download is enforced for non postgres backends\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"database\"\n        del backend().missing_extension\n        backend().list_tables.return_value = []\n        mock_backends.available_backends.return_value = [backend]\n\n        settings = {\"host\": \"host\", \"port\": \"port\",\n                    \"database\": \"DB\", \"schema\": \"\",\n                    \"username\": \"username\", \"password\": \"password\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n\n        self.assertTrue(widget.download)\n        self.assertFalse(widget.downloadcb.isEnabled())\n\n    @mock.patch('Orange.widgets.data.owsql.Table')\n    @mock.patch('Orange.widgets.data.owsql.SqlTable')\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_restore_table(self, mock_backends, mock_sqltable, mock_table):\n        \"\"\"Test if selected table is restored from settings\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"database\"\n        del backend().missing_extension\n        backend().list_tables.return_value = [\"a\", \"b\", \"c\"]\n        mock_backends.available_backends.return_value = [backend]\n        mock_sqltable().approx_len.return_value = 100\n\n        settings = {\"host\": \"host\", \"port\": \"port\", \"database\": \"DB\",\n                    \"schema\": \"\", \"username\": \"username\",\n                    \"password\": \"password\", \"table\": \"b\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.tablecombo.currentText(), \"b\")\n\n    @mock.patch(\"Orange.data.sql.backend.base.Backend.available_backends\")\n    def test_selected_backend(self, mocked_backends: mock.Mock):\n        b1, b2 = mock.Mock(), mock.Mock()\n        b1.display_name = \"B1\"\n        b2.display_name = \"B2\"\n        mocked_backends.return_value = [b1, b2]\n\n        widget = self.create_widget(OWSql)\n        self.assertEqual(widget.backendcombo.currentText(), \"B1\")\n\n        simulate.combobox_activate_index(widget.backendcombo, 1)\n        self.assertEqual(widget.backendcombo.currentText(), \"B2\")\n\n        settings = widget.settingsHandler.pack_data(widget)\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.backendcombo.currentText(), \"B2\")\n\n        settings = widget.settingsHandler.pack_data(widget)\n        settings[\"selected_backend\"] = \"B3\"\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.backendcombo.currentText(), \"B1\")\n\n        mocked_backends.return_value = []\n        settings = widget.settingsHandler.pack_data(widget)\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.backendcombo.currentText(), \"\")",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 64,
                                "end_lineno": 144,
                                "parent": null
                            }
                        }
                    ],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "e18514dbf98067701970014bdc04039610c9b962^",
    "new_commit_hash": "e18514dbf98067701970014bdc04039610c9b962",
    "commit_message": "SQL: Save selected backend to settings",
    "commit_date": "2019-12-16T07:29:31+01:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "e18514dbf98067701970014bdc04039610c9b962",
    "test_file_codes": [
        "# Test methods with long descriptive names can omit docstrings\n# pylint: disable=missing-docstring\n\nimport unittest\nfrom unittest import mock\n\nfrom Orange.data import Table\nfrom Orange.widgets.data.owsql import OWSql\nfrom Orange.widgets.tests.base import WidgetTest, simulate\nfrom Orange.tests.sql.base import DataBaseTest as dbt\n\n\nclass TestOWSqlConnected(WidgetTest, dbt):\n    def setUpDB(self):\n        # pylint: disable=attribute-defined-outside-init\n        self.widget = self.create_widget(OWSql)\n        self.params, _ = self.create_iris_sql_table()\n        self.iris = Table(\"iris\")\n\n    def tearDownDB(self):\n        self.drop_iris_sql_table()\n\n    @dbt.run_on([\"postgres\"])\n    def test_connection(self):\n        \"\"\"Test if a connection to the database can be established\"\"\"\n        self.set_connection_params()\n        self.widget.connect()\n\n        self.assertFalse(self.widget.Error.connection.is_shown())\n        self.assertIsNotNone(self.widget.database_desc)\n        tables = [\"Select a table\", \"Custom SQL\"]\n        self.assertTrue(set(self.widget.tables).issuperset(set(tables)))\n\n    @dbt.run_on([\"postgres\"])\n    def test_output_iris(self):\n        \"\"\"Test if iris data can be fetched from database\"\"\"\n        self.assertIsNone(self.get_output(self.widget.Outputs.data))\n\n        self.set_connection_params()\n        self.widget.connect()\n\n        idx = list(map(str, self.widget.tables)).index(\"iris\")\n        self.widget.tablecombo.setCurrentIndex(idx)\n        self.widget.select_table()\n\n        output = self.get_output(self.widget.Outputs.data)\n        self.assertIsNotNone(output)\n        self.assertEqual(len(output), len(self.iris))\n        iris_domain = set(map(str, self.iris.domain.attributes))\n        output_domain = set(map(str, output.domain.attributes))\n        self.assertTrue(output_domain.issuperset(iris_domain))\n\n    def set_connection_params(self):\n        \"\"\"Set database connection parameters on widget\"\"\"\n        port = ''\n        if self.params['port'] is not None:\n            port += ':' + str(self.params['port'])\n        self.widget.servertext.setText(self.params['host'] + port)\n        self.widget.databasetext.setText(self.params['database'])\n        self.widget.usernametext.setText(self.params['user'])\n        self.widget.passwordtext.setText(self.params['password'])\n\n\nclass TestOWSql(WidgetTest):\n\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_missing_extension(self, mock_backends):\n        \"\"\"Test for correctly handled missing backend extension\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"PostgreSQL\"\n        backend().missing_extension = [\"missing extension\"]\n        backend().list_tables.return_value = []\n        mock_backends.available_backends.return_value = [backend]\n\n        settings = {\"host\": \"host\", \"port\": \"port\",\n                    \"database\": \"DB\", \"schema\": \"\",\n                    \"username\": \"username\", \"password\": \"password\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n\n        self.assertTrue(widget.Warning.missing_extension.is_shown())\n        self.assertTrue(widget.download)\n        self.assertFalse(widget.downloadcb.isEnabled())\n\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_non_postgres(self, mock_backends):\n        \"\"\"Test if download is enforced for non postgres backends\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"database\"\n        del backend().missing_extension\n        backend().list_tables.return_value = []\n        mock_backends.available_backends.return_value = [backend]\n\n        settings = {\"host\": \"host\", \"port\": \"port\",\n                    \"database\": \"DB\", \"schema\": \"\",\n                    \"username\": \"username\", \"password\": \"password\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n\n        self.assertTrue(widget.download)\n        self.assertFalse(widget.downloadcb.isEnabled())\n\n    @mock.patch('Orange.widgets.data.owsql.Table')\n    @mock.patch('Orange.widgets.data.owsql.SqlTable')\n    @mock.patch('Orange.widgets.data.owsql.Backend')\n    def test_restore_table(self, mock_backends, mock_sqltable, mock_table):\n        \"\"\"Test if selected table is restored from settings\"\"\"\n        backend = mock.Mock()\n        backend().display_name = \"database\"\n        del backend().missing_extension\n        backend().list_tables.return_value = [\"a\", \"b\", \"c\"]\n        mock_backends.available_backends.return_value = [backend]\n        mock_sqltable().approx_len.return_value = 100\n\n        settings = {\"host\": \"host\", \"port\": \"port\", \"database\": \"DB\",\n                    \"schema\": \"\", \"username\": \"username\",\n                    \"password\": \"password\", \"table\": \"b\"}\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.tablecombo.currentText(), \"b\")\n\n    @mock.patch(\"Orange.data.sql.backend.base.Backend.available_backends\")\n    def test_selected_backend(self, mocked_backends: mock.Mock):\n        b1, b2 = mock.Mock(), mock.Mock()\n        b1.display_name = \"B1\"\n        b2.display_name = \"B2\"\n        mocked_backends.return_value = [b1, b2]\n\n        widget = self.create_widget(OWSql)\n        self.assertEqual(widget.backendcombo.currentText(), \"B1\")\n\n        simulate.combobox_activate_index(widget.backendcombo, 1)\n        self.assertEqual(widget.backendcombo.currentText(), \"B2\")\n\n        settings = widget.settingsHandler.pack_data(widget)\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.backendcombo.currentText(), \"B2\")\n\n        settings = widget.settingsHandler.pack_data(widget)\n        settings[\"selected_backend\"] = \"B3\"\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.backendcombo.currentText(), \"B1\")\n\n        mocked_backends.return_value = []\n        settings = widget.settingsHandler.pack_data(widget)\n        widget = self.create_widget(OWSql, stored_settings=settings)\n        self.assertEqual(widget.backendcombo.currentText(), \"\")\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\nrunning build_src\nbuild_src\nbuilding extension \"Orange.classification._simple_tree\" sources\nbuilding extension \"Orange.classification._tree_scorers\" sources\nbuilding extension \"Orange.data._valuecount\" sources\nbuilding extension \"Orange.data._contingency\" sources\nbuilding extension \"Orange.data._io\" sources\nbuilding extension \"Orange.data._variable\" sources\nbuilding extension \"Orange.distance._distance\" sources\nbuilding extension \"Orange.preprocess._discretize\" sources\nbuilding extension \"Orange.preprocess._relieff\" sources\nbuilding extension \"Orange.projection._som\" sources\nbuilding extension \"Orange.widgets.utils._grid_density\" sources\nbuild_src: building npy-pkg config files\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmpw69yyxkk/tmp\ncreating /tmp/tmpw69yyxkk/tmp/tmpw69yyxkk\ncompile options: '-MMD -MF /tmp/tmpw69yyxkk/file.c.d -c'\ncc: /tmp/tmpw69yyxkk/file.c\ncustomize UnixCCompiler using build_ext\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmp7uq_j473/tmp\ncreating /tmp/tmp7uq_j473/tmp/tmp7uq_j473\ncompile options: '-MMD -MF /tmp/tmp7uq_j473/file.c.d -c'\ncc: /tmp/tmp7uq_j473/file.c\ncustomize UnixCCompiler using build_ext\nbuilding 'Orange.classification._simple_tree' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange\ncreating build/temp.linux-x86_64-3.7/Orange/classification\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/classification/_simple_tree.c\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 Orange/classification/_simple_tree.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.classification._tree_scorers' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/classification/_tree_scorers.c\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 Orange/classification/_tree_scorers.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._valuecount' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/data\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_valuecount.c\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 Orange/data/_valuecount.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._contingency' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_contingency.c\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 Orange/data/_contingency.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._io' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_io.c\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 Orange/data/_io.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.data._variable' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/data/_variable.c\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 Orange/data/_variable.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.distance._distance' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/distance\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/distance/_distance.c\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 Orange/distance/_distance.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._discretize' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/preprocess\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/preprocess/_discretize.c\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 Orange/preprocess/_discretize.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.preprocess._relieff' extension\ncompiling C++ sources\nC compiler: c++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\nc++: Orange/preprocess/_relieff.cpp\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 Orange/preprocess/_relieff.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.projection._som' extension\ncompiling C sources\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/projection\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\ncc: Orange/projection/_som.c\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 Orange/projection/_som.cpython-37m-x86_64-linux-gnu.so\nbuilding 'Orange.widgets.utils._grid_density' extension\ncompiling C++ sources\nC compiler: c++ -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating build/temp.linux-x86_64-3.7/Orange/widgets\ncreating build/temp.linux-x86_64-3.7/Orange/widgets/utils\ncompile options: '-I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/include -I/home/gcpuser/.local/share/uv/python/cpython-3.7.9-linux-x86_64-gnu/include/python3.7m -c'\nc++: Orange/widgets/utils/_grid_density.cpp\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 Orange/widgets/utils/_grid_density.cpython-37m-x86_64-linux-gnu.so\nrunning develop\nrunning build_scripts\nrunning egg_info\nrunning build_src\nbuild_src\nbuilding extension \"Orange.classification._simple_tree\" sources\nbuilding extension \"Orange.classification._tree_scorers\" sources\nbuilding extension \"Orange.data._valuecount\" sources\nbuilding extension \"Orange.data._contingency\" sources\nbuilding extension \"Orange.data._io\" sources\nbuilding extension \"Orange.data._variable\" sources\nbuilding extension \"Orange.distance._distance\" sources\nbuilding extension \"Orange.preprocess._discretize\" sources\nbuilding extension \"Orange.preprocess._relieff\" sources\nbuilding extension \"Orange.projection._som\" sources\nbuilding extension \"Orange.widgets.utils._grid_density\" sources\nbuild_src: building npy-pkg config files\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'\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'\nadding license file 'LICENSE'\nwriting manifest file 'Orange3.egg-info/SOURCES.txt'\nrunning build_ext\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmpbfbqrq0f/tmp\ncreating /tmp/tmpbfbqrq0f/tmp/tmpbfbqrq0f\ncompile options: '-MMD -MF /tmp/tmpbfbqrq0f/file.c.d -c'\ncc: /tmp/tmpbfbqrq0f/file.c\ncustomize UnixCCompiler using build_ext\ncustomize UnixCCompiler\nC compiler: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/tools/deps/include -I/tools/deps/include/ncursesw -fPIC\n\ncreating /tmp/tmp_ftv9jtj/tmp\ncreating /tmp/tmp_ftv9jtj/tmp/tmp_ftv9jtj\ncompile options: '-MMD -MF /tmp/tmp_ftv9jtj/file.c.d -c'\ncc: /tmp/tmp_ftv9jtj/file.c\ncustomize UnixCCompiler using build_ext\nCreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.24.0.dev0+e18514d to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962\nProcessing dependencies for Orange3==3.24.0.dev0+e18514d\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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.24.0.dev0+e18514d\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 106ms\nPrepared 18 packages in 5ms\nInstalled 18 packages in 432ms\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 38 packages in 226ms\nInstalled 33 packages in 1.04s\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 + 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 + more-itertools==9.1.0\n + networkx==2.6.3\n + opentsne==1.0.1\n + pandas==1.3.5\n + pip==24.0\n + pycparser==2.21\n + python-dateutil==2.9.0.post0\n + python-louvain==0.16\n + pytz==2024.2\n + pyyaml==6.0.1\n + requests==2.31.0\n + scikit-learn==1.0.2\n + scipy==1.7.3\n + secretstorage==3.3.3\n + serverfiles==0.3.1\n + six==1.17.0\n + threadpoolctl==3.1.0\n + urllib3==2.0.7\n + xlrd==2.0.1\n + xlsxwriter==3.2.0\nResolved 34 packages in 135ms\nInstalled 19 packages in 87ms\n + anyqt==0.2.0\n + attrs==24.2.0\n + cattrs==23.1.2\n + commonmark==0.9.1\n + cycler==0.11.0\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + fonttools==4.38.0\n + kiwisolver==1.4.5\n + matplotlib==3.5.3\n + orange-canvas-core==0.1.35\n + orange-widget-base==4.22.0\n + pillow==9.5.0\n + platformdirs==4.0.0\n + pyparsing==3.1.4\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 11ms\nInstalled 2 packages in 46ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nAudited 1 package in 1ms\nAudited 2 packages in 2ms\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      |         ^~~~~~~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/classification/_tree_scorers.c:567:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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:3115:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 3115 |   __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:4619:27: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 4619 |   __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:5396:43: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5396 |           for (__pyx_t_22 = 0; __pyx_t_22 < __pyx_t_21; __pyx_t_22+=1) {\n      |                                           ^\nOrange/classification/_tree_scorers.c:5517:39: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5517 |           __pyx_t_27 = ((__pyx_v_left >= __pyx_v_min_leaf) != 0);\n      |                                       ^~\nOrange/classification/_tree_scorers.c:5523:53: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 5523 |           __pyx_t_27 = (((__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:7051:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7051 |         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:7741:41: warning: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘int’ [-Wsign-compare]\n 7741 |         for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) {\n      |                                         ^\nOrange/classification/_tree_scorers.c:7801:143: warning: comparison of integer expressions of different signedness: ‘__pyx_t_5numpy_int32_t’ {aka ‘int’} and ‘unsigned int’ [-Wsign-compare]\n 7801 |               __pyx_t_17 = (((*((__pyx_t_5numpy_int32_t *) ( /* dim=0 */ (__pyx_v_indices.data + __pyx_t_18 * __pyx_v_indices.strides[0]) ))) != __pyx_v_i) != 0);\n      |                                                                                                                                               ^~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_valuecount.c:567:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/data/_contingency.c:598:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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:3881:24: warning: ‘__pyx_v_decs’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3881 |           __pyx_v_decs = (__pyx_v_decs / 10.0);\n      |           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:4070:24: warning: ‘__pyx_v_value’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4070 |           __pyx_t_10 = PyFloat_FromDouble(__pyx_v_value); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 221, __pyx_L5_error)\n      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:480:40: warning: ‘__pyx_v_attr_index’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n  480 |   #define PyInt_FromLong               PyLong_FromLong\n      |                                        ^~~~~~~~~~~~~~~\nOrange/data/_io.c:1301:7: note: ‘__pyx_v_attr_index’ was declared here\n 1301 |   int __pyx_v_attr_index;\n      |       ^~~~~~~~~~~~~~~~~~\nOrange/data/_io.c:2935:25: warning: ‘__pyx_v_atomp’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 2935 |           __pyx_v_atomp = (__pyx_v_atomp + 1);\n      |           ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~\nIn file included from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/distance/_distance.c:598:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_discretize.c:567:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_relieff.cpp:581:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/projection/_som.c:598:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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:3655:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3655 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:3654:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3654 |   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:4547:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4547 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_39, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4114:7: note: ‘__pyx_v_win_y’ was declared here\n 4114 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4536:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4536 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:4113:7: note: ‘__pyx_v_win_x’ was declared here\n 4113 |   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:4746:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4746 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:4745:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 4745 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_3update’:\nOrange/projection/_som.c:3141:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 3141 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c: In function ‘__pyx_pw_6Orange_10projection_4_som_1get_winners’:\nOrange/projection/_som.c:2964:223: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 2964 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_28, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_y;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2665:7: note: ‘__pyx_v_win_y’ was declared here\n 2665 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:2953:223: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 2953 |           *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int16_t *, __pyx_pybuffernd_winners.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_winners.diminfo[0].strides, __pyx_t_26, __pyx_pybuffernd_winners.diminfo[1].strides) = __pyx_v_win_x;\n      |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~\nOrange/projection/_som.c:2664:7: note: ‘__pyx_v_win_x’ was declared here\n 2664 |   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:5515:7: warning: ‘__pyx_v_win_y’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5515 |   int __pyx_v_win_y;\n      |       ^~~~~~~~~~~~~\nOrange/projection/_som.c:5514:7: warning: ‘__pyx_v_win_x’ may be used uninitialized in this function [-Wmaybe-uninitialized]\n 5514 |   int __pyx_v_win_x;\n      |       ^~~~~~~~~~~~~\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.\n  setuptools.SetuptoolsDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.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_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.\n  setuptools.SetuptoolsDeprecationWarning,\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962/.venv/lib/python3.7/site-packages/setuptools/command/egg_info.py:628: SetuptoolsDeprecationWarning: Custom 'build_py' does not implement 'get_data_files_without_manifest'.\nPlease extend command classes from setuptools instead of distutils.\n  SetuptoolsDeprecationWarning\n",
    "new_commit_res_code": 0,
    "new_commit_res_stdout": "============================= test session starts ==============================\nplatform linux -- Python 3.7.9, pytest-7.4.4, pluggy-1.2.0\nrootdir: /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_e18514dbf98067701970014bdc04039610c9b962\ncollected 15 items\n\nr2e_tests/test_1.py ssssssssss.s...                                      [100%]\n\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWSql::test_missing_extension\nPASSED r2e_tests/test_1.py::TestOWSql::test_non_postgres\nPASSED r2e_tests/test_1.py::TestOWSql::test_restore_table\nPASSED r2e_tests/test_1.py::TestOWSql::test_selected_backend\nSKIPPED [3] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:244: image exporting not tested as .widget was not set\nSKIPPED [3] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:238: minimum size not tested as .widget was not set\nSKIPPED [3] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:250: msg base class not tested as .widget was not set\nSKIPPED [1] r2e_tests/test_1.py:23: No connection provided for postgres\nSKIPPED [1] r2e_tests/test_1.py:34: No connection provided for postgres\n======================== 4 passed, 11 skipped in 3.88s =========================\nWidgets left: 0    Max widgets: 469 \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_e18514dbf98067701970014bdc04039610c9b962\ncollected 15 items\n\nr2e_tests/test_1.py ssssssssss.s..F                                      [100%]\n\n=================================== FAILURES ===================================\n_______________________ TestOWSql.test_selected_backend ________________________\n\nself = <r2e_tests.test_1.TestOWSql testMethod=test_selected_backend>\nmocked_backends = <MagicMock name='available_backends' id='133463313053456'>\n\n    @mock.patch(\"Orange.data.sql.backend.base.Backend.available_backends\")\n    def test_selected_backend(self, mocked_backends: mock.Mock):\n        b1, b2 = mock.Mock(), mock.Mock()\n        b1.display_name = \"B1\"\n        b2.display_name = \"B2\"\n        mocked_backends.return_value = [b1, b2]\n    \n        widget = self.create_widget(OWSql)\n        self.assertEqual(widget.backendcombo.currentText(), \"B1\")\n    \n        simulate.combobox_activate_index(widget.backendcombo, 1)\n        self.assertEqual(widget.backendcombo.currentText(), \"B2\")\n    \n        settings = widget.settingsHandler.pack_data(widget)\n        widget = self.create_widget(OWSql, stored_settings=settings)\n>       self.assertEqual(widget.backendcombo.currentText(), \"B2\")\nE       AssertionError: 'B1' != 'B2'\nE       - B1\nE       + B2\n\nr2e_tests/test_1.py:134: AssertionError\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWSql::test_missing_extension\nPASSED r2e_tests/test_1.py::TestOWSql::test_non_postgres\nPASSED r2e_tests/test_1.py::TestOWSql::test_restore_table\nSKIPPED [3] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:244: image exporting not tested as .widget was not set\nSKIPPED [3] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:238: minimum size not tested as .widget was not set\nSKIPPED [3] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:250: msg base class not tested as .widget was not set\nSKIPPED [1] r2e_tests/test_1.py:23: No connection provided for postgres\nSKIPPED [1] r2e_tests/test_1.py:34: No connection provided for postgres\nFAILED r2e_tests/test_1.py::TestOWSql::test_selected_backend - AssertionError...\n=================== 1 failed, 3 passed, 11 skipped in 2.88s ====================\nWidgets left: 0    Max widgets: 335 \n\n",
    "old_commit_res_stderr": ""
}
Orange/widgets/data/owsql.py Orange/widgets/data/tests/test_owsql.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]

**Title**: Selected backend not retained after saving settings in SQL widget

**Description**:
When a user selects a different backend in the SQL widget and saves the settings, the selected backend is not retained upon reopening the widget. Instead, it defaults back to the initial backend, disregarding the user's choice.

**Example Buggy Code**:
```python
def test_selected_backend_not_saved():
    widget = create_widget(OWSql)
    widget.backendcombo.setCurrentText('B2')
    settings = widget.get_settings()
    # After reloading the widget with saved settings
    new_widget = create_widget(OWSql, settings)
    assert new_widget.backendcombo.currentText() == 'B2'  # Fails, shows 'B1'
```

**Expected Behavior**:
After selecting 'B2' as the backend and saving the settings, reopening the SQL widget should display 'B2' as the selected backend.

**Actual Behavior**:
The SQL widget reverts to displaying 'B1' as the selected backend, ignoring the user's selection of 'B2'.

[/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/owsql.py
from AnyQt.QtWidgets import QComboBox, QTextEdit, QMessageBox, QApplication
from AnyQt.QtGui import QCursor
from AnyQt.QtCore import Qt

from Orange.data import Table
from Orange.data.sql.backend import Backend
from Orange.data.sql.backend.base import BackendError
from Orange.data.sql.table import SqlTable, LARGE_TABLE, AUTO_DL_LIMIT
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.utils.itemmodels import PyListModel
from Orange.widgets.utils.owbasesql import OWBaseSql
from Orange.widgets.utils.widgetpreview import WidgetPreview
from Orange.widgets.widget import Output, Msg

MAX_DL_LIMIT = 1000000


def is_postgres(backend):
    return getattr(backend, 'display_name', '') == "PostgreSQL"


class TableModel(PyListModel):
    def data(self, index, role=Qt.DisplayRole):
        row = index.row()
        if role == Qt.DisplayRole:
            return str(self[row])
        return super().data(index, role)


class BackendModel(PyListModel):
    def data(self, index, role=Qt.DisplayRole):
        row = index.row()
        if role == Qt.DisplayRole:
            return self[row].display_name
        return super().data(index, role)


class OWSql(OWBaseSql):
    name = "SQL Table"
    id = "orange.widgets.data.sql"
    description = "Load dataset from SQL."
    icon = "icons/SQLTable.svg"
    priority = 30
    category = "Data"
    keywords = ["load"]

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

    settings_version = 2

    table = Setting(None)
    sql = Setting("")
    guess_values = Setting(True)
    download = Setting(False)

    materialize = Setting(False)
    materialize_table_name = Setting("")

    class Information(OWBaseSql.Information):
        data_sampled = Msg("Data description was generated from a sample.")

    class Warning(OWBaseSql.Warning):
        missing_extension = Msg("Database is missing extensions: {}")

    class Error(OWBaseSql.Error):
        no_backends = Msg("Please install a backend to use this widget.")

    def __init__(self):
        # Lint
        self.backends = None
        self.backendcombo = None
        self.tables = None
        self.tablecombo = None
        self.sqltext = None
        self.custom_sql = None
        self.downloadcb = None
        super().__init__()

    def _setup_gui(self):
        super()._setup_gui()
        self._add_backend_controls()
        self._add_tables_controls()

    def _add_backend_controls(self):
        box = self.serverbox
        self.backends = BackendModel(Backend.available_backends())
        self.backendcombo = QComboBox(box)
        if self.backends:
            self.backendcombo.setModel(self.backends)
        else:
            self.Error.no_backends()
            box.setEnabled(False)
        box.layout().insertWidget(0, self.backendcombo)

    def _add_tables_controls(self):
        vbox = gui.vBox(self.controlArea, "Tables", addSpace=True)
        box = gui.vBox(vbox)
        self.tables = TableModel()

        self.tablecombo = QComboBox(
            minimumContentsLength=35,
            sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLength
        )
        self.tablecombo.setModel(self.tables)
        self.tablecombo.setToolTip('table')
        self.tablecombo.activated[int].connect(self.select_table)
        box.layout().addWidget(self.tablecombo)

        self.custom_sql = gui.vBox(box)
        self.custom_sql.setVisible(False)
        self.sqltext = QTextEdit(self.custom_sql)
        self.sqltext.setPlainText(self.sql)
        self.custom_sql.layout().addWidget(self.sqltext)

        mt = gui.hBox(self.custom_sql)
        cb = gui.checkBox(mt, self, 'materialize', 'Materialize to table ')
        cb.setToolTip('Save results of the query in a table')
        le = gui.lineEdit(mt, self, 'materialize_table_name')
        le.setToolTip('Save results of the query in a table')

        gui.button(self.custom_sql, self, 'Execute', callback=self.open_table)

        box.layout().addWidget(self.custom_sql)

        gui.checkBox(box, self, "guess_values",
                     "Auto-discover categorical variables",
                     callback=self.open_table)

        self.downloadcb = gui.checkBox(box, self, "download",
                                       "Download data to local memory",
                                       callback=self.open_table)

    def highlight_error(self, text=""):
        err = ['', 'QLineEdit {border: 2px solid red;}']
        self.servertext.setStyleSheet(err['server' in text or 'host' in text])
        self.usernametext.setStyleSheet(err['role' in text])
        self.databasetext.setStyleSheet(err['database' in text])

    def get_backend(self):
        if self.backendcombo.currentIndex() < 0:
            return None
        return self.backends[self.backendcombo.currentIndex()]

    def on_connection_success(self):
        if getattr(self.backend, 'missing_extension', False):
            self.Warning.missing_extension(
                ", ".join(self.backend.missing_extension))
            self.download = True
            self.downloadcb.setEnabled(False)
        if not is_postgres(self.backend):
            self.download = True
            self.downloadcb.setEnabled(False)
        super().on_connection_success()
        self.refresh_tables()
        self.select_table()

    def on_connection_error(self, err):
        super().on_connection_error(err)
        self.highlight_error(str(err).split("\n")[0])

    def clear(self):
        super().clear()
        self.Warning.missing_extension.clear()
        self.downloadcb.setEnabled(True)
        self.highlight_error()
        self.tablecombo.clear()
        self.tablecombo.repaint()

    def refresh_tables(self):
        self.tables.clear()
        if self.backend is None:
            self.data_desc_table = None
            return

        self.tables.append("Select a table")
        self.tables.append("Custom SQL")
        self.tables.extend(self.backend.list_tables(self.schema))
        index = self.tablecombo.findText(str(self.table))
        self.tablecombo.setCurrentIndex(index if index != -1 else 0)
        self.tablecombo.repaint()

    # Called on tablecombo selection change:
    def select_table(self):
        curIdx = self.tablecombo.currentIndex()
        if self.tablecombo.itemText(curIdx) != "Custom SQL":
            self.custom_sql.setVisible(False)
            return self.open_table()
        else:
            self.custom_sql.setVisible(True)
            self.data_desc_table = None
            self.database_desc["Table"] = "(None)"
            self.table = None
            if len(str(self.sql)) > 14:
                return self.open_table()
        return None

    def get_table(self):
        curIdx = self.tablecombo.currentIndex()
        if curIdx <= 0:
            if self.database_desc:
                self.database_desc["Table"] = "(None)"
            self.data_desc_table = None
            return None

        if self.tablecombo.itemText(curIdx) != "Custom SQL":
            self.table = self.tables[self.tablecombo.currentIndex()]
            self.database_desc["Table"] = self.table
            if "Query" in self.database_desc:
                del self.database_desc["Query"]
            what = self.table
        else:
            what = self.sql = self.sqltext.toPlainText()
            self.table = "Custom SQL"
            if self.materialize:
                if not self.materialize_table_name:
                    self.Error.connection(
                        "Specify a table name to materialize the query")
                    return None
                try:
                    with self.backend.execute_sql_query("DROP TABLE IF EXISTS " +
                                                        self.materialize_table_name):
                        pass
                    with self.backend.execute_sql_query("CREATE TABLE " +
                                                        self.materialize_table_name +
                                                        " AS " + self.sql):
                        pass
                    with self.backend.execute_sql_query("ANALYZE " + self.materialize_table_name):
                        pass
                except BackendError as ex:
                    self.Error.connection(str(ex))
                    return None

        try:
            table = SqlTable(dict(host=self.host,
                                  port=self.port,
                                  database=self.database,
                                  user=self.username,
                                  password=self.password),
                             what,
                             backend=type(self.backend),
                             inspect_values=False)
        except BackendError as ex:
            self.Error.connection(str(ex))
            return None

        self.Error.connection.clear()

        sample = False

        if table.approx_len() > LARGE_TABLE and self.guess_values:
            confirm = QMessageBox(self)
            confirm.setIcon(QMessageBox.Warning)
            confirm.setText("Attribute discovery might take "
                            "a long time on large tables.\n"
                            "Do you want to auto discover attributes?")
            confirm.addButton("Yes", QMessageBox.YesRole)
            no_button = confirm.addButton("No", QMessageBox.NoRole)
            if is_postgres(self.backend):
                sample_button = confirm.addButton("Yes, on a sample",
                                                  QMessageBox.YesRole)
            confirm.exec()
            if confirm.clickedButton() == no_button:
                self.guess_values = False
            elif is_postgres(self.backend) and \
                    confirm.clickedButton() == sample_button:
                sample = True

        self.Information.clear()
        if self.guess_values:
            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
            if sample:
                s = table.sample_time(1)
                domain = s.get_domain(inspect_values=True)
                self.Information.data_sampled()
            else:
                domain = table.get_domain(inspect_values=True)
            QApplication.restoreOverrideCursor()
            table.domain = domain

        if self.download:
            if table.approx_len() > AUTO_DL_LIMIT:
                if is_postgres(self.backend):
                    confirm = QMessageBox(self)
                    confirm.setIcon(QMessageBox.Warning)
                    confirm.setText("Data appears to be big. Do you really "
                                    "want to download it to local memory?")

                    if table.approx_len() <= MAX_DL_LIMIT:
                        confirm.addButton("Yes", QMessageBox.YesRole)
                    no_button = confirm.addButton("No", QMessageBox.NoRole)
                    sample_button = confirm.addButton("Yes, a sample",
                                                      QMessageBox.YesRole)
                    confirm.exec()
                    if confirm.clickedButton() == no_button:
                        return None
                    elif confirm.clickedButton() == sample_button:
                        table = table.sample_percentage(
                            AUTO_DL_LIMIT / table.approx_len() * 100)
                else:
                    if table.approx_len() > MAX_DL_LIMIT:
                        QMessageBox.warning(
                            self, 'Warning', "Data is too big to download.\n")
                        return None
                    else:
                        confirm = QMessageBox.question(
                            self, 'Question',
                            "Data appears to be big. Do you really "
                            "want to download it to local memory?",
                            QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
                        if confirm == QMessageBox.No:
                            return None

            table.download_data(MAX_DL_LIMIT)
            table = Table(table)

        return table

    @classmethod
    def migrate_settings(cls, settings, version):
        if version < 2:
            # Until Orange version 3.4.4 username and password had been stored
            # in Settings.
            cm = cls._credential_manager(settings["host"], settings["port"])
            cm.username = settings["username"]
            cm.password = settings["password"]


if __name__ == "__main__":  # pragma: no cover
    WidgetPreview(OWSql).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]

**Title**: Selected backend not retained after saving settings in SQL widget

**Description**:
When a user selects a different backend in the SQL widget and saves the settings, the selected backend is not retained upon reopening the widget. Instead, it defaults back to the initial backend, disregarding the user's choice.

**Example Buggy Code**:
```python
def test_selected_backend_not_saved():
    widget = create_widget(OWSql)
    widget.backendcombo.setCurrentText('B2')
    settings = widget.get_settings()
    # After reloading the widget with saved settings
    new_widget = create_widget(OWSql, settings)
    assert new_widget.backendcombo.currentText() == 'B2'  # Fails, shows 'B1'
```

**Expected Behavior**:
After selecting 'B2' as the backend and saving the settings, reopening the SQL widget should display 'B2' as the selected backend.

**Actual Behavior**:
The SQL widget reverts to displaying 'B1' as the selected backend, ignoring the user's selection of 'B2'.

[/ISSUE]
{
    "TestOWSql.test_missing_extension": "PASSED",
    "TestOWSql.test_non_postgres": "PASSED",
    "TestOWSql.test_restore_table": "PASSED",
    "TestOWSql.test_selected_backend": "PASSED"
}
diff --git a/Orange/widgets/data/owsql.py b/Orange/widgets/data/owsql.py
index a91e2901e..0fbc7c677 100644
--- a/Orange/widgets/data/owsql.py
+++ b/Orange/widgets/data/owsql.py
@@ -50,6 +50,7 @@ class OWSql(OWBaseSql):
 
     settings_version = 2
 
+    selected_backend = Setting(None)
     table = Setting(None)
     sql = Setting("")
     guess_values = Setting(True)
@@ -89,11 +90,19 @@ class OWSql(OWBaseSql):
         self.backendcombo = QComboBox(box)
         if self.backends:
             self.backendcombo.setModel(self.backends)
+            names = [backend.display_name for backend in self.backends]
+            if self.selected_backend and self.selected_backend in names:
+                self.backendcombo.setCurrentText(self.selected_backend)
         else:
             self.Error.no_backends()
             box.setEnabled(False)
+        self.backendcombo.currentTextChanged.connect(self.__backend_changed)
         box.layout().insertWidget(0, self.backendcombo)
 
+    def __backend_changed(self):
+        backend = self.get_backend()
+        self.selected_backend = backend.display_name if backend else None
+
     def _add_tables_controls(self):
         vbox = gui.vBox(self.controlArea, "Tables", addSpace=True)
         box = gui.vBox(vbox)

{"Orange/widgets/data/owsql.py": "from AnyQt.QtWidgets import QComboBox, QTextEdit, QMessageBox, QApplication\nfrom AnyQt.QtGui import QCursor\nfrom AnyQt.QtCore import Qt\n\nfrom Orange.data import Table\nfrom Orange.data.sql.backend import Backend\nfrom Orange.data.sql.backend.base import BackendError\nfrom Orange.data.sql.table import SqlTable, LARGE_TABLE, AUTO_DL_LIMIT\nfrom Orange.widgets import gui\nfrom Orange.widgets.settings import Setting\nfrom Orange.widgets.utils.itemmodels import PyListModel\nfrom Orange.widgets.utils.owbasesql import OWBaseSql\nfrom Orange.widgets.utils.widgetpreview import WidgetPreview\nfrom Orange.widgets.widget import Output, Msg\n\nMAX_DL_LIMIT = 1000000\n\n\ndef is_postgres(backend):\n    return getattr(backend, 'display_name', '') == \"PostgreSQL\"\n\n\nclass TableModel(PyListModel):\n    def data(self, index, role=Qt.DisplayRole):\n        row = index.row()\n        if role == Qt.DisplayRole:\n            return str(self[row])\n        return super().data(index, role)\n\n\nclass BackendModel(PyListModel):\n    def data(self, index, role=Qt.DisplayRole):\n        row = index.row()\n        if role == Qt.DisplayRole:\n            return self[row].display_name\n        return super().data(index, role)\n\n\nclass OWSql(OWBaseSql):\n    name = \"SQL Table\"\n    id = \"orange.widgets.data.sql\"\n    description = \"Load dataset from SQL.\"\n    icon = \"icons/SQLTable.svg\"\n    priority = 30\n    category = \"Data\"\n    keywords = [\"load\"]\n\n    class Outputs:\n        data = Output(\"Data\", Table, doc=\"Attribute-valued dataset read from the input file.\")\n\n    settings_version = 2\n\n    table = Setting(None)\n    sql = Setting(\"\")\n    guess_values = Setting(True)\n    download = Setting(False)\n\n    materialize = Setting(False)\n    materialize_table_name = Setting(\"\")\n\n    class Information(OWBaseSql.Information):\n        data_sampled = Msg(\"Data description was generated from a sample.\")\n\n    class Warning(OWBaseSql.Warning):\n        missing_extension = Msg(\"Database is missing extensions: {}\")\n\n    class Error(OWBaseSql.Error):\n        no_backends = Msg(\"Please install a backend to use this widget.\")\n\n    def __init__(self):\n        # Lint\n        self.backends = None\n        self.backendcombo = None\n        self.tables = None\n        self.tablecombo = None\n        self.sqltext = None\n        self.custom_sql = None\n        self.downloadcb = None\n        super().__init__()\n\n    def _setup_gui(self):\n        super()._setup_gui()\n        self._add_backend_controls()\n        self._add_tables_controls()\n\n    def _add_backend_controls(self):\n        box = self.serverbox\n        self.backends = BackendModel(Backend.available_backends())\n        self.backendcombo = QComboBox(box)\n        if self.backends:\n            self.backendcombo.setModel(self.backends)\n        else:\n            self.Error.no_backends()\n            box.setEnabled(False)\n        box.layout().insertWidget(0, self.backendcombo)\n\n    def _add_tables_controls(self):\n        vbox = gui.vBox(self.controlArea, \"Tables\", addSpace=True)\n        box = gui.vBox(vbox)\n        self.tables = TableModel()\n\n        self.tablecombo = QComboBox(\n            minimumContentsLength=35,\n            sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLength\n        )\n        self.tablecombo.setModel(self.tables)\n        self.tablecombo.setToolTip('table')\n        self.tablecombo.activated[int].connect(self.select_table)\n        box.layout().addWidget(self.tablecombo)\n\n        self.custom_sql = gui.vBox(box)\n        self.custom_sql.setVisible(False)\n        self.sqltext = QTextEdit(self.custom_sql)\n        self.sqltext.setPlainText(self.sql)\n        self.custom_sql.layout().addWidget(self.sqltext)\n\n        mt = gui.hBox(self.custom_sql)\n        cb = gui.checkBox(mt, self, 'materialize', 'Materialize to table ')\n        cb.setToolTip('Save results of the query in a table')\n        le = gui.lineEdit(mt, self, 'materialize_table_name')\n        le.setToolTip('Save results of the query in a table')\n\n        gui.button(self.custom_sql, self, 'Execute', callback=self.open_table)\n\n        box.layout().addWidget(self.custom_sql)\n\n        gui.checkBox(box, self, \"guess_values\",\n                     \"Auto-discover categorical variables\",\n                     callback=self.open_table)\n\n        self.downloadcb = gui.checkBox(box, self, \"download\",\n                                       \"Download data to local memory\",\n                                       callback=self.open_table)\n\n    def highlight_error(self, text=\"\"):\n        err = ['', 'QLineEdit {border: 2px solid red;}']\n        self.servertext.setStyleSheet(err['server' in text or 'host' in text])\n        self.usernametext.setStyleSheet(err['role' in text])\n        self.databasetext.setStyleSheet(err['database' in text])\n\n    def get_backend(self):\n        if self.backendcombo.currentIndex() < 0:\n            return None\n        return self.backends[self.backendcombo.currentIndex()]\n\n    def on_connection_success(self):\n        if getattr(self.backend, 'missing_extension', False):\n            self.Warning.missing_extension(\n                \", \".join(self.backend.missing_extension))\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        if not is_postgres(self.backend):\n            self.download = True\n            self.downloadcb.setEnabled(False)\n        super().on_connection_success()\n        self.refresh_tables()\n        self.select_table()\n\n    def on_connection_error(self, err):\n        super().on_connection_error(err)\n        self.highlight_error(str(err).split(\"\\n\")[0])\n\n    def clear(self):\n        super().clear()\n        self.Warning.missing_extension.clear()\n        self.downloadcb.setEnabled(True)\n        self.highlight_error()\n        self.tablecombo.clear()\n        self.tablecombo.repaint()\n\n    def refresh_tables(self):\n        self.tables.clear()\n        if self.backend is None:\n            self.data_desc_table = None\n            return\n\n        self.tables.append(\"Select a table\")\n        self.tables.append(\"Custom SQL\")\n        self.tables.extend(self.backend.list_tables(self.schema))\n        index = self.tablecombo.findText(str(self.table))\n        self.tablecombo.setCurrentIndex(index if index != -1 else 0)\n        self.tablecombo.repaint()\n\n    # Called on tablecombo selection change:\n    def select_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.custom_sql.setVisible(False)\n            return self.open_table()\n        else:\n            self.custom_sql.setVisible(True)\n            self.data_desc_table = None\n            self.database_desc[\"Table\"] = \"(None)\"\n            self.table = None\n            if len(str(self.sql)) > 14:\n                return self.open_table()\n        return None\n\n    def get_table(self):\n        curIdx = self.tablecombo.currentIndex()\n        if curIdx <= 0:\n            if self.database_desc:\n                self.database_desc[\"Table\"] = \"(None)\"\n            self.data_desc_table = None\n            return None\n\n        if self.tablecombo.itemText(curIdx) != \"Custom SQL\":\n            self.table = self.tables[self.tablecombo.currentIndex()]\n            self.database_desc[\"Table\"] = self.table\n            if \"Query\" in self.database_desc:\n                del self.database_desc[\"Query\"]\n            what = self.table\n        else:\n            what = self.sql = self.sqltext.toPlainText()\n            self.table = \"Custom SQL\"\n            if self.materialize:\n                if not self.materialize_table_name:\n                    self.Error.connection(\n                        \"Specify a table name to materialize the query\")\n                    return None\n                try:\n                    with self.backend.execute_sql_query(\"DROP TABLE IF EXISTS \" +\n                                                        self.materialize_table_name):\n                        pass\n                    with self.backend.execute_sql_query(\"CREATE TABLE \" +\n                                                        self.materialize_table_name +\n                                                        \" AS \" + self.sql):\n                        pass\n                    with self.backend.execute_sql_query(\"ANALYZE \" + self.materialize_table_name):\n                        pass\n                except BackendError as ex:\n                    self.Error.connection(str(ex))\n                    return None\n\n        try:\n            table = SqlTable(dict(host=self.host,\n                                  port=self.port,\n                                  database=self.database,\n                                  user=self.username,\n                                  password=self.password),\n                             what,\n                             backend=type(self.backend),\n                             inspect_values=False)\n        except BackendError as ex:\n            self.Error.connection(str(ex))\n            return None\n\n        self.Error.connection.clear()\n\n        sample = False\n\n        if table.approx_len() > LARGE_TABLE and self.guess_values:\n            confirm = QMessageBox(self)\n            confirm.setIcon(QMessageBox.Warning)\n            confirm.setText(\"Attribute discovery might take \"\n                            \"a long time on large tables.\\n\"\n                            \"Do you want to auto discover attributes?\")\n            confirm.addButton(\"Yes\", QMessageBox.YesRole)\n            no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n            if is_postgres(self.backend):\n                sample_button = confirm.addButton(\"Yes, on a sample\",\n                                                  QMessageBox.YesRole)\n            confirm.exec()\n            if confirm.clickedButton() == no_button:\n                self.guess_values = False\n            elif is_postgres(self.backend) and \\\n                    confirm.clickedButton() == sample_button:\n                sample = True\n\n        self.Information.clear()\n        if self.guess_values:\n            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))\n            if sample:\n                s = table.sample_time(1)\n                domain = s.get_domain(inspect_values=True)\n                self.Information.data_sampled()\n            else:\n                domain = table.get_domain(inspect_values=True)\n            QApplication.restoreOverrideCursor()\n            table.domain = domain\n\n        if self.download:\n            if table.approx_len() > AUTO_DL_LIMIT:\n                if is_postgres(self.backend):\n                    confirm = QMessageBox(self)\n                    confirm.setIcon(QMessageBox.Warning)\n                    confirm.setText(\"Data appears to be big. Do you really \"\n                                    \"want to download it to local memory?\")\n\n                    if table.approx_len() <= MAX_DL_LIMIT:\n                        confirm.addButton(\"Yes\", QMessageBox.YesRole)\n                    no_button = confirm.addButton(\"No\", QMessageBox.NoRole)\n                    sample_button = confirm.addButton(\"Yes, a sample\",\n                                                      QMessageBox.YesRole)\n                    confirm.exec()\n                    if confirm.clickedButton() == no_button:\n                        return None\n                    elif confirm.clickedButton() == sample_button:\n                        table = table.sample_percentage(\n                            AUTO_DL_LIMIT / table.approx_len() * 100)\n                else:\n                    if table.approx_len() > MAX_DL_LIMIT:\n                        QMessageBox.warning(\n                            self, 'Warning', \"Data is too big to download.\\n\")\n                        return None\n                    else:\n                        confirm = QMessageBox.question(\n                            self, 'Question',\n                            \"Data appears to be big. Do you really \"\n                            \"want to download it to local memory?\",\n                            QMessageBox.Yes | QMessageBox.No, QMessageBox.No)\n                        if confirm == QMessageBox.No:\n                            return None\n\n            table.download_data(MAX_DL_LIMIT)\n            table = Table(table)\n\n        return table\n\n    @classmethod\n    def migrate_settings(cls, settings, version):\n        if version < 2:\n            # Until Orange version 3.4.4 username and password had been stored\n            # in Settings.\n            cm = cls._credential_manager(settings[\"host\"], settings[\"port\"])\n            cm.username = settings[\"username\"]\n            cm.password = settings[\"password\"]\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    WidgetPreview(OWSql).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]

**Title**: Selected backend not retained after saving settings in SQL widget

**Description**:
When a user selects a different backend in the SQL widget and saves the settings, the selected backend is not retained upon reopening the widget. Instead, it defaults back to the initial backend, disregarding the user's choice.

**Example Buggy Code**:
```python
def test_selected_backend_not_saved():
    widget = create_widget(OWSql)
    widget.backendcombo.setCurrentText('B2')
    settings = widget.get_settings()
    # After reloading the widget with saved settings
    new_widget = create_widget(OWSql, settings)
    assert new_widget.backendcombo.currentText() == 'B2'  # Fails, shows 'B1'
```

**Expected Behavior**:
After selecting 'B2' as the backend and saving the settings, reopening the SQL widget should display 'B2' as the selected backend.

**Actual Behavior**:
The SQL widget reverts to displaying 'B1' as the selected backend, ignoring the user's selection of 'B2'.

[/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/owsql.py
from AnyQt.QtWidgets import QComboBox, QTextEdit, QMessageBox, QApplication
from AnyQt.QtGui import QCursor
from AnyQt.QtCore import Qt

from Orange.data import Table
from Orange.data.sql.backend import Backend
from Orange.data.sql.backend.base import BackendError
from Orange.data.sql.table import SqlTable, LARGE_TABLE, AUTO_DL_LIMIT
from Orange.widgets import gui
from Orange.widgets.settings import Setting
from Orange.widgets.utils.itemmodels import PyListModel
from Orange.widgets.utils.owbasesql import OWBaseSql
from Orange.widgets.utils.widgetpreview import WidgetPreview
from Orange.widgets.widget import Output, Msg

MAX_DL_LIMIT = 1000000


def is_postgres(backend):
    return getattr(backend, 'display_name', '') == "PostgreSQL"


class TableModel(PyListModel):
    def data(self, index, role=Qt.DisplayRole):
        row = index.row()
        if role == Qt.DisplayRole:
            return str(self[row])
        return super().data(index, role)


class BackendModel(PyListModel):
    def data(self, index, role=Qt.DisplayRole):
        row = index.row()
        if role == Qt.DisplayRole:
            return self[row].display_name
        return super().data(index, role)


class OWSql(OWBaseSql):
    name = "SQL Table"
    id = "orange.widgets.data.sql"
    description = "Load dataset from SQL."
    icon = "icons/SQLTable.svg"
    priority = 30
    category = "Data"
    keywords = ["load"]

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

    settings_version = 2

    table = Setting(None)
    sql = Setting("")
    guess_values = Setting(True)
    download = Setting(False)

    materialize = Setting(False)
    materialize_table_name = Setting("")

    class Information(OWBaseSql.Information):
        data_sampled = Msg("Data description was generated from a sample.")

    class Warning(OWBaseSql.Warning):
        missing_extension = Msg("Database is missing extensions: {}")

    class Error(OWBaseSql.Error):
        no_backends = Msg("Please install a backend to use this widget.")

    def __init__(self):
        # Lint
        self.backends = None
        self.backendcombo = None
        self.tables = None
        self.tablecombo = None
        self.sqltext = None
        self.custom_sql = None
        self.downloadcb = None
        super().__init__()

    def _setup_gui(self):
        super()._setup_gui()
        self._add_backend_controls()
        self._add_tables_controls()

    def _add_backend_controls(self):
        box = self.serverbox
        self.backends = BackendModel(Backend.available_backends())
        self.backendcombo = QComboBox(box)
        if self.backends:
            self.backendcombo.setModel(self.backends)
        else:
            self.Error.no_backends()
            box.setEnabled(False)
        box.layout().insertWidget(0, self.backendcombo)

    def _add_tables_controls(self):
        vbox = gui.vBox(self.controlArea, "Tables", addSpace=True)
        box = gui.vBox(vbox)
        self.tables = TableModel()

        self.tablecombo = QComboBox(
            minimumContentsLength=35,
            sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLength
        )
        self.tablecombo.setModel(self.tables)
        self.tablecombo.setToolTip('table')
        self.tablecombo.activated[int].connect(self.select_table)
        box.layout().addWidget(self.tablecombo)

        self.custom_sql = gui.vBox(box)
        self.custom_sql.setVisible(False)
        self.sqltext = QTextEdit(self.custom_sql)
        self.sqltext.setPlainText(self.sql)
        self.custom_sql.layout().addWidget(self.sqltext)

        mt = gui.hBox(self.custom_sql)
        cb = gui.checkBox(mt, self, 'materialize', 'Materialize to table ')
        cb.setToolTip('Save results of the query in a table')
        le = gui.lineEdit(mt, self, 'materialize_table_name')
        le.setToolTip('Save results of the query in a table')

        gui.button(self.custom_sql, self, 'Execute', callback=self.open_table)

        box.layout().addWidget(self.custom_sql)

        gui.checkBox(box, self, "guess_values",
                     "Auto-discover categorical variables",
                     callback=self.open_table)

        self.downloadcb = gui.checkBox(box, self, "download",
                                       "Download data to local memory",
                                       callback=self.open_table)

    def highlight_error(self, text=""):
        err = ['', 'QLineEdit {border: 2px solid red;}']
        self.servertext.setStyleSheet(err['server' in text or 'host' in text])
        self.usernametext.setStyleSheet(err['role' in text])
        self.databasetext.setStyleSheet(err['database' in text])

    def get_backend(self):
        if self.backendcombo.currentIndex() < 0:
            return None
        return self.backends[self.backendcombo.currentIndex()]

    def on_connection_success(self):
        if getattr(self.backend, 'missing_extension', False):
            self.Warning.missing_extension(
                ", ".join(self.backend.missing_extension))
            self.download = True
            self.downloadcb.setEnabled(False)
        if not is_postgres(self.backend):
            self.download = True
            self.downloadcb.setEnabled(False)
        super().on_connection_success()
        self.refresh_tables()
        self.select_table()

    def on_connection_error(self, err):
        super().on_connection_error(err)
        self.highlight_error(str(err).split("\n")[0])

    def clear(self):
        super().clear()
        self.Warning.missing_extension.clear()
        self.downloadcb.setEnabled(True)
        self.highlight_error()
        self.tablecombo.clear()
        self.tablecombo.repaint()

    def refresh_tables(self):
        self.tables.clear()
        if self.backend is None:
            self.data_desc_table = None
            return

        self.tables.append("Select a table")
        self.tables.append("Custom SQL")
        self.tables.extend(self.backend.list_tables(self.schema))
        index = self.tablecombo.findText(str(self.table))
        self.tablecombo.setCurrentIndex(index if index != -1 else 0)
        self.tablecombo.repaint()

    # Called on tablecombo selection change:
    def select_table(self):
        curIdx = self.tablecombo.currentIndex()
        if self.tablecombo.itemText(curIdx) != "Custom SQL":
            self.custom_sql.setVisible(False)
            return self.open_table()
        else:
            self.custom_sql.setVisible(True)
            self.data_desc_table = None
            self.database_desc["Table"] = "(None)"
            self.table = None
            if len(str(self.sql)) > 14:
                return self.open_table()
        return None

    def get_table(self):
        curIdx = self.tablecombo.currentIndex()
        if curIdx <= 0:
            if self.database_desc:
                self.database_desc["Table"] = "(None)"
            self.data_desc_table = None
            return None

        if self.tablecombo.itemText(curIdx) != "Custom SQL":
            self.table = self.tables[self.tablecombo.currentIndex()]
            self.database_desc["Table"] = self.table
            if "Query" in self.database_desc:
                del self.database_desc["Query"]
            what = self.table
        else:
            what = self.sql = self.sqltext.toPlainText()
            self.table = "Custom SQL"
            if self.materialize:
                if not self.materialize_table_name:
                    self.Error.connection(
                        "Specify a table name to materialize the query")
                    return None
                try:
                    with self.backend.execute_sql_query("DROP TABLE IF EXISTS " +
                                                        self.materialize_table_name):
                        pass
                    with self.backend.execute_sql_query("CREATE TABLE " +
                                                        self.materialize_table_name +
                                                        " AS " + self.sql):
                        pass
                    with self.backend.execute_sql_query("ANALYZE " + self.materialize_table_name):
                        pass
                except BackendError as ex:
                    self.Error.connection(str(ex))
                    return None

        try:
            table = SqlTable(dict(host=self.host,
                                  port=self.port,
                                  database=self.database,
                                  user=self.username,
                                  password=self.password),
                             what,
                             backend=type(self.backend),
                             inspect_values=False)
        except BackendError as ex:
            self.Error.connection(str(ex))
            return None

        self.Error.connection.clear()

        sample = False

        if table.approx_len() > LARGE_TABLE and self.guess_values:
            confirm = QMessageBox(self)
            confirm.setIcon(QMessageBox.Warning)
            confirm.setText("Attribute discovery might take "
                            "a long time on large tables.\n"
                            "Do you want to auto discover attributes?")
            confirm.addButton("Yes", QMessageBox.YesRole)
            no_button = confirm.addButton("No", QMessageBox.NoRole)
            if is_postgres(self.backend):
                sample_button = confirm.addButton("Yes, on a sample",
                                                  QMessageBox.YesRole)
            confirm.exec()
            if confirm.clickedButton() == no_button:
                self.guess_values = False
            elif is_postgres(self.backend) and \
                    confirm.clickedButton() == sample_button:
                sample = True

        self.Information.clear()
        if self.guess_values:
            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
            if sample:
                s = table.sample_time(1)
                domain = s.get_domain(inspect_values=True)
                self.Information.data_sampled()
            else:
                domain = table.get_domain(inspect_values=True)
            QApplication.restoreOverrideCursor()
            table.domain = domain

        if self.download:
            if table.approx_len() > AUTO_DL_LIMIT:
                if is_postgres(self.backend):
                    confirm = QMessageBox(self)
                    confirm.setIcon(QMessageBox.Warning)
                    confirm.setText("Data appears to be big. Do you really "
                                    "want to download it to local memory?")

                    if table.approx_len() <= MAX_DL_LIMIT:
                        confirm.addButton("Yes", QMessageBox.YesRole)
                    no_button = confirm.addButton("No", QMessageBox.NoRole)
                    sample_button = confirm.addButton("Yes, a sample",
                                                      QMessageBox.YesRole)
                    confirm.exec()
                    if confirm.clickedButton() == no_button:
                        return None
                    elif confirm.clickedButton() == sample_button:
                        table = table.sample_percentage(
                            AUTO_DL_LIMIT / table.approx_len() * 100)
                else:
                    if table.approx_len() > MAX_DL_LIMIT:
                        QMessageBox.warning(
                            self, 'Warning', "Data is too big to download.\n")
                        return None
                    else:
                        confirm = QMessageBox.question(
                            self, 'Question',
                            "Data appears to be big. Do you really "
                            "want to download it to local memory?",
                            QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
                        if confirm == QMessageBox.No:
                            return None

            table.download_data(MAX_DL_LIMIT)
            table = Table(table)

        return table

    @classmethod
    def migrate_settings(cls, settings, version):
        if version < 2:
            # Until Orange version 3.4.4 username and password had been stored
            # in Settings.
            cm = cls._credential_manager(settings["host"], settings["port"])
            cm.username = settings["username"]
            cm.password = settings["password"]


if __name__ == "__main__":  # pragma: no cover
    WidgetPreview(OWSql).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