{
    "file_diffs": [
        {
            "old_file_content": "import os.path\nimport sys\nimport re\n\nfrom AnyQt.QtWidgets import QFileDialog, QGridLayout, QMessageBox\n\nfrom Orange.widgets import gui, widget\nfrom Orange.widgets.settings import Setting\n\n\n_userhome = os.path.expanduser(f\"~{os.sep}\")\n\n\nclass OWSaveBase(widget.OWWidget, openclass=True):\n    \"\"\"\n    Base class for Save widgets\n\n    A derived class must provide, at minimum:\n\n    - class `Inputs` and the corresponding handler that:\n\n      - saves the input to an attribute `data`, and\n      - calls `self.on_new_input`.\n\n    - a class attribute `filters` with a list of filters or a dictionary whose\n      keys are filters OR a class method `get_filters` that returns such a\n      list or dictionary\n    - method `do_save` that saves `self.data` into `self.filename`\n\n    Alternatively, instead of defining `do_save` a derived class can make\n    `filters` a dictionary whose keys are classes that define a method `write`\n    (like e.g. `TabReader`). Method `do_save` defined in the base class calls\n    the writer corresponding to the currently chosen filter.\n\n    A minimum example of derived class is\n    `Orange.widgets.model.owsavemodel.OWSaveModel`.\n    A more advanced widget that overrides a lot of base class behaviour is\n    `Orange.widgets.data.owsave.OWSave`.\n    \"\"\"\n\n    class Information(widget.OWWidget.Information):\n        empty_input = widget.Msg(\"Empty input; nothing was saved.\")\n\n    class Error(widget.OWWidget.Error):\n        no_file_name = widget.Msg(\"File name is not set.\")\n        general_error = widget.Msg(\"{}\")\n\n    want_main_area = False\n    resizing_enabled = False\n\n    filter = Setting(\"\")  # Default is provided in __init__\n\n    # If the path is in the same directory as the workflow file or its\n    # subdirectory, it is stored as a relative path, otherwise as absolute.\n    # For the sake of security, we do not store relative paths from other\n    # directories, like home or cwd. After loading the widget from a schema,\n    # auto_save is set to off, unless the stored_path is relative (to the\n    # workflow).\n    stored_path = Setting(\"\")\n    stored_name = Setting(\"\", schema_only=True)  # File name, without path\n    auto_save = Setting(False)\n\n    filters = []\n\n    def __init__(self, start_row=0):\n        \"\"\"\n        Set up the gui.\n\n        The gui consists of a checkbox for auto save and two buttons put on a\n        grid layout. Derived widgets that want to place controls above the auto\n        save widget can set the `start_row` argument to the first free row,\n        and this constructor will start filling the grid there.\n\n        Args:\n            start_row (int): the row at which to start filling the gui\n        \"\"\"\n        super().__init__()\n        self.data = None\n        self._absolute_path = self._abs_path_from_setting()\n\n        # This cannot be done outside because `filters` is defined by subclass\n        if not self.filter:\n            self.filter = next(iter(self.get_filters()))\n\n        self.grid = grid = QGridLayout()\n        gui.widgetBox(self.controlArea, orientation=grid)\n        grid.addWidget(\n            gui.checkBox(\n                None, self, \"auto_save\", \"Autosave when receiving new data\",\n                callback=self.update_messages),\n            start_row, 0, 1, 2)\n        grid.setRowMinimumHeight(start_row + 1, 8)\n        self.bt_save = gui.button(\n            None, self,\n            label=f\"Save as {self.stored_name}\" if self.stored_name else \"Save\",\n            callback=self.save_file)\n        grid.addWidget(self.bt_save, start_row + 2, 0)\n        grid.addWidget(\n            gui.button(None, self, \"Save as ...\", callback=self.save_file_as),\n            start_row + 2, 1)\n\n        self.adjustSize()\n        self.update_messages()\n\n    @property\n    def last_dir(self):\n        # Not the best name, but kept for compatibility\n        return self._absolute_path\n\n    @last_dir.setter\n    def last_dir(self, absolute_path):\n        \"\"\"Store _absolute_path and update relative path (stored_path)\"\"\"\n        self._absolute_path = absolute_path\n\n        workflow_dir = self.workflowEnv().get(\"basedir\", None)\n        if workflow_dir and absolute_path.startswith(workflow_dir.rstrip(\"/\")):\n            self.stored_path = os.path.relpath(absolute_path, workflow_dir)\n        else:\n            self.stored_path = absolute_path\n\n    def _abs_path_from_setting(self):\n        \"\"\"\n        Compute absolute path from `stored_path` from settings.\n\n        Auto save is disabled unless stored_path is relative and exists.\n        \"\"\"\n        workflow_dir = self.workflowEnv().get(\"basedir\")\n        if os.path.isabs(self.stored_path):\n            path = self.stored_path\n            self.auto_save = False\n        elif workflow_dir:\n            path = os.path.join(workflow_dir, self.stored_path)\n        else:\n            path = None\n\n        if path and os.path.exists(path):\n            return path\n        else:\n            self.stored_path = workflow_dir or _userhome\n            self.auto_save = False\n            return self.stored_path\n\n    @property\n    def filename(self):\n        if self.stored_name:\n            return os.path.join(self._absolute_path, self.stored_name)\n        else:\n            return \"\"\n\n    @filename.setter\n    def filename(self, value):\n        self.last_dir, self.stored_name = os.path.split(value)\n\n    # pylint: disable=unused-argument\n    def workflowEnvChanged(self, key, value, oldvalue):\n        # Trigger refresh of relative path, e.g. when saving the scheme\n        if key == \"basedir\":\n            self.last_dir = self._absolute_path\n\n    @classmethod\n    def get_filters(cls):\n        return cls.filters\n\n    @property\n    def writer(self):\n        \"\"\"\n        Return the active writer\n\n        The base class uses this property only in `do_save` to find the writer\n        corresponding to the filter. Derived classes (e.g. OWSave) may also use\n        it elsewhere.\n        \"\"\"\n        return self.get_filters()[self.filter]\n\n    def on_new_input(self):\n        \"\"\"\n        This method must be called from input signal handler.\n\n        - It clears errors, warnings and information and calls\n          `self.update_messages` to set the as needed.\n        - It also calls `update_status` the can be overriden in derived\n          methods to set the status (e.g. the number of input rows)\n        - Calls `self.save_file` if `self.auto_save` is enabled and\n          `self.filename` is provided.\n        \"\"\"\n        self.Error.clear()\n        self.Warning.clear()\n        self.Information.clear()\n        self.update_messages()\n        self.update_status()\n        if self.auto_save and self.filename:\n            self.save_file()\n\n    def save_file_as(self):\n        \"\"\"\n        Ask the user for the filename and try saving the file\n        \"\"\"\n        filename, selected_filter = self.get_save_filename()\n        if not filename:\n            return\n        self.filename = filename\n        self.filter = selected_filter\n        self.bt_save.setText(f\"Save as {self.stored_name}\")\n        self.update_messages()\n        self._try_save()\n\n    def save_file(self):\n        \"\"\"\n        If file name is provided, try saving, else call save_file_as\n        \"\"\"\n        if not self.filename:\n            self.save_file_as()\n        else:\n            self._try_save()\n\n    def _try_save(self):\n        \"\"\"\n        Private method that calls do_save within try-except that catches and\n        shows IOError. Do nothing if not data or no file name.\n        \"\"\"\n        self.Error.general_error.clear()\n        if self.data is None or not self.filename:\n            return\n        try:\n            self.do_save()\n        except IOError as err_value:\n            self.Error.general_error(str(err_value))\n\n    def do_save(self):\n        \"\"\"\n        Do the saving.\n\n        Default implementation calls the write method of the writer\n        corresponding to the current filter. This requires that get_filters()\n        returns is a dictionary whose keys are classes.\n\n        Derived classes may simplify this by providing a list of filters and\n        override do_save. This is particularly handy if the widget supports only\n        a single format.\n        \"\"\"\n        # This method is separated out because it will usually be overriden\n        self.writer.write(self.filename, self.data)\n\n    def update_messages(self):\n        \"\"\"\n        Update errors, warnings and information.\n\n        Default method sets no_file_name if auto_save is enabled but file name\n        is not provided; and empty_input if file name is given but there is no\n        data.\n\n        Derived classes that define further messages will typically set them in\n        this method.\n        \"\"\"\n        self.Error.no_file_name(shown=not self.filename and self.auto_save)\n        self.Information.empty_input(shown=self.filename and self.data is None)\n\n    def update_status(self):\n        \"\"\"\n        Update the input/output indicator. Default method does nothing.\n        \"\"\"\n\n    def initial_start_dir(self):\n        \"\"\"\n        Provide initial start directory\n\n        Return either the current file's path, the last directory or home.\n        \"\"\"\n        if self.filename and os.path.exists(os.path.split(self.filename)[0]):\n            return self.filename\n        else:\n            return self.last_dir or _userhome\n\n    @staticmethod\n    def suggested_name():\n        \"\"\"\n        Suggest the name for the output file or return an empty string.\n        \"\"\"\n        return \"\"\n\n    @classmethod\n    def _replace_extension(cls, filename, extension):\n        \"\"\"\n        Remove all extensions that appear in any filter.\n\n        Double extensions are broken in different weird ways across all systems,\n        including omitting some, like turning iris.tab.gz to iris.gz. This\n        function removes anything that can appear anywhere.\n        \"\"\"\n        known_extensions = set()\n        for filt in cls.get_filters():\n            known_extensions |= set(cls._extension_from_filter(filt).split(\".\"))\n        if \"\" in known_extensions:\n            known_extensions.remove(\"\")\n        while True:\n            base, ext = os.path.splitext(filename)\n            if ext[1:] not in known_extensions:\n                break\n            filename = base\n        return filename + extension\n\n    @staticmethod\n    def _extension_from_filter(selected_filter):\n        return re.search(r\".*\\(\\*?(\\..*)\\)$\", selected_filter).group(1)\n\n    def valid_filters(self):\n        return self.get_filters()\n\n    def default_valid_filter(self):\n        return self.filter\n\n    @classmethod\n    def migrate_settings(cls, settings, version):\n        # We cannot use versions because they are overriden in derived classes\n        if \"last_dir\" in settings:\n            settings[\"stored_path\"] = settings.pop(\"last_dir\")\n        if \"filename\" in settings:\n            settings[\"stored_name\"] = os.path.split(\n                settings.pop(\"filename\") or \"\")[1]\n\n    # As of Qt 5.9, QFileDialog.setDefaultSuffix does not support double\n    # suffixes, not even in non-native dialogs. We handle each OS separately.\n    if sys.platform in (\"darwin\", \"win32\"):\n        # macOS and Windows native dialogs do not correctly handle double\n        # extensions. We thus don't pass any suffixes to the dialog and add\n        # the correct suffix after closing the dialog and only then check\n        # if the file exists and ask whether to override.\n        # It is a bit confusing that the user does not see the final name in the\n        # dialog, but I see no better solution.\n        def get_save_filename(self):  # pragma: no cover\n            if sys.platform == \"darwin\":\n                def remove_star(filt):\n                    return filt.replace(\" (*.\", \" (.\")\n            else:\n                def remove_star(filt):\n                    return filt\n\n            no_ext_filters = {remove_star(f): f for f in self.valid_filters()}\n            filename = self.initial_start_dir()\n            while True:\n                dlg = QFileDialog(\n                    None, \"Save File\", filename, \";;\".join(no_ext_filters))\n                dlg.setAcceptMode(dlg.AcceptSave)\n                dlg.selectNameFilter(remove_star(self.default_valid_filter()))\n                dlg.setOption(QFileDialog.DontConfirmOverwrite)\n                if dlg.exec() == QFileDialog.Rejected:\n                    return \"\", \"\"\n                filename = dlg.selectedFiles()[0]\n                selected_filter = no_ext_filters[dlg.selectedNameFilter()]\n                filename = self._replace_extension(\n                    filename, self._extension_from_filter(selected_filter))\n                if not os.path.exists(filename) or QMessageBox.question(\n                        self, \"Overwrite file?\",\n                        f\"File {os.path.split(filename)[1]} already exists.\\n\"\n                        \"Overwrite?\") == QMessageBox.Yes:\n                    return filename, selected_filter\n\n    else:  # Linux and any unknown platforms\n        # Qt does not use a native dialog on Linux, so we can connect to\n        # filterSelected and to overload selectFile to change the extension\n        # while the dialog is open.\n        # For unknown platforms (which?), we also use the non-native dialog to\n        # be sure we know what happens.\n        class SaveFileDialog(QFileDialog):\n            # pylint: disable=protected-access\n            def __init__(self, save_cls, *args, **kwargs):\n                super().__init__(*args, **kwargs)\n                self.save_cls = save_cls\n                self.suffix = \"\"\n                self.setAcceptMode(QFileDialog.AcceptSave)\n                self.setOption(QFileDialog.DontUseNativeDialog)\n                self.filterSelected.connect(self.updateDefaultExtension)\n\n            def selectNameFilter(self, selected_filter):\n                super().selectNameFilter(selected_filter)\n                self.updateDefaultExtension(selected_filter)\n\n            def updateDefaultExtension(self, selected_filter):\n                self.suffix = \\\n                    self.save_cls._extension_from_filter(selected_filter)\n                files = self.selectedFiles()\n                if files and not os.path.isdir(files[0]):\n                    self.selectFile(files[0])\n\n            def selectFile(self, filename):\n                filename = \\\n                    self.save_cls._replace_extension(filename, self.suffix)\n                super().selectFile(filename)\n\n        def get_save_filename(self):\n            dlg = self.SaveFileDialog(\n                type(self),\n                None, \"Save File\", self.initial_start_dir(),\n                \";;\".join(self.valid_filters()))\n            dlg.selectNameFilter(self.default_valid_filter())\n            if dlg.exec() == QFileDialog.Rejected:\n                return \"\", \"\"\n            else:\n                return dlg.selectedFiles()[0], dlg.selectedNameFilter()\n",
            "new_file_content": "import os.path\nimport sys\nimport re\n\nfrom AnyQt.QtWidgets import QFileDialog, QGridLayout, QMessageBox\n\nfrom Orange.widgets import gui, widget\nfrom Orange.widgets.settings import Setting\n\n\n_userhome = os.path.expanduser(f\"~{os.sep}\")\n\n\nclass OWSaveBase(widget.OWWidget, openclass=True):\n    \"\"\"\n    Base class for Save widgets\n\n    A derived class must provide, at minimum:\n\n    - class `Inputs` and the corresponding handler that:\n\n      - saves the input to an attribute `data`, and\n      - calls `self.on_new_input`.\n\n    - a class attribute `filters` with a list of filters or a dictionary whose\n      keys are filters OR a class method `get_filters` that returns such a\n      list or dictionary\n    - method `do_save` that saves `self.data` into `self.filename`\n\n    Alternatively, instead of defining `do_save` a derived class can make\n    `filters` a dictionary whose keys are classes that define a method `write`\n    (like e.g. `TabReader`). Method `do_save` defined in the base class calls\n    the writer corresponding to the currently chosen filter.\n\n    A minimum example of derived class is\n    `Orange.widgets.model.owsavemodel.OWSaveModel`.\n    A more advanced widget that overrides a lot of base class behaviour is\n    `Orange.widgets.data.owsave.OWSave`.\n    \"\"\"\n\n    class Information(widget.OWWidget.Information):\n        empty_input = widget.Msg(\"Empty input; nothing was saved.\")\n\n    class Error(widget.OWWidget.Error):\n        no_file_name = widget.Msg(\"File name is not set.\")\n        general_error = widget.Msg(\"{}\")\n\n    want_main_area = False\n    resizing_enabled = False\n\n    filter = Setting(\"\")  # Default is provided in __init__\n\n    # If the path is in the same directory as the workflow file or its\n    # subdirectory, it is stored as a relative path, otherwise as absolute.\n    # For the sake of security, we do not store relative paths from other\n    # directories, like home or cwd. After loading the widget from a schema,\n    # auto_save is set to off, unless the stored_path is relative (to the\n    # workflow).\n    stored_path = Setting(\"\")\n    stored_name = Setting(\"\", schema_only=True)  # File name, without path\n    auto_save = Setting(False)\n\n    filters = []\n\n    def __init__(self, start_row=0):\n        \"\"\"\n        Set up the gui.\n\n        The gui consists of a checkbox for auto save and two buttons put on a\n        grid layout. Derived widgets that want to place controls above the auto\n        save widget can set the `start_row` argument to the first free row,\n        and this constructor will start filling the grid there.\n\n        Args:\n            start_row (int): the row at which to start filling the gui\n        \"\"\"\n        super().__init__()\n        self.data = None\n        self._absolute_path = self._abs_path_from_setting()\n\n        # This cannot be done outside because `filters` is defined by subclass\n        if not self.filter:\n            self.filter = next(iter(self.get_filters()))\n\n        self.grid = grid = QGridLayout()\n        gui.widgetBox(self.controlArea, orientation=grid)\n        grid.addWidget(\n            gui.checkBox(\n                None, self, \"auto_save\", \"Autosave when receiving new data\",\n                callback=self.update_messages),\n            start_row, 0, 1, 2)\n        grid.setRowMinimumHeight(start_row + 1, 8)\n        self.bt_save = gui.button(\n            None, self,\n            label=f\"Save as {self.stored_name}\" if self.stored_name else \"Save\",\n            callback=self.save_file)\n        grid.addWidget(self.bt_save, start_row + 2, 0)\n        grid.addWidget(\n            gui.button(None, self, \"Save as ...\", callback=self.save_file_as),\n            start_row + 2, 1)\n\n        self.adjustSize()\n        self.update_messages()\n\n    @property\n    def last_dir(self):\n        # Not the best name, but kept for compatibility\n        return self._absolute_path\n\n    @last_dir.setter\n    def last_dir(self, absolute_path):\n        \"\"\"Store _absolute_path and update relative path (stored_path)\"\"\"\n        self._absolute_path = absolute_path\n\n        workflow_dir = self.workflowEnv().get(\"basedir\", None)\n        if workflow_dir and absolute_path.startswith(workflow_dir.rstrip(\"/\")):\n            self.stored_path = os.path.relpath(absolute_path, workflow_dir)\n        else:\n            self.stored_path = absolute_path\n\n    def _abs_path_from_setting(self):\n        \"\"\"\n        Compute absolute path from `stored_path` from settings.\n\n        Absolute stored path is used only if it exists.\n        Auto save is disabled unless stored_path is relative.\n        \"\"\"\n        workflow_dir = self.workflowEnv().get(\"basedir\")\n        if os.path.isabs(self.stored_path):\n            if os.path.exists(self.stored_path):\n                self.auto_save = False\n                return self.stored_path\n        elif workflow_dir:\n            return os.path.normpath(\n                os.path.join(workflow_dir, self.stored_path))\n\n        self.stored_path = workflow_dir or _userhome\n        self.auto_save = False\n        return self.stored_path\n\n    @property\n    def filename(self):\n        if self.stored_name:\n            return os.path.join(self._absolute_path, self.stored_name)\n        else:\n            return \"\"\n\n    @filename.setter\n    def filename(self, value):\n        self.last_dir, self.stored_name = os.path.split(value)\n\n    # pylint: disable=unused-argument\n    def workflowEnvChanged(self, key, value, oldvalue):\n        # Trigger refresh of relative path, e.g. when saving the scheme\n        if key == \"basedir\":\n            self.last_dir = self._absolute_path\n\n    @classmethod\n    def get_filters(cls):\n        return cls.filters\n\n    @property\n    def writer(self):\n        \"\"\"\n        Return the active writer\n\n        The base class uses this property only in `do_save` to find the writer\n        corresponding to the filter. Derived classes (e.g. OWSave) may also use\n        it elsewhere.\n        \"\"\"\n        return self.get_filters()[self.filter]\n\n    def on_new_input(self):\n        \"\"\"\n        This method must be called from input signal handler.\n\n        - It clears errors, warnings and information and calls\n          `self.update_messages` to set the as needed.\n        - It also calls `update_status` the can be overriden in derived\n          methods to set the status (e.g. the number of input rows)\n        - Calls `self.save_file` if `self.auto_save` is enabled and\n          `self.filename` is provided.\n        \"\"\"\n        self.Error.clear()\n        self.Warning.clear()\n        self.Information.clear()\n        self.update_messages()\n        self.update_status()\n        if self.auto_save and self.filename:\n            self.save_file()\n\n    def save_file_as(self):\n        \"\"\"\n        Ask the user for the filename and try saving the file\n        \"\"\"\n        filename, selected_filter = self.get_save_filename()\n        if not filename:\n            return\n        self.filename = filename\n        self.filter = selected_filter\n        self.bt_save.setText(f\"Save as {self.stored_name}\")\n        self.update_messages()\n        self._try_save()\n\n    def save_file(self):\n        \"\"\"\n        If file name is provided, try saving, else call save_file_as\n        \"\"\"\n        if not self.filename:\n            self.save_file_as()\n        else:\n            self._try_save()\n\n    def _try_save(self):\n        \"\"\"\n        Private method that calls do_save within try-except that catches and\n        shows IOError. Do nothing if not data or no file name.\n        \"\"\"\n        self.Error.general_error.clear()\n        if self.data is None or not self.filename:\n            return\n        try:\n            self.do_save()\n        except IOError as err_value:\n            self.Error.general_error(str(err_value))\n\n    def do_save(self):\n        \"\"\"\n        Do the saving.\n\n        Default implementation calls the write method of the writer\n        corresponding to the current filter. This requires that get_filters()\n        returns is a dictionary whose keys are classes.\n\n        Derived classes may simplify this by providing a list of filters and\n        override do_save. This is particularly handy if the widget supports only\n        a single format.\n        \"\"\"\n        # This method is separated out because it will usually be overriden\n        self.writer.write(self.filename, self.data)\n\n    def update_messages(self):\n        \"\"\"\n        Update errors, warnings and information.\n\n        Default method sets no_file_name if auto_save is enabled but file name\n        is not provided; and empty_input if file name is given but there is no\n        data.\n\n        Derived classes that define further messages will typically set them in\n        this method.\n        \"\"\"\n        self.Error.no_file_name(shown=not self.filename and self.auto_save)\n        self.Information.empty_input(shown=self.filename and self.data is None)\n\n    def update_status(self):\n        \"\"\"\n        Update the input/output indicator. Default method does nothing.\n        \"\"\"\n\n    def initial_start_dir(self):\n        \"\"\"\n        Provide initial start directory\n\n        Return either the current file's path, the last directory or home.\n        \"\"\"\n        if self.filename and os.path.exists(os.path.split(self.filename)[0]):\n            return self.filename\n        else:\n            return self.last_dir or _userhome\n\n    @staticmethod\n    def suggested_name():\n        \"\"\"\n        Suggest the name for the output file or return an empty string.\n        \"\"\"\n        return \"\"\n\n    @classmethod\n    def _replace_extension(cls, filename, extension):\n        \"\"\"\n        Remove all extensions that appear in any filter.\n\n        Double extensions are broken in different weird ways across all systems,\n        including omitting some, like turning iris.tab.gz to iris.gz. This\n        function removes anything that can appear anywhere.\n        \"\"\"\n        known_extensions = set()\n        for filt in cls.get_filters():\n            known_extensions |= set(cls._extension_from_filter(filt).split(\".\"))\n        if \"\" in known_extensions:\n            known_extensions.remove(\"\")\n        while True:\n            base, ext = os.path.splitext(filename)\n            if ext[1:] not in known_extensions:\n                break\n            filename = base\n        return filename + extension\n\n    @staticmethod\n    def _extension_from_filter(selected_filter):\n        return re.search(r\".*\\(\\*?(\\..*)\\)$\", selected_filter).group(1)\n\n    def valid_filters(self):\n        return self.get_filters()\n\n    def default_valid_filter(self):\n        return self.filter\n\n    @classmethod\n    def migrate_settings(cls, settings, version):\n        # We cannot use versions because they are overriden in derived classes\n        if \"last_dir\" in settings:\n            settings[\"stored_path\"] = settings.pop(\"last_dir\")\n        if \"filename\" in settings:\n            settings[\"stored_name\"] = os.path.split(\n                settings.pop(\"filename\") or \"\")[1]\n\n    # As of Qt 5.9, QFileDialog.setDefaultSuffix does not support double\n    # suffixes, not even in non-native dialogs. We handle each OS separately.\n    if sys.platform in (\"darwin\", \"win32\"):\n        # macOS and Windows native dialogs do not correctly handle double\n        # extensions. We thus don't pass any suffixes to the dialog and add\n        # the correct suffix after closing the dialog and only then check\n        # if the file exists and ask whether to override.\n        # It is a bit confusing that the user does not see the final name in the\n        # dialog, but I see no better solution.\n        def get_save_filename(self):  # pragma: no cover\n            if sys.platform == \"darwin\":\n                def remove_star(filt):\n                    return filt.replace(\" (*.\", \" (.\")\n            else:\n                def remove_star(filt):\n                    return filt\n\n            no_ext_filters = {remove_star(f): f for f in self.valid_filters()}\n            filename = self.initial_start_dir()\n            while True:\n                dlg = QFileDialog(\n                    None, \"Save File\", filename, \";;\".join(no_ext_filters))\n                dlg.setAcceptMode(dlg.AcceptSave)\n                dlg.selectNameFilter(remove_star(self.default_valid_filter()))\n                dlg.setOption(QFileDialog.DontConfirmOverwrite)\n                if dlg.exec() == QFileDialog.Rejected:\n                    return \"\", \"\"\n                filename = dlg.selectedFiles()[0]\n                selected_filter = no_ext_filters[dlg.selectedNameFilter()]\n                filename = self._replace_extension(\n                    filename, self._extension_from_filter(selected_filter))\n                if not os.path.exists(filename) or QMessageBox.question(\n                        self, \"Overwrite file?\",\n                        f\"File {os.path.split(filename)[1]} already exists.\\n\"\n                        \"Overwrite?\") == QMessageBox.Yes:\n                    return filename, selected_filter\n\n    else:  # Linux and any unknown platforms\n        # Qt does not use a native dialog on Linux, so we can connect to\n        # filterSelected and to overload selectFile to change the extension\n        # while the dialog is open.\n        # For unknown platforms (which?), we also use the non-native dialog to\n        # be sure we know what happens.\n        class SaveFileDialog(QFileDialog):\n            # pylint: disable=protected-access\n            def __init__(self, save_cls, *args, **kwargs):\n                super().__init__(*args, **kwargs)\n                self.save_cls = save_cls\n                self.suffix = \"\"\n                self.setAcceptMode(QFileDialog.AcceptSave)\n                self.setOption(QFileDialog.DontUseNativeDialog)\n                self.filterSelected.connect(self.updateDefaultExtension)\n\n            def selectNameFilter(self, selected_filter):\n                super().selectNameFilter(selected_filter)\n                self.updateDefaultExtension(selected_filter)\n\n            def updateDefaultExtension(self, selected_filter):\n                self.suffix = \\\n                    self.save_cls._extension_from_filter(selected_filter)\n                files = self.selectedFiles()\n                if files and not os.path.isdir(files[0]):\n                    self.selectFile(files[0])\n\n            def selectFile(self, filename):\n                filename = \\\n                    self.save_cls._replace_extension(filename, self.suffix)\n                super().selectFile(filename)\n\n        def get_save_filename(self):\n            dlg = self.SaveFileDialog(\n                type(self),\n                None, \"Save File\", self.initial_start_dir(),\n                \";;\".join(self.valid_filters()))\n            dlg.selectNameFilter(self.default_valid_filter())\n            if dlg.exec() == QFileDialog.Rejected:\n                return \"\", \"\"\n            else:\n                return dlg.selectedFiles()[0], dlg.selectedNameFilter()\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/utils/save/owsavebase.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "4b43f3637",
                "new_commit_hash": "ed527207b",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/utils/save/owsavebase.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/utils/save/owsavebase.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 122,
                            "length": 23
                        },
                        "new_range": {
                            "start": 122,
                            "length": 21
                        },
                        "section": "class OWSaveBase(widget.OWWidget, openclass=True):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "        \"\"\"",
                                "type": "context"
                            },
                            {
                                "content": "        Compute absolute path from `stored_path` from settings.",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        Auto save is disabled unless stored_path is relative and exists.",
                                "type": "deleted"
                            },
                            {
                                "content": "        Absolute stored path is used only if it exists.",
                                "type": "added"
                            },
                            {
                                "content": "        Auto save is disabled unless stored_path is relative.",
                                "type": "added"
                            },
                            {
                                "content": "        \"\"\"",
                                "type": "context"
                            },
                            {
                                "content": "        workflow_dir = self.workflowEnv().get(\"basedir\")",
                                "type": "context"
                            },
                            {
                                "content": "        if os.path.isabs(self.stored_path):",
                                "type": "context"
                            },
                            {
                                "content": "            path = self.stored_path",
                                "type": "deleted"
                            },
                            {
                                "content": "            self.auto_save = False",
                                "type": "deleted"
                            },
                            {
                                "content": "            if os.path.exists(self.stored_path):",
                                "type": "added"
                            },
                            {
                                "content": "                self.auto_save = False",
                                "type": "added"
                            },
                            {
                                "content": "                return self.stored_path",
                                "type": "added"
                            },
                            {
                                "content": "        elif workflow_dir:",
                                "type": "context"
                            },
                            {
                                "content": "            path = os.path.join(workflow_dir, self.stored_path)",
                                "type": "deleted"
                            },
                            {
                                "content": "        else:",
                                "type": "deleted"
                            },
                            {
                                "content": "            path = None",
                                "type": "deleted"
                            },
                            {
                                "content": "            return os.path.normpath(",
                                "type": "added"
                            },
                            {
                                "content": "                os.path.join(workflow_dir, self.stored_path))",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "        if path and os.path.exists(path):",
                                "type": "deleted"
                            },
                            {
                                "content": "            return path",
                                "type": "deleted"
                            },
                            {
                                "content": "        else:",
                                "type": "deleted"
                            },
                            {
                                "content": "            self.stored_path = workflow_dir or _userhome",
                                "type": "deleted"
                            },
                            {
                                "content": "            self.auto_save = False",
                                "type": "deleted"
                            },
                            {
                                "content": "            return self.stored_path",
                                "type": "deleted"
                            },
                            {
                                "content": "        self.stored_path = workflow_dir or _userhome",
                                "type": "added"
                            },
                            {
                                "content": "        self.auto_save = False",
                                "type": "added"
                            },
                            {
                                "content": "        return self.stored_path",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    @property",
                                "type": "context"
                            },
                            {
                                "content": "    def filename(self):",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/utils/save/owsavebase.py",
                            "type": "method",
                            "name": "OWSaveBase._abs_path_from_setting",
                            "content": "class OWSaveBase(widget.OWWidget, openclass=True):\n    \"\"\"\n    Base class for Save widgets\n\n    A derived class must provide, at minimum:\n\n    - class `Inputs` and the corresponding handler that:\n\n      - saves the input to an attribute `data`, and\n      - calls `self.on_new_input`.\n\n    - a class attribute `filters` with a list of filters or a dictionary whose\n      keys are filters OR a class method `get_filters` that returns such a\n      list or dictionary\n    - method `do_save` that saves `self.data` into `self.filename`\n\n    Alternatively, instead of defining `do_save` a derived class can make\n    `filters` a dictionary whose keys are classes that define a method `write`\n    (like e.g. `TabReader`). Method `do_save` defined in the base class calls\n    the writer corresponding to the currently chosen filter.\n\n    A minimum example of derived class is\n    `Orange.widgets.model.owsavemodel.OWSaveModel`.\n    A more advanced widget that overrides a lot of base class behaviour is\n    `Orange.widgets.data.owsave.OWSave`.\n    \"\"\"\n\n    class Information(widget.OWWidget.Information):\n        empty_input = widget.Msg(\"Empty input; nothing was saved.\")\n\n    class Error(widget.OWWidget.Error):\n        no_file_name = widget.Msg(\"File name is not set.\")\n        general_error = widget.Msg(\"{}\")\n\n    want_main_area = False\n    resizing_enabled = False\n\n    filter = Setting(\"\")  # Default is provided in __init__\n\n    # If the path is in the same directory as the workflow file or its\n    # subdirectory, it is stored as a relative path, otherwise as absolute.\n    # For the sake of security, we do not store relative paths from other\n    # directories, like home or cwd. After loading the widget from a schema,\n    # auto_save is set to off, unless the stored_path is relative (to the\n    # workflow).\n    stored_path = Setting(\"\")\n    stored_name = Setting(\"\", schema_only=True)  # File name, without path\n    auto_save = Setting(False)\n\n    filters = []\n\n    def __init__(self, start_row=0):\n        \"\"\"\n        Set up the gui.\n\n        The gui consists of a checkbox for auto save and two buttons put on a\n        grid layout. Derived widgets that want to place controls above the auto\n        save widget can set the `start_row` argument to the first free row,\n        and this constructor will start filling the grid there.\n\n        Args:\n            start_row (int): the row at which to start filling the gui\n        \"\"\"\n        super().__init__()\n        self.data = None\n        self._absolute_path = self._abs_path_from_setting()\n\n        # This cannot be done outside because `filters` is defined by subclass\n        if not self.filter:\n            self.filter = next(iter(self.get_filters()))\n\n        self.grid = grid = QGridLayout()\n        gui.widgetBox(self.controlArea, orientation=grid)\n        grid.addWidget(\n            gui.checkBox(\n                None, self, \"auto_save\", \"Autosave when receiving new data\",\n                callback=self.update_messages),\n            start_row, 0, 1, 2)\n        grid.setRowMinimumHeight(start_row + 1, 8)\n        self.bt_save = gui.button(\n            None, self,\n            label=f\"Save as {self.stored_name}\" if self.stored_name else \"Save\",\n            callback=self.save_file)\n        grid.addWidget(self.bt_save, start_row + 2, 0)\n        grid.addWidget(\n            gui.button(None, self, \"Save as ...\", callback=self.save_file_as),\n            start_row + 2, 1)\n\n        self.adjustSize()\n        self.update_messages()\n\n    @property\n    def last_dir(self):\n        # Not the best name, but kept for compatibility\n        return self._absolute_path\n\n    @last_dir.setter\n    def last_dir(self, absolute_path):\n        \"\"\"Store _absolute_path and update relative path (stored_path)\"\"\"\n        self._absolute_path = absolute_path\n\n        workflow_dir = self.workflowEnv().get(\"basedir\", None)\n        if workflow_dir and absolute_path.startswith(workflow_dir.rstrip(\"/\")):\n            self.stored_path = os.path.relpath(absolute_path, workflow_dir)\n        else:\n            self.stored_path = absolute_path\n\n    def _abs_path_from_setting(self):\n        \"\"\"\n        Compute absolute path from `stored_path` from settings.\n\n        Auto save is disabled unless stored_path is relative and exists.\n        \"\"\"\n        workflow_dir = self.workflowEnv().get(\"basedir\")\n        if os.path.isabs(self.stored_path):\n            path = self.stored_path\n            self.auto_save = False\n        elif workflow_dir:\n            path = os.path.join(workflow_dir, self.stored_path)\n        else:\n            path = None\n\n        if path and os.path.exists(path):\n            return path\n        else:\n            self.stored_path = workflow_dir or _userhome\n            self.auto_save = False\n            return self.stored_path\n\n    @property\n    def filename(self):\n        if self.stored_name:\n            return os.path.join(self._absolute_path, self.stored_name)\n        else:\n            return \"\"\n\n    @filename.setter\n    def filename(self, value):\n        self.last_dir, self.stored_name = os.path.split(value)\n\n    # pylint: disable=unused-argument\n    def workflowEnvChanged(self, key, value, oldvalue):\n        # Trigger refresh of relative path, e.g. when saving the scheme\n        if key == \"basedir\":\n            self.last_dir = self._absolute_path\n\n    @classmethod\n    def get_filters(cls):\n        return cls.filters\n\n    @property\n    def writer(self):\n        \"\"\"\n        Return the active writer\n\n        The base class uses this property only in `do_save` to find the writer\n        corresponding to the filter. Derived classes (e.g. OWSave) may also use\n        it elsewhere.\n        \"\"\"\n        return self.get_filters()[self.filter]\n\n    def on_new_input(self):\n        \"\"\"\n        This method must be called from input signal handler.\n\n        - It clears errors, warnings and information and calls\n          `self.update_messages` to set the as needed.\n        - It also calls `update_status` the can be overriden in derived\n          methods to set the status (e.g. the number of input rows)\n        - Calls `self.save_file` if `self.auto_save` is enabled and\n          `self.filename` is provided.\n        \"\"\"\n        self.Error.clear()\n        self.Warning.clear()\n        self.Information.clear()\n        self.update_messages()\n        self.update_status()\n        if self.auto_save and self.filename:\n            self.save_file()\n\n    def save_file_as(self):\n        \"\"\"\n        Ask the user for the filename and try saving the file\n        \"\"\"\n        filename, selected_filter = self.get_save_filename()\n        if not filename:\n            return\n        self.filename = filename\n        self.filter = selected_filter\n        self.bt_save.setText(f\"Save as {self.stored_name}\")\n        self.update_messages()\n        self._try_save()\n\n    def save_file(self):\n        \"\"\"\n        If file name is provided, try saving, else call save_file_as\n        \"\"\"\n        if not self.filename:\n            self.save_file_as()\n        else:\n            self._try_save()\n\n    def _try_save(self):\n        \"\"\"\n        Private method that calls do_save within try-except that catches and\n        shows IOError. Do nothing if not data or no file name.\n        \"\"\"\n        self.Error.general_error.clear()\n        if self.data is None or not self.filename:\n            return\n        try:\n            self.do_save()\n        except IOError as err_value:\n            self.Error.general_error(str(err_value))\n\n    def do_save(self):\n        \"\"\"\n        Do the saving.\n\n        Default implementation calls the write method of the writer\n        corresponding to the current filter. This requires that get_filters()\n        returns is a dictionary whose keys are classes.\n\n        Derived classes may simplify this by providing a list of filters and\n        override do_save. This is particularly handy if the widget supports only\n        a single format.\n        \"\"\"\n        # This method is separated out because it will usually be overriden\n        self.writer.write(self.filename, self.data)\n\n    def update_messages(self):\n        \"\"\"\n        Update errors, warnings and information.\n\n        Default method sets no_file_name if auto_save is enabled but file name\n        is not provided; and empty_input if file name is given but there is no\n        data.\n\n        Derived classes that define further messages will typically set them in\n        this method.\n        \"\"\"\n        self.Error.no_file_name(shown=not self.filename and self.auto_save)\n        self.Information.empty_input(shown=self.filename and self.data is None)\n\n    def update_status(self):\n        \"\"\"\n        Update the input/output indicator. Default method does nothing.\n        \"\"\"\n\n    def initial_start_dir(self):\n        \"\"\"\n        Provide initial start directory\n\n        Return either the current file's path, the last directory or home.\n        \"\"\"\n        if self.filename and os.path.exists(os.path.split(self.filename)[0]):\n            return self.filename\n        else:\n            return self.last_dir or _userhome\n\n    @staticmethod\n    def suggested_name():\n        \"\"\"\n        Suggest the name for the output file or return an empty string.\n        \"\"\"\n        return \"\"\n\n    @classmethod\n    def _replace_extension(cls, filename, extension):\n        \"\"\"\n        Remove all extensions that appear in any filter.\n\n        Double extensions are broken in different weird ways across all systems,\n        including omitting some, like turning iris.tab.gz to iris.gz. This\n        function removes anything that can appear anywhere.\n        \"\"\"\n        known_extensions = set()\n        for filt in cls.get_filters():\n            known_extensions |= set(cls._extension_from_filter(filt).split(\".\"))\n        if \"\" in known_extensions:\n            known_extensions.remove(\"\")\n        while True:\n            base, ext = os.path.splitext(filename)\n            if ext[1:] not in known_extensions:\n                break\n            filename = base\n        return filename + extension\n\n    @staticmethod\n    def _extension_from_filter(selected_filter):\n        return re.search(r\".*\\(\\*?(\\..*)\\)$\", selected_filter).group(1)\n\n    def valid_filters(self):\n        return self.get_filters()\n\n    def default_valid_filter(self):\n        return self.filter\n\n    @classmethod\n    def migrate_settings(cls, settings, version):\n        # We cannot use versions because they are overriden in derived classes\n        if \"last_dir\" in settings:\n            settings[\"stored_path\"] = settings.pop(\"last_dir\")\n        if \"filename\" in settings:\n            settings[\"stored_name\"] = os.path.split(\n                settings.pop(\"filename\") or \"\")[1]\n\n    # As of Qt 5.9, QFileDialog.setDefaultSuffix does not support double\n    # suffixes, not even in non-native dialogs. We handle each OS separately.\n    if sys.platform in (\"darwin\", \"win32\"):\n        # macOS and Windows native dialogs do not correctly handle double\n        # extensions. We thus don't pass any suffixes to the dialog and add\n        # the correct suffix after closing the dialog and only then check\n        # if the file exists and ask whether to override.\n        # It is a bit confusing that the user does not see the final name in the\n        # dialog, but I see no better solution.\n        def get_save_filename(self):  # pragma: no cover\n            if sys.platform == \"darwin\":\n                def remove_star(filt):\n                    return filt.replace(\" (*.\", \" (.\")\n            else:\n                def remove_star(filt):\n                    return filt\n\n            no_ext_filters = {remove_star(f): f for f in self.valid_filters()}\n            filename = self.initial_start_dir()\n            while True:\n                dlg = QFileDialog(\n                    None, \"Save File\", filename, \";;\".join(no_ext_filters))\n                dlg.setAcceptMode(dlg.AcceptSave)\n                dlg.selectNameFilter(remove_star(self.default_valid_filter()))\n                dlg.setOption(QFileDialog.DontConfirmOverwrite)\n                if dlg.exec() == QFileDialog.Rejected:\n                    return \"\", \"\"\n                filename = dlg.selectedFiles()[0]\n                selected_filter = no_ext_filters[dlg.selectedNameFilter()]\n                filename = self._replace_extension(\n                    filename, self._extension_from_filter(selected_filter))\n                if not os.path.exists(filename) or QMessageBox.question(\n                        self, \"Overwrite file?\",\n                        f\"File {os.path.split(filename)[1]} already exists.\\n\"\n                        \"Overwrite?\") == QMessageBox.Yes:\n                    return filename, selected_filter\n\n    else:  # Linux and any unknown platforms\n        # Qt does not use a native dialog on Linux, so we can connect to\n        # filterSelected and to overload selectFile to change the extension\n        # while the dialog is open.\n        # For unknown platforms (which?), we also use the non-native dialog to\n        # be sure we know what happens.\n        class SaveFileDialog(QFileDialog):\n            # pylint: disable=protected-access\n            def __init__(self, save_cls, *args, **kwargs):\n                super().__init__(*args, **kwargs)\n                self.save_cls = save_cls\n                self.suffix = \"\"\n                self.setAcceptMode(QFileDialog.AcceptSave)\n                self.setOption(QFileDialog.DontUseNativeDialog)\n                self.filterSelected.connect(self.updateDefaultExtension)\n\n            def selectNameFilter(self, selected_filter):\n                super().selectNameFilter(selected_filter)\n                self.updateDefaultExtension(selected_filter)\n\n            def updateDefaultExtension(self, selected_filter):\n                self.suffix = \\\n                    self.save_cls._extension_from_filter(selected_filter)\n                files = self.selectedFiles()\n                if files and not os.path.isdir(files[0]):\n                    self.selectFile(files[0])\n\n            def selectFile(self, filename):\n                filename = \\\n                    self.save_cls._replace_extension(filename, self.suffix)\n                super().selectFile(filename)\n\n        def get_save_filename(self):\n            dlg = self.SaveFileDialog(\n                type(self),\n                None, \"Save File\", self.initial_start_dir(),\n                \";;\".join(self.valid_filters()))\n            dlg.selectNameFilter(self.default_valid_filter())\n            if dlg.exec() == QFileDialog.Rejected:\n                return \"\", \"\"\n            else:\n                return dlg.selectedFiles()[0], dlg.selectedNameFilter()",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 121,
                            "end_lineno": 141,
                            "parent": {
                                "file_name": "Orange/widgets/utils/save/owsavebase.py",
                                "type": "class",
                                "name": "OWSaveBase",
                                "content": "class OWSaveBase(widget.OWWidget, openclass=True):\n    \"\"\"\n    Base class for Save widgets\n\n    A derived class must provide, at minimum:\n\n    - class `Inputs` and the corresponding handler that:\n\n      - saves the input to an attribute `data`, and\n      - calls `self.on_new_input`.\n\n    - a class attribute `filters` with a list of filters or a dictionary whose\n      keys are filters OR a class method `get_filters` that returns such a\n      list or dictionary\n    - method `do_save` that saves `self.data` into `self.filename`\n\n    Alternatively, instead of defining `do_save` a derived class can make\n    `filters` a dictionary whose keys are classes that define a method `write`\n    (like e.g. `TabReader`). Method `do_save` defined in the base class calls\n    the writer corresponding to the currently chosen filter.\n\n    A minimum example of derived class is\n    `Orange.widgets.model.owsavemodel.OWSaveModel`.\n    A more advanced widget that overrides a lot of base class behaviour is\n    `Orange.widgets.data.owsave.OWSave`.\n    \"\"\"\n\n    class Information(widget.OWWidget.Information):\n        empty_input = widget.Msg(\"Empty input; nothing was saved.\")\n\n    class Error(widget.OWWidget.Error):\n        no_file_name = widget.Msg(\"File name is not set.\")\n        general_error = widget.Msg(\"{}\")\n\n    want_main_area = False\n    resizing_enabled = False\n\n    filter = Setting(\"\")  # Default is provided in __init__\n\n    # If the path is in the same directory as the workflow file or its\n    # subdirectory, it is stored as a relative path, otherwise as absolute.\n    # For the sake of security, we do not store relative paths from other\n    # directories, like home or cwd. After loading the widget from a schema,\n    # auto_save is set to off, unless the stored_path is relative (to the\n    # workflow).\n    stored_path = Setting(\"\")\n    stored_name = Setting(\"\", schema_only=True)  # File name, without path\n    auto_save = Setting(False)\n\n    filters = []\n\n    def __init__(self, start_row=0):\n        \"\"\"\n        Set up the gui.\n\n        The gui consists of a checkbox for auto save and two buttons put on a\n        grid layout. Derived widgets that want to place controls above the auto\n        save widget can set the `start_row` argument to the first free row,\n        and this constructor will start filling the grid there.\n\n        Args:\n            start_row (int): the row at which to start filling the gui\n        \"\"\"\n        super().__init__()\n        self.data = None\n        self._absolute_path = self._abs_path_from_setting()\n\n        # This cannot be done outside because `filters` is defined by subclass\n        if not self.filter:\n            self.filter = next(iter(self.get_filters()))\n\n        self.grid = grid = QGridLayout()\n        gui.widgetBox(self.controlArea, orientation=grid)\n        grid.addWidget(\n            gui.checkBox(\n                None, self, \"auto_save\", \"Autosave when receiving new data\",\n                callback=self.update_messages),\n            start_row, 0, 1, 2)\n        grid.setRowMinimumHeight(start_row + 1, 8)\n        self.bt_save = gui.button(\n            None, self,\n            label=f\"Save as {self.stored_name}\" if self.stored_name else \"Save\",\n            callback=self.save_file)\n        grid.addWidget(self.bt_save, start_row + 2, 0)\n        grid.addWidget(\n            gui.button(None, self, \"Save as ...\", callback=self.save_file_as),\n            start_row + 2, 1)\n\n        self.adjustSize()\n        self.update_messages()\n\n    @property\n    def last_dir(self):\n        # Not the best name, but kept for compatibility\n        return self._absolute_path\n\n    @last_dir.setter\n    def last_dir(self, absolute_path):\n        \"\"\"Store _absolute_path and update relative path (stored_path)\"\"\"\n        self._absolute_path = absolute_path\n\n        workflow_dir = self.workflowEnv().get(\"basedir\", None)\n        if workflow_dir and absolute_path.startswith(workflow_dir.rstrip(\"/\")):\n            self.stored_path = os.path.relpath(absolute_path, workflow_dir)\n        else:\n            self.stored_path = absolute_path\n\n    def _abs_path_from_setting(self):\n        \"\"\"\n        Compute absolute path from `stored_path` from settings.\n\n        Auto save is disabled unless stored_path is relative and exists.\n        \"\"\"\n        workflow_dir = self.workflowEnv().get(\"basedir\")\n        if os.path.isabs(self.stored_path):\n            path = self.stored_path\n            self.auto_save = False\n        elif workflow_dir:\n            path = os.path.join(workflow_dir, self.stored_path)\n        else:\n            path = None\n\n        if path and os.path.exists(path):\n            return path\n        else:\n            self.stored_path = workflow_dir or _userhome\n            self.auto_save = False\n            return self.stored_path\n\n    @property\n    def filename(self):\n        if self.stored_name:\n            return os.path.join(self._absolute_path, self.stored_name)\n        else:\n            return \"\"\n\n    @filename.setter\n    def filename(self, value):\n        self.last_dir, self.stored_name = os.path.split(value)\n\n    # pylint: disable=unused-argument\n    def workflowEnvChanged(self, key, value, oldvalue):\n        # Trigger refresh of relative path, e.g. when saving the scheme\n        if key == \"basedir\":\n            self.last_dir = self._absolute_path\n\n    @classmethod\n    def get_filters(cls):\n        return cls.filters\n\n    @property\n    def writer(self):\n        \"\"\"\n        Return the active writer\n\n        The base class uses this property only in `do_save` to find the writer\n        corresponding to the filter. Derived classes (e.g. OWSave) may also use\n        it elsewhere.\n        \"\"\"\n        return self.get_filters()[self.filter]\n\n    def on_new_input(self):\n        \"\"\"\n        This method must be called from input signal handler.\n\n        - It clears errors, warnings and information and calls\n          `self.update_messages` to set the as needed.\n        - It also calls `update_status` the can be overriden in derived\n          methods to set the status (e.g. the number of input rows)\n        - Calls `self.save_file` if `self.auto_save` is enabled and\n          `self.filename` is provided.\n        \"\"\"\n        self.Error.clear()\n        self.Warning.clear()\n        self.Information.clear()\n        self.update_messages()\n        self.update_status()\n        if self.auto_save and self.filename:\n            self.save_file()\n\n    def save_file_as(self):\n        \"\"\"\n        Ask the user for the filename and try saving the file\n        \"\"\"\n        filename, selected_filter = self.get_save_filename()\n        if not filename:\n            return\n        self.filename = filename\n        self.filter = selected_filter\n        self.bt_save.setText(f\"Save as {self.stored_name}\")\n        self.update_messages()\n        self._try_save()\n\n    def save_file(self):\n        \"\"\"\n        If file name is provided, try saving, else call save_file_as\n        \"\"\"\n        if not self.filename:\n            self.save_file_as()\n        else:\n            self._try_save()\n\n    def _try_save(self):\n        \"\"\"\n        Private method that calls do_save within try-except that catches and\n        shows IOError. Do nothing if not data or no file name.\n        \"\"\"\n        self.Error.general_error.clear()\n        if self.data is None or not self.filename:\n            return\n        try:\n            self.do_save()\n        except IOError as err_value:\n            self.Error.general_error(str(err_value))\n\n    def do_save(self):\n        \"\"\"\n        Do the saving.\n\n        Default implementation calls the write method of the writer\n        corresponding to the current filter. This requires that get_filters()\n        returns is a dictionary whose keys are classes.\n\n        Derived classes may simplify this by providing a list of filters and\n        override do_save. This is particularly handy if the widget supports only\n        a single format.\n        \"\"\"\n        # This method is separated out because it will usually be overriden\n        self.writer.write(self.filename, self.data)\n\n    def update_messages(self):\n        \"\"\"\n        Update errors, warnings and information.\n\n        Default method sets no_file_name if auto_save is enabled but file name\n        is not provided; and empty_input if file name is given but there is no\n        data.\n\n        Derived classes that define further messages will typically set them in\n        this method.\n        \"\"\"\n        self.Error.no_file_name(shown=not self.filename and self.auto_save)\n        self.Information.empty_input(shown=self.filename and self.data is None)\n\n    def update_status(self):\n        \"\"\"\n        Update the input/output indicator. Default method does nothing.\n        \"\"\"\n\n    def initial_start_dir(self):\n        \"\"\"\n        Provide initial start directory\n\n        Return either the current file's path, the last directory or home.\n        \"\"\"\n        if self.filename and os.path.exists(os.path.split(self.filename)[0]):\n            return self.filename\n        else:\n            return self.last_dir or _userhome\n\n    @staticmethod\n    def suggested_name():\n        \"\"\"\n        Suggest the name for the output file or return an empty string.\n        \"\"\"\n        return \"\"\n\n    @classmethod\n    def _replace_extension(cls, filename, extension):\n        \"\"\"\n        Remove all extensions that appear in any filter.\n\n        Double extensions are broken in different weird ways across all systems,\n        including omitting some, like turning iris.tab.gz to iris.gz. This\n        function removes anything that can appear anywhere.\n        \"\"\"\n        known_extensions = set()\n        for filt in cls.get_filters():\n            known_extensions |= set(cls._extension_from_filter(filt).split(\".\"))\n        if \"\" in known_extensions:\n            known_extensions.remove(\"\")\n        while True:\n            base, ext = os.path.splitext(filename)\n            if ext[1:] not in known_extensions:\n                break\n            filename = base\n        return filename + extension\n\n    @staticmethod\n    def _extension_from_filter(selected_filter):\n        return re.search(r\".*\\(\\*?(\\..*)\\)$\", selected_filter).group(1)\n\n    def valid_filters(self):\n        return self.get_filters()\n\n    def default_valid_filter(self):\n        return self.filter\n\n    @classmethod\n    def migrate_settings(cls, settings, version):\n        # We cannot use versions because they are overriden in derived classes\n        if \"last_dir\" in settings:\n            settings[\"stored_path\"] = settings.pop(\"last_dir\")\n        if \"filename\" in settings:\n            settings[\"stored_name\"] = os.path.split(\n                settings.pop(\"filename\") or \"\")[1]\n\n    # As of Qt 5.9, QFileDialog.setDefaultSuffix does not support double\n    # suffixes, not even in non-native dialogs. We handle each OS separately.\n    if sys.platform in (\"darwin\", \"win32\"):\n        # macOS and Windows native dialogs do not correctly handle double\n        # extensions. We thus don't pass any suffixes to the dialog and add\n        # the correct suffix after closing the dialog and only then check\n        # if the file exists and ask whether to override.\n        # It is a bit confusing that the user does not see the final name in the\n        # dialog, but I see no better solution.\n        def get_save_filename(self):  # pragma: no cover\n            if sys.platform == \"darwin\":\n                def remove_star(filt):\n                    return filt.replace(\" (*.\", \" (.\")\n            else:\n                def remove_star(filt):\n                    return filt\n\n            no_ext_filters = {remove_star(f): f for f in self.valid_filters()}\n            filename = self.initial_start_dir()\n            while True:\n                dlg = QFileDialog(\n                    None, \"Save File\", filename, \";;\".join(no_ext_filters))\n                dlg.setAcceptMode(dlg.AcceptSave)\n                dlg.selectNameFilter(remove_star(self.default_valid_filter()))\n                dlg.setOption(QFileDialog.DontConfirmOverwrite)\n                if dlg.exec() == QFileDialog.Rejected:\n                    return \"\", \"\"\n                filename = dlg.selectedFiles()[0]\n                selected_filter = no_ext_filters[dlg.selectedNameFilter()]\n                filename = self._replace_extension(\n                    filename, self._extension_from_filter(selected_filter))\n                if not os.path.exists(filename) or QMessageBox.question(\n                        self, \"Overwrite file?\",\n                        f\"File {os.path.split(filename)[1]} already exists.\\n\"\n                        \"Overwrite?\") == QMessageBox.Yes:\n                    return filename, selected_filter\n\n    else:  # Linux and any unknown platforms\n        # Qt does not use a native dialog on Linux, so we can connect to\n        # filterSelected and to overload selectFile to change the extension\n        # while the dialog is open.\n        # For unknown platforms (which?), we also use the non-native dialog to\n        # be sure we know what happens.\n        class SaveFileDialog(QFileDialog):\n            # pylint: disable=protected-access\n            def __init__(self, save_cls, *args, **kwargs):\n                super().__init__(*args, **kwargs)\n                self.save_cls = save_cls\n                self.suffix = \"\"\n                self.setAcceptMode(QFileDialog.AcceptSave)\n                self.setOption(QFileDialog.DontUseNativeDialog)\n                self.filterSelected.connect(self.updateDefaultExtension)\n\n            def selectNameFilter(self, selected_filter):\n                super().selectNameFilter(selected_filter)\n                self.updateDefaultExtension(selected_filter)\n\n            def updateDefaultExtension(self, selected_filter):\n                self.suffix = \\\n                    self.save_cls._extension_from_filter(selected_filter)\n                files = self.selectedFiles()\n                if files and not os.path.isdir(files[0]):\n                    self.selectFile(files[0])\n\n            def selectFile(self, filename):\n                filename = \\\n                    self.save_cls._replace_extension(filename, self.suffix)\n                super().selectFile(filename)\n\n        def get_save_filename(self):\n            dlg = self.SaveFileDialog(\n                type(self),\n                None, \"Save File\", self.initial_start_dir(),\n                \";;\".join(self.valid_filters()))\n            dlg.selectNameFilter(self.default_valid_filter())\n            if dlg.exec() == QFileDialog.Rejected:\n                return \"\", \"\"\n            else:\n                return dlg.selectedFiles()[0], dlg.selectedNameFilter()",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 14,
                                "end_lineno": 399,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/utils/save/owsavebase.py",
                            "type": "class",
                            "name": "OWSaveBase",
                            "content": "class OWSaveBase(widget.OWWidget, openclass=True):\n    \"\"\"\n    Base class for Save widgets\n\n    A derived class must provide, at minimum:\n\n    - class `Inputs` and the corresponding handler that:\n\n      - saves the input to an attribute `data`, and\n      - calls `self.on_new_input`.\n\n    - a class attribute `filters` with a list of filters or a dictionary whose\n      keys are filters OR a class method `get_filters` that returns such a\n      list or dictionary\n    - method `do_save` that saves `self.data` into `self.filename`\n\n    Alternatively, instead of defining `do_save` a derived class can make\n    `filters` a dictionary whose keys are classes that define a method `write`\n    (like e.g. `TabReader`). Method `do_save` defined in the base class calls\n    the writer corresponding to the currently chosen filter.\n\n    A minimum example of derived class is\n    `Orange.widgets.model.owsavemodel.OWSaveModel`.\n    A more advanced widget that overrides a lot of base class behaviour is\n    `Orange.widgets.data.owsave.OWSave`.\n    \"\"\"\n\n    class Information(widget.OWWidget.Information):\n        empty_input = widget.Msg(\"Empty input; nothing was saved.\")\n\n    class Error(widget.OWWidget.Error):\n        no_file_name = widget.Msg(\"File name is not set.\")\n        general_error = widget.Msg(\"{}\")\n\n    want_main_area = False\n    resizing_enabled = False\n\n    filter = Setting(\"\")  # Default is provided in __init__\n\n    # If the path is in the same directory as the workflow file or its\n    # subdirectory, it is stored as a relative path, otherwise as absolute.\n    # For the sake of security, we do not store relative paths from other\n    # directories, like home or cwd. After loading the widget from a schema,\n    # auto_save is set to off, unless the stored_path is relative (to the\n    # workflow).\n    stored_path = Setting(\"\")\n    stored_name = Setting(\"\", schema_only=True)  # File name, without path\n    auto_save = Setting(False)\n\n    filters = []\n\n    def __init__(self, start_row=0):\n        \"\"\"\n        Set up the gui.\n\n        The gui consists of a checkbox for auto save and two buttons put on a\n        grid layout. Derived widgets that want to place controls above the auto\n        save widget can set the `start_row` argument to the first free row,\n        and this constructor will start filling the grid there.\n\n        Args:\n            start_row (int): the row at which to start filling the gui\n        \"\"\"\n        super().__init__()\n        self.data = None\n        self._absolute_path = self._abs_path_from_setting()\n\n        # This cannot be done outside because `filters` is defined by subclass\n        if not self.filter:\n            self.filter = next(iter(self.get_filters()))\n\n        self.grid = grid = QGridLayout()\n        gui.widgetBox(self.controlArea, orientation=grid)\n        grid.addWidget(\n            gui.checkBox(\n                None, self, \"auto_save\", \"Autosave when receiving new data\",\n                callback=self.update_messages),\n            start_row, 0, 1, 2)\n        grid.setRowMinimumHeight(start_row + 1, 8)\n        self.bt_save = gui.button(\n            None, self,\n            label=f\"Save as {self.stored_name}\" if self.stored_name else \"Save\",\n            callback=self.save_file)\n        grid.addWidget(self.bt_save, start_row + 2, 0)\n        grid.addWidget(\n            gui.button(None, self, \"Save as ...\", callback=self.save_file_as),\n            start_row + 2, 1)\n\n        self.adjustSize()\n        self.update_messages()\n\n    @property\n    def last_dir(self):\n        # Not the best name, but kept for compatibility\n        return self._absolute_path\n\n    @last_dir.setter\n    def last_dir(self, absolute_path):\n        \"\"\"Store _absolute_path and update relative path (stored_path)\"\"\"\n        self._absolute_path = absolute_path\n\n        workflow_dir = self.workflowEnv().get(\"basedir\", None)\n        if workflow_dir and absolute_path.startswith(workflow_dir.rstrip(\"/\")):\n            self.stored_path = os.path.relpath(absolute_path, workflow_dir)\n        else:\n            self.stored_path = absolute_path\n\n    def _abs_path_from_setting(self):\n        \"\"\"\n        Compute absolute path from `stored_path` from settings.\n\n        Auto save is disabled unless stored_path is relative and exists.\n        \"\"\"\n        workflow_dir = self.workflowEnv().get(\"basedir\")\n        if os.path.isabs(self.stored_path):\n            path = self.stored_path\n            self.auto_save = False\n        elif workflow_dir:\n            path = os.path.join(workflow_dir, self.stored_path)\n        else:\n            path = None\n\n        if path and os.path.exists(path):\n            return path\n        else:\n            self.stored_path = workflow_dir or _userhome\n            self.auto_save = False\n            return self.stored_path\n\n    @property\n    def filename(self):\n        if self.stored_name:\n            return os.path.join(self._absolute_path, self.stored_name)\n        else:\n            return \"\"\n\n    @filename.setter\n    def filename(self, value):\n        self.last_dir, self.stored_name = os.path.split(value)\n\n    # pylint: disable=unused-argument\n    def workflowEnvChanged(self, key, value, oldvalue):\n        # Trigger refresh of relative path, e.g. when saving the scheme\n        if key == \"basedir\":\n            self.last_dir = self._absolute_path\n\n    @classmethod\n    def get_filters(cls):\n        return cls.filters\n\n    @property\n    def writer(self):\n        \"\"\"\n        Return the active writer\n\n        The base class uses this property only in `do_save` to find the writer\n        corresponding to the filter. Derived classes (e.g. OWSave) may also use\n        it elsewhere.\n        \"\"\"\n        return self.get_filters()[self.filter]\n\n    def on_new_input(self):\n        \"\"\"\n        This method must be called from input signal handler.\n\n        - It clears errors, warnings and information and calls\n          `self.update_messages` to set the as needed.\n        - It also calls `update_status` the can be overriden in derived\n          methods to set the status (e.g. the number of input rows)\n        - Calls `self.save_file` if `self.auto_save` is enabled and\n          `self.filename` is provided.\n        \"\"\"\n        self.Error.clear()\n        self.Warning.clear()\n        self.Information.clear()\n        self.update_messages()\n        self.update_status()\n        if self.auto_save and self.filename:\n            self.save_file()\n\n    def save_file_as(self):\n        \"\"\"\n        Ask the user for the filename and try saving the file\n        \"\"\"\n        filename, selected_filter = self.get_save_filename()\n        if not filename:\n            return\n        self.filename = filename\n        self.filter = selected_filter\n        self.bt_save.setText(f\"Save as {self.stored_name}\")\n        self.update_messages()\n        self._try_save()\n\n    def save_file(self):\n        \"\"\"\n        If file name is provided, try saving, else call save_file_as\n        \"\"\"\n        if not self.filename:\n            self.save_file_as()\n        else:\n            self._try_save()\n\n    def _try_save(self):\n        \"\"\"\n        Private method that calls do_save within try-except that catches and\n        shows IOError. Do nothing if not data or no file name.\n        \"\"\"\n        self.Error.general_error.clear()\n        if self.data is None or not self.filename:\n            return\n        try:\n            self.do_save()\n        except IOError as err_value:\n            self.Error.general_error(str(err_value))\n\n    def do_save(self):\n        \"\"\"\n        Do the saving.\n\n        Default implementation calls the write method of the writer\n        corresponding to the current filter. This requires that get_filters()\n        returns is a dictionary whose keys are classes.\n\n        Derived classes may simplify this by providing a list of filters and\n        override do_save. This is particularly handy if the widget supports only\n        a single format.\n        \"\"\"\n        # This method is separated out because it will usually be overriden\n        self.writer.write(self.filename, self.data)\n\n    def update_messages(self):\n        \"\"\"\n        Update errors, warnings and information.\n\n        Default method sets no_file_name if auto_save is enabled but file name\n        is not provided; and empty_input if file name is given but there is no\n        data.\n\n        Derived classes that define further messages will typically set them in\n        this method.\n        \"\"\"\n        self.Error.no_file_name(shown=not self.filename and self.auto_save)\n        self.Information.empty_input(shown=self.filename and self.data is None)\n\n    def update_status(self):\n        \"\"\"\n        Update the input/output indicator. Default method does nothing.\n        \"\"\"\n\n    def initial_start_dir(self):\n        \"\"\"\n        Provide initial start directory\n\n        Return either the current file's path, the last directory or home.\n        \"\"\"\n        if self.filename and os.path.exists(os.path.split(self.filename)[0]):\n            return self.filename\n        else:\n            return self.last_dir or _userhome\n\n    @staticmethod\n    def suggested_name():\n        \"\"\"\n        Suggest the name for the output file or return an empty string.\n        \"\"\"\n        return \"\"\n\n    @classmethod\n    def _replace_extension(cls, filename, extension):\n        \"\"\"\n        Remove all extensions that appear in any filter.\n\n        Double extensions are broken in different weird ways across all systems,\n        including omitting some, like turning iris.tab.gz to iris.gz. This\n        function removes anything that can appear anywhere.\n        \"\"\"\n        known_extensions = set()\n        for filt in cls.get_filters():\n            known_extensions |= set(cls._extension_from_filter(filt).split(\".\"))\n        if \"\" in known_extensions:\n            known_extensions.remove(\"\")\n        while True:\n            base, ext = os.path.splitext(filename)\n            if ext[1:] not in known_extensions:\n                break\n            filename = base\n        return filename + extension\n\n    @staticmethod\n    def _extension_from_filter(selected_filter):\n        return re.search(r\".*\\(\\*?(\\..*)\\)$\", selected_filter).group(1)\n\n    def valid_filters(self):\n        return self.get_filters()\n\n    def default_valid_filter(self):\n        return self.filter\n\n    @classmethod\n    def migrate_settings(cls, settings, version):\n        # We cannot use versions because they are overriden in derived classes\n        if \"last_dir\" in settings:\n            settings[\"stored_path\"] = settings.pop(\"last_dir\")\n        if \"filename\" in settings:\n            settings[\"stored_name\"] = os.path.split(\n                settings.pop(\"filename\") or \"\")[1]\n\n    # As of Qt 5.9, QFileDialog.setDefaultSuffix does not support double\n    # suffixes, not even in non-native dialogs. We handle each OS separately.\n    if sys.platform in (\"darwin\", \"win32\"):\n        # macOS and Windows native dialogs do not correctly handle double\n        # extensions. We thus don't pass any suffixes to the dialog and add\n        # the correct suffix after closing the dialog and only then check\n        # if the file exists and ask whether to override.\n        # It is a bit confusing that the user does not see the final name in the\n        # dialog, but I see no better solution.\n        def get_save_filename(self):  # pragma: no cover\n            if sys.platform == \"darwin\":\n                def remove_star(filt):\n                    return filt.replace(\" (*.\", \" (.\")\n            else:\n                def remove_star(filt):\n                    return filt\n\n            no_ext_filters = {remove_star(f): f for f in self.valid_filters()}\n            filename = self.initial_start_dir()\n            while True:\n                dlg = QFileDialog(\n                    None, \"Save File\", filename, \";;\".join(no_ext_filters))\n                dlg.setAcceptMode(dlg.AcceptSave)\n                dlg.selectNameFilter(remove_star(self.default_valid_filter()))\n                dlg.setOption(QFileDialog.DontConfirmOverwrite)\n                if dlg.exec() == QFileDialog.Rejected:\n                    return \"\", \"\"\n                filename = dlg.selectedFiles()[0]\n                selected_filter = no_ext_filters[dlg.selectedNameFilter()]\n                filename = self._replace_extension(\n                    filename, self._extension_from_filter(selected_filter))\n                if not os.path.exists(filename) or QMessageBox.question(\n                        self, \"Overwrite file?\",\n                        f\"File {os.path.split(filename)[1]} already exists.\\n\"\n                        \"Overwrite?\") == QMessageBox.Yes:\n                    return filename, selected_filter\n\n    else:  # Linux and any unknown platforms\n        # Qt does not use a native dialog on Linux, so we can connect to\n        # filterSelected and to overload selectFile to change the extension\n        # while the dialog is open.\n        # For unknown platforms (which?), we also use the non-native dialog to\n        # be sure we know what happens.\n        class SaveFileDialog(QFileDialog):\n            # pylint: disable=protected-access\n            def __init__(self, save_cls, *args, **kwargs):\n                super().__init__(*args, **kwargs)\n                self.save_cls = save_cls\n                self.suffix = \"\"\n                self.setAcceptMode(QFileDialog.AcceptSave)\n                self.setOption(QFileDialog.DontUseNativeDialog)\n                self.filterSelected.connect(self.updateDefaultExtension)\n\n            def selectNameFilter(self, selected_filter):\n                super().selectNameFilter(selected_filter)\n                self.updateDefaultExtension(selected_filter)\n\n            def updateDefaultExtension(self, selected_filter):\n                self.suffix = \\\n                    self.save_cls._extension_from_filter(selected_filter)\n                files = self.selectedFiles()\n                if files and not os.path.isdir(files[0]):\n                    self.selectFile(files[0])\n\n            def selectFile(self, filename):\n                filename = \\\n                    self.save_cls._replace_extension(filename, self.suffix)\n                super().selectFile(filename)\n\n        def get_save_filename(self):\n            dlg = self.SaveFileDialog(\n                type(self),\n                None, \"Save File\", self.initial_start_dir(),\n                \";;\".join(self.valid_filters()))\n            dlg.selectNameFilter(self.default_valid_filter())\n            if dlg.exec() == QFileDialog.Rejected:\n                return \"\", \"\"\n            else:\n                return dlg.selectedFiles()[0], dlg.selectedNameFilter()",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 14,
                            "end_lineno": 399,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        },
        {
            "old_file_content": "# Proper tests of OWSaveBase would require too much mocking, so we test most\n# OWSaveBase's methods within the test for OWSave widget.\n# The test for pure OWSaveBase just check a few methods that do not require\n# extensive mocking\n\n# pylint: disable=missing-docstring, protected-access, unsubscriptable-object\nimport unittest\nfrom unittest.mock import Mock, patch\nimport sys\nimport os\nimport collections\n\nfrom orangewidget.widget import Input\nfrom Orange.widgets.tests.base import WidgetTest\nfrom Orange.widgets.utils import getmembers\nfrom Orange.widgets.utils.save.owsavebase import OWSaveBase, _userhome\n\n\nclass SaveWidgetsTestBaseMixin:\n    def test_input_handler(self):\n        widget = self.widget\n        if not widget:\n            return\n        widget.on_new_input = Mock()\n\n        inputs = getmembers(widget.Inputs, Input)\n        self.assertGreaterEqual(len(inputs), 1, msg=\"Widget defines no inputs\")\n        if len(inputs) > 1:\n            self.skipTest(\n                \"widget has multiple inputs; input handler can't be tested\")\n            return\n\n        handler = getattr(widget, inputs[0][1].handler)\n        data = Mock()\n        handler(data)\n        self.assertIs(widget.data, data)\n        widget.on_new_input.assert_called()\n\n    def test_filters(self):\n        filters = self.widget.get_filters()\n        self.assertGreaterEqual(len(filters), 1,\n                                msg=\"Widget defines no filters\")\n        if type(self.widget).do_save is OWSaveBase.do_save:\n            self.assertIsInstance(filters, collections.abc.Mapping)\n\n\nclass TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\", lambda name: name == \"/home/u/orange/a/b\")\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))\n\n\nclass TestOWSaveBase(WidgetTest):\n    # Tests for OWSaveBase methods with filters as list\n    def setUp(self):\n        class OWSaveMockWriter(OWSaveBase):\n            name = \"Mock save\"\n            filters = [\"csv (*.csv)\"]\n\n            do_save = Mock()\n\n        self.widget = self.create_widget(OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        widget.do_save.assert_not_called()\n\n        widget.filename = \"\"\n        widget.data = Mock()\n        widget.save_file()\n        widget.do_save.assert_not_called()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        widget.do_save.assert_called()\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n\nclass TestOWSaveUtils(unittest.TestCase):\n    def test_replace_extension(self):\n        class OWMockSaveBase(OWSaveBase):\n            filters = [\"Tab delimited (*.tab)\",\n                       \"Compressed tab delimited (*.gz.tab)\",\n                       \"Comma separated (*.csv)\",\n                       \"Compressed comma separated (*.csv.gz)\",\n                       \"Excel File (*.xlsx)\"]\n\n        replace = OWMockSaveBase._replace_extension\n        fname = \"/bing.bada.boom/foo.1942.tab\"\n        self.assertEqual(\n            replace(fname, \".tab\"), \"/bing.bada.boom/foo.1942.tab\")\n        self.assertEqual(\n            replace(fname, \".tab.gz\"), \"/bing.bada.boom/foo.1942.tab.gz\")\n        self.assertEqual(\n            replace(fname, \".xlsx\"), \"/bing.bada.boom/foo.1942.xlsx\")\n\n        fname = \"foo.tab.gz\"\n        self.assertEqual(replace(fname, \".tab\"), \"foo.tab\")\n        self.assertEqual(replace(fname, \".tab.gz\"), \"foo.tab.gz\")\n        self.assertEqual(replace(fname, \".csv\"), \"foo.csv\")\n        self.assertEqual(replace(fname, \".csv.gz\"), \"foo.csv.gz\")\n\n        fname = \"/bing.bada.boom/foo\"\n        self.assertEqual(replace(fname, \".tab\"), fname + \".tab\")\n        self.assertEqual(replace(fname, \".tab.gz\"), fname + \".tab.gz\")\n\n    def test_extension_from_filter(self):\n        eff = OWSaveBase._extension_from_filter\n        self.assertEqual(eff(\"Description (*.ext)\"), \".ext\")\n        self.assertEqual(eff(\"Description (*.foo.ba)\"), \".foo.ba\")\n        self.assertEqual(eff(\"Description (.ext)\"), \".ext\")\n        self.assertEqual(eff(\"Description (.foo.bar)\"), \".foo.bar\")\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "new_file_content": "# Proper tests of OWSaveBase would require too much mocking, so we test most\n# OWSaveBase's methods within the test for OWSave widget.\n# The test for pure OWSaveBase just check a few methods that do not require\n# extensive mocking\n\n# pylint: disable=missing-docstring, protected-access, unsubscriptable-object\nimport unittest\nfrom unittest.mock import Mock, patch\nimport sys\nimport os\nimport collections\n\nfrom orangewidget.widget import Input\nfrom Orange.widgets.tests.base import WidgetTest\nfrom Orange.widgets.utils import getmembers\nfrom Orange.widgets.utils.save.owsavebase import OWSaveBase, _userhome\n\n\nclass SaveWidgetsTestBaseMixin:\n    def test_input_handler(self):\n        widget = self.widget\n        if not widget:\n            return\n        widget.on_new_input = Mock()\n\n        inputs = getmembers(widget.Inputs, Input)\n        self.assertGreaterEqual(len(inputs), 1, msg=\"Widget defines no inputs\")\n        if len(inputs) > 1:\n            self.skipTest(\n                \"widget has multiple inputs; input handler can't be tested\")\n            return\n\n        handler = getattr(widget, inputs[0][1].handler)\n        data = Mock()\n        handler(data)\n        self.assertIs(widget.data, data)\n        widget.on_new_input.assert_called()\n\n    def test_filters(self):\n        filters = self.widget.get_filters()\n        self.assertGreaterEqual(len(filters), 1,\n                                msg=\"Widget defines no filters\")\n        if type(self.widget).do_save is OWSaveBase.do_save:\n            self.assertIsInstance(filters, collections.abc.Mapping)\n\n\nclass TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\",\n           lambda name: name in [\"/home/u/orange/a/b\", \"/foo/bar\"])\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/foo/bar\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/foo/bar\")\n            self.assertPathEqual(w.filename, \"/foo/bar/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/d\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/d/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertTrue(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))\n\n\nclass TestOWSaveBase(WidgetTest):\n    # Tests for OWSaveBase methods with filters as list\n    def setUp(self):\n        class OWSaveMockWriter(OWSaveBase):\n            name = \"Mock save\"\n            filters = [\"csv (*.csv)\"]\n\n            do_save = Mock()\n\n        self.widget = self.create_widget(OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        widget.do_save.assert_not_called()\n\n        widget.filename = \"\"\n        widget.data = Mock()\n        widget.save_file()\n        widget.do_save.assert_not_called()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        widget.do_save.assert_called()\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n\nclass TestOWSaveUtils(unittest.TestCase):\n    def test_replace_extension(self):\n        class OWMockSaveBase(OWSaveBase):\n            filters = [\"Tab delimited (*.tab)\",\n                       \"Compressed tab delimited (*.gz.tab)\",\n                       \"Comma separated (*.csv)\",\n                       \"Compressed comma separated (*.csv.gz)\",\n                       \"Excel File (*.xlsx)\"]\n\n        replace = OWMockSaveBase._replace_extension\n        fname = \"/bing.bada.boom/foo.1942.tab\"\n        self.assertEqual(\n            replace(fname, \".tab\"), \"/bing.bada.boom/foo.1942.tab\")\n        self.assertEqual(\n            replace(fname, \".tab.gz\"), \"/bing.bada.boom/foo.1942.tab.gz\")\n        self.assertEqual(\n            replace(fname, \".xlsx\"), \"/bing.bada.boom/foo.1942.xlsx\")\n\n        fname = \"foo.tab.gz\"\n        self.assertEqual(replace(fname, \".tab\"), \"foo.tab\")\n        self.assertEqual(replace(fname, \".tab.gz\"), \"foo.tab.gz\")\n        self.assertEqual(replace(fname, \".csv\"), \"foo.csv\")\n        self.assertEqual(replace(fname, \".csv.gz\"), \"foo.csv.gz\")\n\n        fname = \"/bing.bada.boom/foo\"\n        self.assertEqual(replace(fname, \".tab\"), fname + \".tab\")\n        self.assertEqual(replace(fname, \".tab.gz\"), fname + \".tab.gz\")\n\n    def test_extension_from_filter(self):\n        eff = OWSaveBase._extension_from_filter\n        self.assertEqual(eff(\"Description (*.ext)\"), \".ext\")\n        self.assertEqual(eff(\"Description (*.foo.ba)\"), \".foo.ba\")\n        self.assertEqual(eff(\"Description (.ext)\"), \".ext\")\n        self.assertEqual(eff(\"Description (.foo.bar)\"), \".foo.bar\")\n\n\nif __name__ == \"__main__\":\n    unittest.main()\n",
            "header": {
                "file": {
                    "path": "Orange/widgets/utils/save/tests/test_owsavebase.py"
                },
                "misc_line": null
            },
            "index_line": {
                "old_commit_hash": "3b352a9e2",
                "new_commit_hash": "cadb637a6",
                "mode": "100644"
            },
            "is_binary_file": false,
            "binary_line": null,
            "minus_file": {
                "path": "a/Orange/widgets/utils/save/tests/test_owsavebase.py"
            },
            "plus_file": {
                "path": "b/Orange/widgets/utils/save/tests/test_owsavebase.py"
            },
            "hunks": [
                {
                    "descriptor": {
                        "old_range": {
                            "start": 103,
                            "length": 7
                        },
                        "new_range": {
                            "start": 103,
                            "length": 8
                        },
                        "section": "class TestOWSaveBaseWithWriters(WidgetTest):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "            b = b.replace(\"\\\\\", \"/\")",
                                "type": "context"
                            },
                            {
                                "content": "        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    @patch(\"os.path.exists\", lambda name: name == \"/home/u/orange/a/b\")",
                                "type": "deleted"
                            },
                            {
                                "content": "    @patch(\"os.path.exists\",",
                                "type": "added"
                            },
                            {
                                "content": "           lambda name: name in [\"/home/u/orange/a/b\", \"/foo/bar\"])",
                                "type": "added"
                            },
                            {
                                "content": "    def test_open_moved_workflow(self):",
                                "type": "context"
                            },
                            {
                                "content": "        \"\"\"Stored relative paths are properly changed on load\"\"\"",
                                "type": "context"
                            },
                            {
                                "content": "        home = _userhome",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/utils/save/tests/test_owsavebase.py",
                            "type": "class",
                            "name": "TestOWSaveBaseWithWriters",
                            "content": "class TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\", lambda name: name == \"/home/u/orange/a/b\")\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 47,
                            "end_lineno": 267,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 128,
                            "length": 6
                        },
                        "new_range": {
                            "start": 129,
                            "length": 15
                        },
                        "section": "class TestOWSaveBaseWithWriters(WidgetTest):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "            self.assertPathEqual(w.filename, home_c_foo)",
                                "type": "context"
                            },
                            {
                                "content": "            self.assertFalse(w.auto_save)",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "            w = self.create_widget(",
                                "type": "added"
                            },
                            {
                                "content": "                self.OWSaveMockWriter,",
                                "type": "added"
                            },
                            {
                                "content": "                stored_settings=dict(stored_path=\"/foo/bar\",",
                                "type": "added"
                            },
                            {
                                "content": "                                     stored_name=\"c.foo\",",
                                "type": "added"
                            },
                            {
                                "content": "                                     auto_save=True))",
                                "type": "added"
                            },
                            {
                                "content": "            self.assertPathEqual(w.last_dir, \"/foo/bar\")",
                                "type": "added"
                            },
                            {
                                "content": "            self.assertPathEqual(w.filename, \"/foo/bar/c.foo\")",
                                "type": "added"
                            },
                            {
                                "content": "            self.assertFalse(w.auto_save)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "added"
                            },
                            {
                                "content": "            w = self.create_widget(",
                                "type": "context"
                            },
                            {
                                "content": "                self.OWSaveMockWriter,",
                                "type": "context"
                            },
                            {
                                "content": "                stored_settings=dict(stored_path=\".\",",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/utils/save/tests/test_owsavebase.py",
                            "type": "method",
                            "name": "TestOWSaveBaseWithWriters.test_open_moved_workflow",
                            "content": "class TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\",\n           lambda name: name in [\"/home/u/orange/a/b\", \"/foo/bar\"])\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/foo/bar\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/foo/bar\")\n            self.assertPathEqual(w.filename, \"/foo/bar/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/d\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/d/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertTrue(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 108,
                            "end_lineno": 204,
                            "parent": {
                                "file_name": "Orange/widgets/utils/save/tests/test_owsavebase.py",
                                "type": "class",
                                "name": "TestOWSaveBaseWithWriters",
                                "content": "class TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\",\n           lambda name: name in [\"/home/u/orange/a/b\", \"/foo/bar\"])\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/foo/bar\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/foo/bar\")\n            self.assertPathEqual(w.filename, \"/foo/bar/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/d\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/d/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertTrue(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 47,
                                "end_lineno": 277,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/utils/save/tests/test_owsavebase.py",
                            "type": "class",
                            "name": "TestOWSaveBaseWithWriters",
                            "content": "class TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\",\n           lambda name: name in [\"/home/u/orange/a/b\", \"/foo/bar\"])\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/foo/bar\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/foo/bar\")\n            self.assertPathEqual(w.filename, \"/foo/bar/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/d\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/d/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertTrue(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 47,
                            "end_lineno": 277,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 162,
                            "length": 9
                        },
                        "new_range": {
                            "start": 172,
                            "length": 9
                        },
                        "section": "class TestOWSaveBaseWithWriters(WidgetTest):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "                stored_settings=dict(stored_path=\"a/d\",",
                                "type": "context"
                            },
                            {
                                "content": "                                     stored_name=\"c.foo\",",
                                "type": "context"
                            },
                            {
                                "content": "                                     auto_save=True))",
                                "type": "context"
                            },
                            {
                                "content": "            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")",
                                "type": "deleted"
                            },
                            {
                                "content": "            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")",
                                "type": "deleted"
                            },
                            {
                                "content": "            self.assertFalse(w.auto_save)",
                                "type": "deleted"
                            },
                            {
                                "content": "            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/d\")",
                                "type": "added"
                            },
                            {
                                "content": "            self.assertPathEqual(w.filename, \"/home/u/orange/a/d/c.foo\")",
                                "type": "added"
                            },
                            {
                                "content": "            self.assertTrue(w.auto_save)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "            w = self.create_widget(",
                                "type": "context"
                            },
                            {
                                "content": "                self.OWSaveMockWriter,",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/utils/save/tests/test_owsavebase.py",
                            "type": "method",
                            "name": "TestOWSaveBaseWithWriters.test_open_moved_workflow",
                            "content": "class TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\", lambda name: name == \"/home/u/orange/a/b\")\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 107,
                            "end_lineno": 194,
                            "parent": {
                                "file_name": "Orange/widgets/utils/save/tests/test_owsavebase.py",
                                "type": "class",
                                "name": "TestOWSaveBaseWithWriters",
                                "content": "class TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\", lambda name: name == \"/home/u/orange/a/b\")\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 47,
                                "end_lineno": 267,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/utils/save/tests/test_owsavebase.py",
                            "type": "class",
                            "name": "TestOWSaveBaseWithWriters",
                            "content": "class TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\", lambda name: name == \"/home/u/orange/a/b\")\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 47,
                            "end_lineno": 267,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 182,
                            "length": 7
                        },
                        "new_range": {
                            "start": 192,
                            "length": 7
                        },
                        "section": "class TestOWSaveBaseWithWriters(WidgetTest):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "                                     auto_save=True))",
                                "type": "context"
                            },
                            {
                                "content": "            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")",
                                "type": "context"
                            },
                            {
                                "content": "            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")",
                                "type": "context"
                            },
                            {
                                "content": "            self.assertFalse(w.auto_save)",
                                "type": "deleted"
                            },
                            {
                                "content": "            self.assertTrue(w.auto_save)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "            w = self.create_widget(",
                                "type": "context"
                            },
                            {
                                "content": "                self.OWSaveMockWriter,",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/utils/save/tests/test_owsavebase.py",
                            "type": "method",
                            "name": "TestOWSaveBaseWithWriters.test_open_moved_workflow",
                            "content": "class TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\", lambda name: name == \"/home/u/orange/a/b\")\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 107,
                            "end_lineno": 194,
                            "parent": {
                                "file_name": "Orange/widgets/utils/save/tests/test_owsavebase.py",
                                "type": "class",
                                "name": "TestOWSaveBaseWithWriters",
                                "content": "class TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\", lambda name: name == \"/home/u/orange/a/b\")\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 47,
                                "end_lineno": 267,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/utils/save/tests/test_owsavebase.py",
                            "type": "class",
                            "name": "TestOWSaveBaseWithWriters",
                            "content": "class TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\", lambda name: name == \"/home/u/orange/a/b\")\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 47,
                            "end_lineno": 267,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                },
                {
                    "descriptor": {
                        "old_range": {
                            "start": 191,
                            "length": 7
                        },
                        "new_range": {
                            "start": 201,
                            "length": 7
                        },
                        "section": "class TestOWSaveBaseWithWriters(WidgetTest):"
                    },
                    "line_group": {
                        "all_lines": [
                            {
                                "content": "                                     auto_save=True))",
                                "type": "context"
                            },
                            {
                                "content": "            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")",
                                "type": "context"
                            },
                            {
                                "content": "            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")",
                                "type": "context"
                            },
                            {
                                "content": "            self.assertFalse(w.auto_save)",
                                "type": "deleted"
                            },
                            {
                                "content": "            self.assertTrue(w.auto_save)",
                                "type": "added"
                            },
                            {
                                "content": "",
                                "type": "context"
                            },
                            {
                                "content": "    def test_move_workflow(self):",
                                "type": "context"
                            },
                            {
                                "content": "        \"\"\"Widget correctly stores relative paths\"\"\"",
                                "type": "context"
                            },
                            {
                                "content": "",
                                "type": "context"
                            }
                        ]
                    },
                    "modified_entities": [
                        {
                            "file_name": "Orange/widgets/utils/save/tests/test_owsavebase.py",
                            "type": "method",
                            "name": "TestOWSaveBaseWithWriters.test_open_moved_workflow",
                            "content": "class TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\", lambda name: name == \"/home/u/orange/a/b\")\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 107,
                            "end_lineno": 194,
                            "parent": {
                                "file_name": "Orange/widgets/utils/save/tests/test_owsavebase.py",
                                "type": "class",
                                "name": "TestOWSaveBaseWithWriters",
                                "content": "class TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\", lambda name: name == \"/home/u/orange/a/b\")\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))",
                                "ast_type_str": "ClassDef",
                                "start_lineno": 47,
                                "end_lineno": 267,
                                "parent": null
                            }
                        },
                        {
                            "file_name": "Orange/widgets/utils/save/tests/test_owsavebase.py",
                            "type": "class",
                            "name": "TestOWSaveBaseWithWriters",
                            "content": "class TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\", lambda name: name == \"/home/u/orange/a/b\")\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))",
                            "ast_type_str": "ClassDef",
                            "start_lineno": 47,
                            "end_lineno": 267,
                            "parent": null
                        }
                    ],
                    "added_entities": [],
                    "deleted_entities": []
                }
            ]
        }
    ],
    "old_commit_hash": "06794a7a3101f33e93d21b0773a6585164cfaab3^",
    "new_commit_hash": "06794a7a3101f33e93d21b0773a6585164cfaab3",
    "commit_message": "Merge pull request #4966 from janezd/savebase-autosave-disable\n\nSave widgets: Don't disable auto_save because of missing (relative) path",
    "commit_date": "2020-09-04T14:10:58+02:00",
    "metadata": {}
}
{
    "repo_name": "orange3",
    "new_commit_hash": "06794a7a3101f33e93d21b0773a6585164cfaab3",
    "test_file_codes": [
        "# Proper tests of OWSaveBase would require too much mocking, so we test most\n# OWSaveBase's methods within the test for OWSave widget.\n# The test for pure OWSaveBase just check a few methods that do not require\n# extensive mocking\n\n# pylint: disable=missing-docstring, protected-access, unsubscriptable-object\nimport unittest\nfrom unittest.mock import Mock, patch\nimport sys\nimport os\nimport collections\n\nfrom orangewidget.widget import Input\nfrom Orange.widgets.tests.base import WidgetTest\nfrom Orange.widgets.utils import getmembers\nfrom Orange.widgets.utils.save.owsavebase import OWSaveBase, _userhome\n\n\nclass SaveWidgetsTestBaseMixin:\n    def test_input_handler(self):\n        widget = self.widget\n        if not widget:\n            return\n        widget.on_new_input = Mock()\n\n        inputs = getmembers(widget.Inputs, Input)\n        self.assertGreaterEqual(len(inputs), 1, msg=\"Widget defines no inputs\")\n        if len(inputs) > 1:\n            self.skipTest(\n                \"widget has multiple inputs; input handler can't be tested\")\n            return\n\n        handler = getattr(widget, inputs[0][1].handler)\n        data = Mock()\n        handler(data)\n        self.assertIs(widget.data, data)\n        widget.on_new_input.assert_called()\n\n    def test_filters(self):\n        filters = self.widget.get_filters()\n        self.assertGreaterEqual(len(filters), 1,\n                                msg=\"Widget defines no filters\")\n        if type(self.widget).do_save is OWSaveBase.do_save:\n            self.assertIsInstance(filters, collections.abc.Mapping)\n\n\nclass TestOWSaveBaseWithWriters(WidgetTest):\n    # Tests for OWSaveBase methods that require filters to be dictionaries\n    # with with writers as keys in `filters`.\n    class OWSaveMockWriter(OWSaveBase):\n        name = \"Mock save\"\n        writer = Mock()\n        writer.EXTENSIONS = [\".csv\"]\n        writer.SUPPORT_COMPRESSED = True\n        writer.SUPPORT_SPARSE_DATA = False\n        writer.OPTIONAL_TYPE_ANNOTATIONS = False\n        writers = [writer]\n        filters = {\"csv (*.csv)\": writer}\n\n    def setUp(self):\n        self.widget = self.create_widget(self.OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        write = widget.writer.write = Mock()\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        write.assert_not_called()\n\n        widget.filename = \"\"\n        widget.save_file()\n        widget.save_file_as.assert_called()\n        write.assert_not_called()\n\n    def test_save_calls_writer(self):\n        widget = self.widget\n\n        widget.writer = Mock()\n        write = widget.writer.write = Mock()\n        widget.filename = \"foo\"\n        widget.data = object()\n\n        widget.save_file()\n        write.assert_called_with(widget.filename, widget.data)\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n    def assertPathEqual(self, a, b):\n        if sys.platform == \"win32\":\n            a = a.replace(\"\\\\\", \"/\")\n            b = b.replace(\"\\\\\", \"/\")\n        self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\n\n    @patch(\"os.path.exists\",\n           lambda name: name in [\"/home/u/orange/a/b\", \"/foo/bar\"])\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/foo/bar\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/foo/bar\")\n            self.assertPathEqual(w.filename, \"/foo/bar/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/d\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/d/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertFalse(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertTrue(w.auto_save)\n\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/c.foo\")\n            self.assertTrue(w.auto_save)\n\n    def test_move_workflow(self):\n        \"\"\"Widget correctly stores relative paths\"\"\"\n        w = self.widget\n        w._try_save = Mock()\n        w.update_messages = Mock()\n        env = {}\n\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value=env)):\n            # File is save to subdirectory of workflow path\n            env[\"basedir\"] = \"/home/u/orange/\"\n\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes: relative path is changed to absolute\n            env[\"basedir\"] = \"/tmp/u/work/\"\n            w.workflowEnvChanged(\"basedir\", \"/tmp/u/work\", \"/home/u/orange\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/home/u/orange/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # Workflow path changes back: absolute path is again relative\n            env[\"basedir\"] = \"/home/u/orange/\"\n            w.workflowEnvChanged(\"basedir\", \"/home/u/orange\", \"/tmp/u/work\")\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.stored_path, \"a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to an unrelated directory: path is absolute\n            w.get_save_filename = \\\n                Mock(return_value=(\"/tmp/u/work/a/b/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/tmp/u/work/a/b/\")\n            self.assertPathEqual(w.stored_path, \"/tmp/u/work/a/b/\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n            # File is saved to the workflow's directory: path is relative\n            w.get_save_filename = \\\n                Mock(return_value=(\"/home/u/orange/c.foo\", \"\"))\n            w.save_file_as()\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/\")\n            self.assertPathEqual(w.stored_path, \".\")\n            self.assertEqual(w.stored_name, \"c.foo\")\n\n    def test_migrate_pre_relative_settings(self):\n        with patch(\"os.path.exists\", lambda name: name == \"/a/b\"):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n            self.assertPathEqual(w.last_dir, \"/a/b\")\n            self.assertPathEqual(w.filename, \"/a/b/c.foo\")\n            self.assertPathEqual(w.stored_path, \"/a/b\")\n            self.assertPathEqual(w.stored_name, \"c.foo\")\n\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(last_dir=\"/a/b\", filename=\"/a/b/c.foo\"))\n        self.assertPathEqual(w.last_dir, _userhome)\n        self.assertPathEqual(w.filename, os.path.join(_userhome, \"c.foo\"))\n        self.assertPathEqual(w.stored_path, _userhome)\n        self.assertPathEqual(w.stored_name, \"c.foo\")\n\n    def test_save_button_label(self):\n        w = self.create_widget(\n            self.OWSaveMockWriter,\n            stored_settings=dict(stored_path=\"\", stored_name=\"c.foo\"))\n        self.assertTrue(w.bt_save.text().endswith(\" c.foo\"))\n\n\nclass TestOWSaveBase(WidgetTest):\n    # Tests for OWSaveBase methods with filters as list\n    def setUp(self):\n        class OWSaveMockWriter(OWSaveBase):\n            name = \"Mock save\"\n            filters = [\"csv (*.csv)\"]\n\n            do_save = Mock()\n\n        self.widget = self.create_widget(OWSaveMockWriter)\n\n    def test_no_data_no_save(self):\n        widget = self.widget\n\n        widget.save_file_as = Mock()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        widget.do_save.assert_not_called()\n\n        widget.filename = \"\"\n        widget.data = Mock()\n        widget.save_file()\n        widget.do_save.assert_not_called()\n\n        widget.filename = \"foo.tab\"\n        widget.save_file()\n        widget.do_save.assert_called()\n\n    def test_base_methods(self):\n        \"\"\"Default methods do not crash and do something sensible\"\"\"\n        widget = self.widget\n\n        widget.update_status()\n        self.assertEqual(widget.initial_start_dir(),\n                         os.path.expanduser(f\"~{os.sep}\"))\n        self.assertEqual(widget.suggested_name(), \"\")\n        self.assertIs(widget.valid_filters(), widget.get_filters())\n        self.assertIs(widget.default_valid_filter(), widget.filter)\n\n\nclass TestOWSaveUtils(unittest.TestCase):\n    def test_replace_extension(self):\n        class OWMockSaveBase(OWSaveBase):\n            filters = [\"Tab delimited (*.tab)\",\n                       \"Compressed tab delimited (*.gz.tab)\",\n                       \"Comma separated (*.csv)\",\n                       \"Compressed comma separated (*.csv.gz)\",\n                       \"Excel File (*.xlsx)\"]\n\n        replace = OWMockSaveBase._replace_extension\n        fname = \"/bing.bada.boom/foo.1942.tab\"\n        self.assertEqual(\n            replace(fname, \".tab\"), \"/bing.bada.boom/foo.1942.tab\")\n        self.assertEqual(\n            replace(fname, \".tab.gz\"), \"/bing.bada.boom/foo.1942.tab.gz\")\n        self.assertEqual(\n            replace(fname, \".xlsx\"), \"/bing.bada.boom/foo.1942.xlsx\")\n\n        fname = \"foo.tab.gz\"\n        self.assertEqual(replace(fname, \".tab\"), \"foo.tab\")\n        self.assertEqual(replace(fname, \".tab.gz\"), \"foo.tab.gz\")\n        self.assertEqual(replace(fname, \".csv\"), \"foo.csv\")\n        self.assertEqual(replace(fname, \".csv.gz\"), \"foo.csv.gz\")\n\n        fname = \"/bing.bada.boom/foo\"\n        self.assertEqual(replace(fname, \".tab\"), fname + \".tab\")\n        self.assertEqual(replace(fname, \".tab.gz\"), fname + \".tab.gz\")\n\n    def test_extension_from_filter(self):\n        eff = OWSaveBase._extension_from_filter\n        self.assertEqual(eff(\"Description (*.ext)\"), \".ext\")\n        self.assertEqual(eff(\"Description (*.foo.ba)\"), \".foo.ba\")\n        self.assertEqual(eff(\"Description (.ext)\"), \".ext\")\n        self.assertEqual(eff(\"Description (.foo.bar)\"), \".foo.bar\")\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/tmp8txpvbau/tmp\ncreating /tmp/tmp8txpvbau/tmp/tmp8txpvbau\ncompile options: '-MMD -MF /tmp/tmp8txpvbau/file.c.d -c'\ncc: /tmp/tmp8txpvbau/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/tmp4ow3lsip/tmp\ncreating /tmp/tmp4ow3lsip/tmp/tmp4ow3lsip\ncompile options: '-MMD -MF /tmp/tmp4ow3lsip/file.c.d -c'\ncc: /tmp/tmp4ow3lsip/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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include -I/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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/tmpyu0wlhi7/tmp\ncreating /tmp/tmpyu0wlhi7/tmp/tmpyu0wlhi7\ncompile options: '-MMD -MF /tmp/tmpyu0wlhi7/file.c.d -c'\ncc: /tmp/tmpyu0wlhi7/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/tmpgygiiohu/tmp\ncreating /tmp/tmpgygiiohu/tmp/tmpgygiiohu\ncompile options: '-MMD -MF /tmp/tmpgygiiohu/file.c.d -c'\ncc: /tmp/tmpgygiiohu/file.c\ncustomize UnixCCompiler using build_ext\nCreating /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/Orange3.egg-link (link to .)\nAdding Orange3 3.27.0.dev0+06794a7 to easy-install.pth file\nInstalling orange-canvas script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\n\nInstalled /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3\nProcessing dependencies for Orange3==3.27.0.dev0+06794a7\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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\nInstalling pip3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\nInstalling pip3.10 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages\nSearching for openpyxl==3.1.3\nBest match: openpyxl 3.1.3\nAdding openpyxl 3.1.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\nInstalling f2py3 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\nInstalling f2py3.7 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages\nSearching for httpx==0.14.3\nBest match: httpx 0.14.3\nAdding httpx 0.14.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages\nSearching for chardet==3.0.4\nBest match: chardet 3.0.4\nAdding chardet 3.0.4 to easy-install.pth file\nInstalling chardetect script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages\nSearching for baycomp==1.0.3\nBest match: baycomp 1.0.3\nAdding baycomp 1.0.3 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages\nSearching for PyQtWebEngine==5.15.6\nBest match: PyQtWebEngine 5.15.6\nAdding PyQtWebEngine 5.15.6 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages\nSearching for PyQt5==5.15.10\nBest match: PyQt5 5.15.10\nAdding PyQt5 5.15.10 to easy-install.pth file\nInstalling pylupdate5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\nInstalling pyrcc5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\nInstalling pyuic5 script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages\nSearching for et-xmlfile==1.1.0\nBest match: et-xmlfile 1.1.0\nAdding et-xmlfile 1.1.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\nInstalling pyftmerge script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\nInstalling pyftsubset script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\nInstalling ttx script to /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/bin\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages\nSearching for rfc3986==1.5.0\nBest match: rfc3986 1.5.0\nAdding rfc3986 1.5.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages\nSearching for sniffio==1.3.1\nBest match: sniffio 1.3.1\nAdding sniffio 1.3.1 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages\nSearching for httpcore==0.10.2\nBest match: httpcore 0.10.2\nAdding httpcore 0.10.2 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages\nSearching for PyQtWebEngine-Qt5==5.15.16\nBest match: PyQtWebEngine-Qt5 5.15.16\nAdding PyQtWebEngine-Qt5 5.15.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages\nSearching for PyQt5-sip==12.13.0\nBest match: PyQt5-sip 12.13.0\nAdding PyQt5-sip 12.13.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages\nSearching for PyQt5-Qt5==5.15.16\nBest match: PyQt5-Qt5 5.15.16\nAdding PyQt5-Qt5 5.15.16 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages\nSearching for h11==0.9.0\nBest match: h11 0.9.0\nAdding h11 0.9.0 to easy-install.pth file\n\nUsing /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages\nFinished processing dependencies for Orange3==3.27.0.dev0+06794a7\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 204ms\nPrepared 18 packages in 13ms\nInstalled 18 packages in 240ms\n + cython==0.29.37\n + exceptiongroup==1.2.2\n + importlib-metadata==6.7.0\n + iniconfig==2.0.0\n + numpy==1.17.5\n + packaging==24.0\n + pluggy==1.2.0\n + pyqt5==5.15.10\n + pyqt5-qt5==5.15.16\n + pyqt5-sip==12.13.0\n + pyqtwebengine==5.15.6\n + pyqtwebengine-qt5==5.15.16\n + pytest==7.4.4\n + setuptools==59.8.0\n + tomli==2.0.1\n + typing-extensions==4.7.1\n + wheel==0.42.0\n + zipp==3.15.0\nResolved 53 packages in 262ms\nInstalled 47 packages in 528ms\n + baycomp==1.0.3\n + bottleneck==1.4.0\n + certifi==2024.12.14\n + cffi==1.15.1\n + chardet==3.0.4\n + charset-normalizer==3.4.1\n + cryptography==44.0.0\n + cycler==0.11.0\n + et-xmlfile==1.1.0\n + fonttools==4.38.0\n + h11==0.9.0\n + httpcore==0.10.2\n + httpx==0.14.3\n + idna==3.10\n + importlib-resources==5.12.0\n + jaraco-classes==3.2.3\n + jeepney==0.8.0\n + joblib==1.3.2\n + keyring==24.1.1\n + keyrings-alt==4.2.0\n + kiwisolver==1.4.5\n + matplotlib==3.5.3\n + more-itertools==9.1.0\n + networkx==2.6.3\n + openpyxl==3.1.3\n + opentsne==1.0.1\n + pandas==1.3.5\n + pillow==9.5.0\n + pip==24.0\n + pycparser==2.21\n + pyparsing==3.1.4\n + python-dateutil==2.9.0.post0\n + python-louvain==0.16\n + pytz==2024.2\n + pyyaml==6.0.1\n + requests==2.31.0\n + rfc3986==1.5.0\n + scikit-learn==1.0.2\n + scipy==1.7.3\n + secretstorage==3.3.3\n + serverfiles==0.3.1\n + six==1.17.0\n + sniffio==1.3.1\n + threadpoolctl==3.1.0\n + urllib3==2.0.7\n + xlrd==2.0.1\n + xlsxwriter==3.2.0\nResolved 39 packages in 70ms\nInstalled 13 packages in 154ms\n + anyqt==0.2.0\n + attrs==24.2.0\n + cattrs==23.1.2\n + commonmark==0.9.1\n + dictdiffer==0.9.0\n + docutils==0.20.1\n + orange-canvas-core==0.1.35\n + orange-widget-base==4.22.0\n + platformdirs==4.0.0\n + pyqtgraph==0.12.4\n + qasync==0.25.0\n + requests-cache==1.1.1\n + url-normalize==1.4.3\nResolved 2 packages in 3ms\nInstalled 2 packages in 17ms\n + psycopg2==2.9.9\n + pymssql==2.3.2\nAudited 1 package in 30ms\nAudited 2 packages in 1ms\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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/arrayobject.h:4,\n                 from Orange/preprocess/_relieff.cpp:627:\n/home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarraytypes.h:1830,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.venv/lib/python3.7/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,\n                 from /home/gcpuser/buckets/local_repoeval_bucket/repos/orange3_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3/.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_06794a7a3101f33e93d21b0773a6585164cfaab3\ncollected 20 items\n\nr2e_tests/test_1.py sss.................                                 [100%]\n\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_base_methods\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_image_export\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_migrate_pre_relative_settings\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_minimum_size\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_move_workflow\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_no_data_no_save\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_open_moved_workflow\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_save_button_label\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_save_calls_writer\nPASSED r2e_tests/test_1.py::TestOWSaveBase::test_base_methods\nPASSED r2e_tests/test_1.py::TestOWSaveBase::test_image_export\nPASSED r2e_tests/test_1.py::TestOWSaveBase::test_minimum_size\nPASSED r2e_tests/test_1.py::TestOWSaveBase::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWSaveBase::test_no_data_no_save\nPASSED r2e_tests/test_1.py::TestOWSaveUtils::test_extension_from_filter\nPASSED r2e_tests/test_1.py::TestOWSaveUtils::test_replace_extension\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:244: image exporting not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:238: minimum size not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:250: msg base class not tested as .widget was not set\n======================== 17 passed, 3 skipped in 4.19s =========================\nWidgets left: 0    Max widgets: 897 \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_06794a7a3101f33e93d21b0773a6585164cfaab3\ncollected 20 items\n\nr2e_tests/test_1.py sss.......F.........                                 [100%]\n\n=================================== FAILURES ===================================\n______________ TestOWSaveBaseWithWriters.test_open_moved_workflow ______________\n\nself = <r2e_tests.test_1.TestOWSaveBaseWithWriters testMethod=test_open_moved_workflow>\n\n    @patch(\"os.path.exists\",\n           lambda name: name in [\"/home/u/orange/a/b\", \"/foo/bar\"])\n    def test_open_moved_workflow(self):\n        \"\"\"Stored relative paths are properly changed on load\"\"\"\n        home = _userhome\n        home_c_foo = os.path.join(_userhome, \"c.foo\")\n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n    \n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n    \n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"/foo/bar\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/foo/bar\")\n            self.assertPathEqual(w.filename, \"/foo/bar/c.foo\")\n            self.assertFalse(w.auto_save)\n    \n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\".\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, home)\n            self.assertPathEqual(w.filename, home_c_foo)\n            self.assertFalse(w.auto_save)\n    \n        with patch(\"Orange.widgets.widget.OWWidget.workflowEnv\",\n                   Mock(return_value={\"basedir\": \"/home/u/orange/\"})):\n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertTrue(w.auto_save)\n    \n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/b\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=False))\n            self.assertPathEqual(w.last_dir, \"/home/u/orange/a/b\")\n            self.assertPathEqual(w.filename, \"/home/u/orange/a/b/c.foo\")\n            self.assertFalse(w.auto_save)\n    \n            w = self.create_widget(\n                self.OWSaveMockWriter,\n                stored_settings=dict(stored_path=\"a/d\",\n                                     stored_name=\"c.foo\",\n                                     auto_save=True))\n>           self.assertPathEqual(w.last_dir, \"/home/u/orange/a/d\")\n\nr2e_tests/test_1.py:175: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \nr2e_tests/test_1.py:104: in assertPathEqual\n    self.assertEqual(a.rstrip(\"/\"), b.rstrip(\"/\"))\nE   AssertionError: '/home/u/orange' != '/home/u/orange/a/d'\nE   - /home/u/orange\nE   + /home/u/orange/a/d\nE   ?               ++++\n==================================== PASSES ====================================\n=========================== short test summary info ============================\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_base_methods\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_image_export\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_migrate_pre_relative_settings\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_minimum_size\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_move_workflow\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_no_data_no_save\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_save_button_label\nPASSED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_save_calls_writer\nPASSED r2e_tests/test_1.py::TestOWSaveBase::test_base_methods\nPASSED r2e_tests/test_1.py::TestOWSaveBase::test_image_export\nPASSED r2e_tests/test_1.py::TestOWSaveBase::test_minimum_size\nPASSED r2e_tests/test_1.py::TestOWSaveBase::test_msg_base_class\nPASSED r2e_tests/test_1.py::TestOWSaveBase::test_no_data_no_save\nPASSED r2e_tests/test_1.py::TestOWSaveUtils::test_extension_from_filter\nPASSED r2e_tests/test_1.py::TestOWSaveUtils::test_replace_extension\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:244: image exporting not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:238: minimum size not tested as .widget was not set\nSKIPPED [1] .venv/lib/python3.7/site-packages/orangewidget/tests/base.py:250: msg base class not tested as .widget was not set\nFAILED r2e_tests/test_1.py::TestOWSaveBaseWithWriters::test_open_moved_workflow\n=================== 1 failed, 16 passed, 3 skipped in 2.89s ====================\nWidgets left: 0    Max widgets: 780 \n\n",
    "old_commit_res_stderr": ""
}
Orange/widgets/utils/save/owsavebase.py Orange/widgets/utils/save/tests/test_owsavebase.py
We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[ISSUE]
**Title:** Auto Save Disabled Incorrectly When Stored Path Is Relative and Missing

**Description:**
When the `stored_path` is set to a relative path that does not exist, the widget incorrectly disables the `auto_save` feature. This causes issues when attempting to move workflows, as the widget fails to update the `last_dir` and `filename` properties appropriately.

**Example Buggy Code:**
```python
# Setup with a relative path that does not exist
widget = OWSaveBase(stored_path="a/d", stored_name="c.foo", auto_save=True)

# Attempt to load a moved workflow
widget.load_workflow()

# Expected last_dir to be updated to "/home/u/orange/a/d"
# Instead, it remains as "/home/u/orange"
```

**Expected Behavior:**
The `auto_save` feature should remain enabled as long as the `stored_path` is relative, regardless of whether the path currently exists. When a workflow is moved, the `last_dir` and `filename` should correctly update to reflect the new location of the relative path.

**Actual Behavior:**
If the `stored_path` is relative and does not exist, `auto_save` is disabled. Consequently, when loading a moved workflow, the `last_dir` does not update to the expected new path (`"/home/u/orange/a/d"`) but instead remains at the base directory (`"/home/u/orange"`), preventing proper workflow management.

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

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

--- BEGIN FILE ---
```
### Orange/widgets/utils/save/owsavebase.py
import os.path
import sys
import re

from AnyQt.QtWidgets import QFileDialog, QGridLayout, QMessageBox

from Orange.widgets import gui, widget
from Orange.widgets.settings import Setting


_userhome = os.path.expanduser(f"~{os.sep}")


class OWSaveBase(widget.OWWidget, openclass=True):
    """
    Base class for Save widgets

    A derived class must provide, at minimum:

    - class `Inputs` and the corresponding handler that:

      - saves the input to an attribute `data`, and
      - calls `self.on_new_input`.

    - a class attribute `filters` with a list of filters or a dictionary whose
      keys are filters OR a class method `get_filters` that returns such a
      list or dictionary
    - method `do_save` that saves `self.data` into `self.filename`

    Alternatively, instead of defining `do_save` a derived class can make
    `filters` a dictionary whose keys are classes that define a method `write`
    (like e.g. `TabReader`). Method `do_save` defined in the base class calls
    the writer corresponding to the currently chosen filter.

    A minimum example of derived class is
    `Orange.widgets.model.owsavemodel.OWSaveModel`.
    A more advanced widget that overrides a lot of base class behaviour is
    `Orange.widgets.data.owsave.OWSave`.
    """

    class Information(widget.OWWidget.Information):
        empty_input = widget.Msg("Empty input; nothing was saved.")

    class Error(widget.OWWidget.Error):
        no_file_name = widget.Msg("File name is not set.")
        general_error = widget.Msg("{}")

    want_main_area = False
    resizing_enabled = False

    filter = Setting("")  # Default is provided in __init__

    # If the path is in the same directory as the workflow file or its
    # subdirectory, it is stored as a relative path, otherwise as absolute.
    # For the sake of security, we do not store relative paths from other
    # directories, like home or cwd. After loading the widget from a schema,
    # auto_save is set to off, unless the stored_path is relative (to the
    # workflow).
    stored_path = Setting("")
    stored_name = Setting("", schema_only=True)  # File name, without path
    auto_save = Setting(False)

    filters = []

    def __init__(self, start_row=0):
        """
        Set up the gui.

        The gui consists of a checkbox for auto save and two buttons put on a
        grid layout. Derived widgets that want to place controls above the auto
        save widget can set the `start_row` argument to the first free row,
        and this constructor will start filling the grid there.

        Args:
            start_row (int): the row at which to start filling the gui
        """
        super().__init__()
        self.data = None
        self._absolute_path = self._abs_path_from_setting()

        # This cannot be done outside because `filters` is defined by subclass
        if not self.filter:
            self.filter = next(iter(self.get_filters()))

        self.grid = grid = QGridLayout()
        gui.widgetBox(self.controlArea, orientation=grid)
        grid.addWidget(
            gui.checkBox(
                None, self, "auto_save", "Autosave when receiving new data",
                callback=self.update_messages),
            start_row, 0, 1, 2)
        grid.setRowMinimumHeight(start_row + 1, 8)
        self.bt_save = gui.button(
            None, self,
            label=f"Save as {self.stored_name}" if self.stored_name else "Save",
            callback=self.save_file)
        grid.addWidget(self.bt_save, start_row + 2, 0)
        grid.addWidget(
            gui.button(None, self, "Save as ...", callback=self.save_file_as),
            start_row + 2, 1)

        self.adjustSize()
        self.update_messages()

    @property
    def last_dir(self):
        # Not the best name, but kept for compatibility
        return self._absolute_path

    @last_dir.setter
    def last_dir(self, absolute_path):
        """Store _absolute_path and update relative path (stored_path)"""
        self._absolute_path = absolute_path

        workflow_dir = self.workflowEnv().get("basedir", None)
        if workflow_dir and absolute_path.startswith(workflow_dir.rstrip("/")):
            self.stored_path = os.path.relpath(absolute_path, workflow_dir)
        else:
            self.stored_path = absolute_path

    def _abs_path_from_setting(self):
        """
        Compute absolute path from `stored_path` from settings.

        Auto save is disabled unless stored_path is relative and exists.
        """
        workflow_dir = self.workflowEnv().get("basedir")
        if os.path.isabs(self.stored_path):
            path = self.stored_path
            self.auto_save = False
        elif workflow_dir:
            path = os.path.join(workflow_dir, self.stored_path)
        else:
            path = None

        if path and os.path.exists(path):
            return path
        else:
            self.stored_path = workflow_dir or _userhome
            self.auto_save = False
            return self.stored_path

    @property
    def filename(self):
        if self.stored_name:
            return os.path.join(self._absolute_path, self.stored_name)
        else:
            return ""

    @filename.setter
    def filename(self, value):
        self.last_dir, self.stored_name = os.path.split(value)

    # pylint: disable=unused-argument
    def workflowEnvChanged(self, key, value, oldvalue):
        # Trigger refresh of relative path, e.g. when saving the scheme
        if key == "basedir":
            self.last_dir = self._absolute_path

    @classmethod
    def get_filters(cls):
        return cls.filters

    @property
    def writer(self):
        """
        Return the active writer

        The base class uses this property only in `do_save` to find the writer
        corresponding to the filter. Derived classes (e.g. OWSave) may also use
        it elsewhere.
        """
        return self.get_filters()[self.filter]

    def on_new_input(self):
        """
        This method must be called from input signal handler.

        - It clears errors, warnings and information and calls
          `self.update_messages` to set the as needed.
        - It also calls `update_status` the can be overriden in derived
          methods to set the status (e.g. the number of input rows)
        - Calls `self.save_file` if `self.auto_save` is enabled and
          `self.filename` is provided.
        """
        self.Error.clear()
        self.Warning.clear()
        self.Information.clear()
        self.update_messages()
        self.update_status()
        if self.auto_save and self.filename:
            self.save_file()

    def save_file_as(self):
        """
        Ask the user for the filename and try saving the file
        """
        filename, selected_filter = self.get_save_filename()
        if not filename:
            return
        self.filename = filename
        self.filter = selected_filter
        self.bt_save.setText(f"Save as {self.stored_name}")
        self.update_messages()
        self._try_save()

    def save_file(self):
        """
        If file name is provided, try saving, else call save_file_as
        """
        if not self.filename:
            self.save_file_as()
        else:
            self._try_save()

    def _try_save(self):
        """
        Private method that calls do_save within try-except that catches and
        shows IOError. Do nothing if not data or no file name.
        """
        self.Error.general_error.clear()
        if self.data is None or not self.filename:
            return
        try:
            self.do_save()
        except IOError as err_value:
            self.Error.general_error(str(err_value))

    def do_save(self):
        """
        Do the saving.

        Default implementation calls the write method of the writer
        corresponding to the current filter. This requires that get_filters()
        returns is a dictionary whose keys are classes.

        Derived classes may simplify this by providing a list of filters and
        override do_save. This is particularly handy if the widget supports only
        a single format.
        """
        # This method is separated out because it will usually be overriden
        self.writer.write(self.filename, self.data)

    def update_messages(self):
        """
        Update errors, warnings and information.

        Default method sets no_file_name if auto_save is enabled but file name
        is not provided; and empty_input if file name is given but there is no
        data.

        Derived classes that define further messages will typically set them in
        this method.
        """
        self.Error.no_file_name(shown=not self.filename and self.auto_save)
        self.Information.empty_input(shown=self.filename and self.data is None)

    def update_status(self):
        """
        Update the input/output indicator. Default method does nothing.
        """

    def initial_start_dir(self):
        """
        Provide initial start directory

        Return either the current file's path, the last directory or home.
        """
        if self.filename and os.path.exists(os.path.split(self.filename)[0]):
            return self.filename
        else:
            return self.last_dir or _userhome

    @staticmethod
    def suggested_name():
        """
        Suggest the name for the output file or return an empty string.
        """
        return ""

    @classmethod
    def _replace_extension(cls, filename, extension):
        """
        Remove all extensions that appear in any filter.

        Double extensions are broken in different weird ways across all systems,
        including omitting some, like turning iris.tab.gz to iris.gz. This
        function removes anything that can appear anywhere.
        """
        known_extensions = set()
        for filt in cls.get_filters():
            known_extensions |= set(cls._extension_from_filter(filt).split("."))
        if "" in known_extensions:
            known_extensions.remove("")
        while True:
            base, ext = os.path.splitext(filename)
            if ext[1:] not in known_extensions:
                break
            filename = base
        return filename + extension

    @staticmethod
    def _extension_from_filter(selected_filter):
        return re.search(r".*\(\*?(\..*)\)$", selected_filter).group(1)

    def valid_filters(self):
        return self.get_filters()

    def default_valid_filter(self):
        return self.filter

    @classmethod
    def migrate_settings(cls, settings, version):
        # We cannot use versions because they are overriden in derived classes
        if "last_dir" in settings:
            settings["stored_path"] = settings.pop("last_dir")
        if "filename" in settings:
            settings["stored_name"] = os.path.split(
                settings.pop("filename") or "")[1]

    # As of Qt 5.9, QFileDialog.setDefaultSuffix does not support double
    # suffixes, not even in non-native dialogs. We handle each OS separately.
    if sys.platform in ("darwin", "win32"):
        # macOS and Windows native dialogs do not correctly handle double
        # extensions. We thus don't pass any suffixes to the dialog and add
        # the correct suffix after closing the dialog and only then check
        # if the file exists and ask whether to override.
        # It is a bit confusing that the user does not see the final name in the
        # dialog, but I see no better solution.
        def get_save_filename(self):  # pragma: no cover
            if sys.platform == "darwin":
                def remove_star(filt):
                    return filt.replace(" (*.", " (.")
            else:
                def remove_star(filt):
                    return filt

            no_ext_filters = {remove_star(f): f for f in self.valid_filters()}
            filename = self.initial_start_dir()
            while True:
                dlg = QFileDialog(
                    None, "Save File", filename, ";;".join(no_ext_filters))
                dlg.setAcceptMode(dlg.AcceptSave)
                dlg.selectNameFilter(remove_star(self.default_valid_filter()))
                dlg.setOption(QFileDialog.DontConfirmOverwrite)
                if dlg.exec() == QFileDialog.Rejected:
                    return "", ""
                filename = dlg.selectedFiles()[0]
                selected_filter = no_ext_filters[dlg.selectedNameFilter()]
                filename = self._replace_extension(
                    filename, self._extension_from_filter(selected_filter))
                if not os.path.exists(filename) or QMessageBox.question(
                        self, "Overwrite file?",
                        f"File {os.path.split(filename)[1]} already exists.\n"
                        "Overwrite?") == QMessageBox.Yes:
                    return filename, selected_filter

    else:  # Linux and any unknown platforms
        # Qt does not use a native dialog on Linux, so we can connect to
        # filterSelected and to overload selectFile to change the extension
        # while the dialog is open.
        # For unknown platforms (which?), we also use the non-native dialog to
        # be sure we know what happens.
        class SaveFileDialog(QFileDialog):
            # pylint: disable=protected-access
            def __init__(self, save_cls, *args, **kwargs):
                super().__init__(*args, **kwargs)
                self.save_cls = save_cls
                self.suffix = ""
                self.setAcceptMode(QFileDialog.AcceptSave)
                self.setOption(QFileDialog.DontUseNativeDialog)
                self.filterSelected.connect(self.updateDefaultExtension)

            def selectNameFilter(self, selected_filter):
                super().selectNameFilter(selected_filter)
                self.updateDefaultExtension(selected_filter)

            def updateDefaultExtension(self, selected_filter):
                self.suffix = \
                    self.save_cls._extension_from_filter(selected_filter)
                files = self.selectedFiles()
                if files and not os.path.isdir(files[0]):
                    self.selectFile(files[0])

            def selectFile(self, filename):
                filename = \
                    self.save_cls._replace_extension(filename, self.suffix)
                super().selectFile(filename)

        def get_save_filename(self):
            dlg = self.SaveFileDialog(
                type(self),
                None, "Save File", self.initial_start_dir(),
                ";;".join(self.valid_filters()))
            dlg.selectNameFilter(self.default_valid_filter())
            if dlg.exec() == QFileDialog.Rejected:
                return "", ""
            else:
                return dlg.selectedFiles()[0], dlg.selectedNameFilter()

```
--- 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:** Auto Save Disabled Incorrectly When Stored Path Is Relative and Missing

**Description:**
When the `stored_path` is set to a relative path that does not exist, the widget incorrectly disables the `auto_save` feature. This causes issues when attempting to move workflows, as the widget fails to update the `last_dir` and `filename` properties appropriately.

**Example Buggy Code:**
```python
# Setup with a relative path that does not exist
widget = OWSaveBase(stored_path="a/d", stored_name="c.foo", auto_save=True)

# Attempt to load a moved workflow
widget.load_workflow()

# Expected last_dir to be updated to "/home/u/orange/a/d"
# Instead, it remains as "/home/u/orange"
```

**Expected Behavior:**
The `auto_save` feature should remain enabled as long as the `stored_path` is relative, regardless of whether the path currently exists. When a workflow is moved, the `last_dir` and `filename` should correctly update to reflect the new location of the relative path.

**Actual Behavior:**
If the `stored_path` is relative and does not exist, `auto_save` is disabled. Consequently, when loading a moved workflow, the `last_dir` does not update to the expected new path (`"/home/u/orange/a/d"`) but instead remains at the base directory (`"/home/u/orange"`), preventing proper workflow management.

[/ISSUE]
{
    "TestOWSaveBaseWithWriters.test_base_methods": "PASSED",
    "TestOWSaveBaseWithWriters.test_image_export": "PASSED",
    "TestOWSaveBaseWithWriters.test_migrate_pre_relative_settings": "PASSED",
    "TestOWSaveBaseWithWriters.test_minimum_size": "PASSED",
    "TestOWSaveBaseWithWriters.test_move_workflow": "PASSED",
    "TestOWSaveBaseWithWriters.test_msg_base_class": "PASSED",
    "TestOWSaveBaseWithWriters.test_no_data_no_save": "PASSED",
    "TestOWSaveBaseWithWriters.test_open_moved_workflow": "PASSED",
    "TestOWSaveBaseWithWriters.test_save_button_label": "PASSED",
    "TestOWSaveBaseWithWriters.test_save_calls_writer": "PASSED",
    "TestOWSaveBase.test_base_methods": "PASSED",
    "TestOWSaveBase.test_image_export": "PASSED",
    "TestOWSaveBase.test_minimum_size": "PASSED",
    "TestOWSaveBase.test_msg_base_class": "PASSED",
    "TestOWSaveBase.test_no_data_no_save": "PASSED",
    "TestOWSaveUtils.test_extension_from_filter": "PASSED",
    "TestOWSaveUtils.test_replace_extension": "PASSED"
}
diff --git a/Orange/widgets/utils/save/owsavebase.py b/Orange/widgets/utils/save/owsavebase.py
index 4b43f3637..ed527207b 100644
--- a/Orange/widgets/utils/save/owsavebase.py
+++ b/Orange/widgets/utils/save/owsavebase.py
@@ -122,23 +122,21 @@ class OWSaveBase(widget.OWWidget, openclass=True):
         """
         Compute absolute path from `stored_path` from settings.
 
-        Auto save is disabled unless stored_path is relative and exists.
+        Absolute stored path is used only if it exists.
+        Auto save is disabled unless stored_path is relative.
         """
         workflow_dir = self.workflowEnv().get("basedir")
         if os.path.isabs(self.stored_path):
-            path = self.stored_path
-            self.auto_save = False
+            if os.path.exists(self.stored_path):
+                self.auto_save = False
+                return self.stored_path
         elif workflow_dir:
-            path = os.path.join(workflow_dir, self.stored_path)
-        else:
-            path = None
+            return os.path.normpath(
+                os.path.join(workflow_dir, self.stored_path))
 
-        if path and os.path.exists(path):
-            return path
-        else:
-            self.stored_path = workflow_dir or _userhome
-            self.auto_save = False
-            return self.stored_path
+        self.stored_path = workflow_dir or _userhome
+        self.auto_save = False
+        return self.stored_path
 
     @property
     def filename(self):

{"Orange/widgets/utils/save/owsavebase.py": "import os.path\nimport sys\nimport re\n\nfrom AnyQt.QtWidgets import QFileDialog, QGridLayout, QMessageBox\n\nfrom Orange.widgets import gui, widget\nfrom Orange.widgets.settings import Setting\n\n\n_userhome = os.path.expanduser(f\"~{os.sep}\")\n\n\nclass OWSaveBase(widget.OWWidget, openclass=True):\n    \"\"\"\n    Base class for Save widgets\n\n    A derived class must provide, at minimum:\n\n    - class `Inputs` and the corresponding handler that:\n\n      - saves the input to an attribute `data`, and\n      - calls `self.on_new_input`.\n\n    - a class attribute `filters` with a list of filters or a dictionary whose\n      keys are filters OR a class method `get_filters` that returns such a\n      list or dictionary\n    - method `do_save` that saves `self.data` into `self.filename`\n\n    Alternatively, instead of defining `do_save` a derived class can make\n    `filters` a dictionary whose keys are classes that define a method `write`\n    (like e.g. `TabReader`). Method `do_save` defined in the base class calls\n    the writer corresponding to the currently chosen filter.\n\n    A minimum example of derived class is\n    `Orange.widgets.model.owsavemodel.OWSaveModel`.\n    A more advanced widget that overrides a lot of base class behaviour is\n    `Orange.widgets.data.owsave.OWSave`.\n    \"\"\"\n\n    class Information(widget.OWWidget.Information):\n        empty_input = widget.Msg(\"Empty input; nothing was saved.\")\n\n    class Error(widget.OWWidget.Error):\n        no_file_name = widget.Msg(\"File name is not set.\")\n        general_error = widget.Msg(\"{}\")\n\n    want_main_area = False\n    resizing_enabled = False\n\n    filter = Setting(\"\")  # Default is provided in __init__\n\n    # If the path is in the same directory as the workflow file or its\n    # subdirectory, it is stored as a relative path, otherwise as absolute.\n    # For the sake of security, we do not store relative paths from other\n    # directories, like home or cwd. After loading the widget from a schema,\n    # auto_save is set to off, unless the stored_path is relative (to the\n    # workflow).\n    stored_path = Setting(\"\")\n    stored_name = Setting(\"\", schema_only=True)  # File name, without path\n    auto_save = Setting(False)\n\n    filters = []\n\n    def __init__(self, start_row=0):\n        \"\"\"\n        Set up the gui.\n\n        The gui consists of a checkbox for auto save and two buttons put on a\n        grid layout. Derived widgets that want to place controls above the auto\n        save widget can set the `start_row` argument to the first free row,\n        and this constructor will start filling the grid there.\n\n        Args:\n            start_row (int): the row at which to start filling the gui\n        \"\"\"\n        super().__init__()\n        self.data = None\n        self._absolute_path = self._abs_path_from_setting()\n\n        # This cannot be done outside because `filters` is defined by subclass\n        if not self.filter:\n            self.filter = next(iter(self.get_filters()))\n\n        self.grid = grid = QGridLayout()\n        gui.widgetBox(self.controlArea, orientation=grid)\n        grid.addWidget(\n            gui.checkBox(\n                None, self, \"auto_save\", \"Autosave when receiving new data\",\n                callback=self.update_messages),\n            start_row, 0, 1, 2)\n        grid.setRowMinimumHeight(start_row + 1, 8)\n        self.bt_save = gui.button(\n            None, self,\n            label=f\"Save as {self.stored_name}\" if self.stored_name else \"Save\",\n            callback=self.save_file)\n        grid.addWidget(self.bt_save, start_row + 2, 0)\n        grid.addWidget(\n            gui.button(None, self, \"Save as ...\", callback=self.save_file_as),\n            start_row + 2, 1)\n\n        self.adjustSize()\n        self.update_messages()\n\n    @property\n    def last_dir(self):\n        # Not the best name, but kept for compatibility\n        return self._absolute_path\n\n    @last_dir.setter\n    def last_dir(self, absolute_path):\n        \"\"\"Store _absolute_path and update relative path (stored_path)\"\"\"\n        self._absolute_path = absolute_path\n\n        workflow_dir = self.workflowEnv().get(\"basedir\", None)\n        if workflow_dir and absolute_path.startswith(workflow_dir.rstrip(\"/\")):\n            self.stored_path = os.path.relpath(absolute_path, workflow_dir)\n        else:\n            self.stored_path = absolute_path\n\n    def _abs_path_from_setting(self):\n        \"\"\"\n        Compute absolute path from `stored_path` from settings.\n\n        Auto save is disabled unless stored_path is relative and exists.\n        \"\"\"\n        workflow_dir = self.workflowEnv().get(\"basedir\")\n        if os.path.isabs(self.stored_path):\n            path = self.stored_path\n            self.auto_save = False\n        elif workflow_dir:\n            path = os.path.join(workflow_dir, self.stored_path)\n        else:\n            path = None\n\n        if path and os.path.exists(path):\n            return path\n        else:\n            self.stored_path = workflow_dir or _userhome\n            self.auto_save = False\n            return self.stored_path\n\n    @property\n    def filename(self):\n        if self.stored_name:\n            return os.path.join(self._absolute_path, self.stored_name)\n        else:\n            return \"\"\n\n    @filename.setter\n    def filename(self, value):\n        self.last_dir, self.stored_name = os.path.split(value)\n\n    # pylint: disable=unused-argument\n    def workflowEnvChanged(self, key, value, oldvalue):\n        # Trigger refresh of relative path, e.g. when saving the scheme\n        if key == \"basedir\":\n            self.last_dir = self._absolute_path\n\n    @classmethod\n    def get_filters(cls):\n        return cls.filters\n\n    @property\n    def writer(self):\n        \"\"\"\n        Return the active writer\n\n        The base class uses this property only in `do_save` to find the writer\n        corresponding to the filter. Derived classes (e.g. OWSave) may also use\n        it elsewhere.\n        \"\"\"\n        return self.get_filters()[self.filter]\n\n    def on_new_input(self):\n        \"\"\"\n        This method must be called from input signal handler.\n\n        - It clears errors, warnings and information and calls\n          `self.update_messages` to set the as needed.\n        - It also calls `update_status` the can be overriden in derived\n          methods to set the status (e.g. the number of input rows)\n        - Calls `self.save_file` if `self.auto_save` is enabled and\n          `self.filename` is provided.\n        \"\"\"\n        self.Error.clear()\n        self.Warning.clear()\n        self.Information.clear()\n        self.update_messages()\n        self.update_status()\n        if self.auto_save and self.filename:\n            self.save_file()\n\n    def save_file_as(self):\n        \"\"\"\n        Ask the user for the filename and try saving the file\n        \"\"\"\n        filename, selected_filter = self.get_save_filename()\n        if not filename:\n            return\n        self.filename = filename\n        self.filter = selected_filter\n        self.bt_save.setText(f\"Save as {self.stored_name}\")\n        self.update_messages()\n        self._try_save()\n\n    def save_file(self):\n        \"\"\"\n        If file name is provided, try saving, else call save_file_as\n        \"\"\"\n        if not self.filename:\n            self.save_file_as()\n        else:\n            self._try_save()\n\n    def _try_save(self):\n        \"\"\"\n        Private method that calls do_save within try-except that catches and\n        shows IOError. Do nothing if not data or no file name.\n        \"\"\"\n        self.Error.general_error.clear()\n        if self.data is None or not self.filename:\n            return\n        try:\n            self.do_save()\n        except IOError as err_value:\n            self.Error.general_error(str(err_value))\n\n    def do_save(self):\n        \"\"\"\n        Do the saving.\n\n        Default implementation calls the write method of the writer\n        corresponding to the current filter. This requires that get_filters()\n        returns is a dictionary whose keys are classes.\n\n        Derived classes may simplify this by providing a list of filters and\n        override do_save. This is particularly handy if the widget supports only\n        a single format.\n        \"\"\"\n        # This method is separated out because it will usually be overriden\n        self.writer.write(self.filename, self.data)\n\n    def update_messages(self):\n        \"\"\"\n        Update errors, warnings and information.\n\n        Default method sets no_file_name if auto_save is enabled but file name\n        is not provided; and empty_input if file name is given but there is no\n        data.\n\n        Derived classes that define further messages will typically set them in\n        this method.\n        \"\"\"\n        self.Error.no_file_name(shown=not self.filename and self.auto_save)\n        self.Information.empty_input(shown=self.filename and self.data is None)\n\n    def update_status(self):\n        \"\"\"\n        Update the input/output indicator. Default method does nothing.\n        \"\"\"\n\n    def initial_start_dir(self):\n        \"\"\"\n        Provide initial start directory\n\n        Return either the current file's path, the last directory or home.\n        \"\"\"\n        if self.filename and os.path.exists(os.path.split(self.filename)[0]):\n            return self.filename\n        else:\n            return self.last_dir or _userhome\n\n    @staticmethod\n    def suggested_name():\n        \"\"\"\n        Suggest the name for the output file or return an empty string.\n        \"\"\"\n        return \"\"\n\n    @classmethod\n    def _replace_extension(cls, filename, extension):\n        \"\"\"\n        Remove all extensions that appear in any filter.\n\n        Double extensions are broken in different weird ways across all systems,\n        including omitting some, like turning iris.tab.gz to iris.gz. This\n        function removes anything that can appear anywhere.\n        \"\"\"\n        known_extensions = set()\n        for filt in cls.get_filters():\n            known_extensions |= set(cls._extension_from_filter(filt).split(\".\"))\n        if \"\" in known_extensions:\n            known_extensions.remove(\"\")\n        while True:\n            base, ext = os.path.splitext(filename)\n            if ext[1:] not in known_extensions:\n                break\n            filename = base\n        return filename + extension\n\n    @staticmethod\n    def _extension_from_filter(selected_filter):\n        return re.search(r\".*\\(\\*?(\\..*)\\)$\", selected_filter).group(1)\n\n    def valid_filters(self):\n        return self.get_filters()\n\n    def default_valid_filter(self):\n        return self.filter\n\n    @classmethod\n    def migrate_settings(cls, settings, version):\n        # We cannot use versions because they are overriden in derived classes\n        if \"last_dir\" in settings:\n            settings[\"stored_path\"] = settings.pop(\"last_dir\")\n        if \"filename\" in settings:\n            settings[\"stored_name\"] = os.path.split(\n                settings.pop(\"filename\") or \"\")[1]\n\n    # As of Qt 5.9, QFileDialog.setDefaultSuffix does not support double\n    # suffixes, not even in non-native dialogs. We handle each OS separately.\n    if sys.platform in (\"darwin\", \"win32\"):\n        # macOS and Windows native dialogs do not correctly handle double\n        # extensions. We thus don't pass any suffixes to the dialog and add\n        # the correct suffix after closing the dialog and only then check\n        # if the file exists and ask whether to override.\n        # It is a bit confusing that the user does not see the final name in the\n        # dialog, but I see no better solution.\n        def get_save_filename(self):  # pragma: no cover\n            if sys.platform == \"darwin\":\n                def remove_star(filt):\n                    return filt.replace(\" (*.\", \" (.\")\n            else:\n                def remove_star(filt):\n                    return filt\n\n            no_ext_filters = {remove_star(f): f for f in self.valid_filters()}\n            filename = self.initial_start_dir()\n            while True:\n                dlg = QFileDialog(\n                    None, \"Save File\", filename, \";;\".join(no_ext_filters))\n                dlg.setAcceptMode(dlg.AcceptSave)\n                dlg.selectNameFilter(remove_star(self.default_valid_filter()))\n                dlg.setOption(QFileDialog.DontConfirmOverwrite)\n                if dlg.exec() == QFileDialog.Rejected:\n                    return \"\", \"\"\n                filename = dlg.selectedFiles()[0]\n                selected_filter = no_ext_filters[dlg.selectedNameFilter()]\n                filename = self._replace_extension(\n                    filename, self._extension_from_filter(selected_filter))\n                if not os.path.exists(filename) or QMessageBox.question(\n                        self, \"Overwrite file?\",\n                        f\"File {os.path.split(filename)[1]} already exists.\\n\"\n                        \"Overwrite?\") == QMessageBox.Yes:\n                    return filename, selected_filter\n\n    else:  # Linux and any unknown platforms\n        # Qt does not use a native dialog on Linux, so we can connect to\n        # filterSelected and to overload selectFile to change the extension\n        # while the dialog is open.\n        # For unknown platforms (which?), we also use the non-native dialog to\n        # be sure we know what happens.\n        class SaveFileDialog(QFileDialog):\n            # pylint: disable=protected-access\n            def __init__(self, save_cls, *args, **kwargs):\n                super().__init__(*args, **kwargs)\n                self.save_cls = save_cls\n                self.suffix = \"\"\n                self.setAcceptMode(QFileDialog.AcceptSave)\n                self.setOption(QFileDialog.DontUseNativeDialog)\n                self.filterSelected.connect(self.updateDefaultExtension)\n\n            def selectNameFilter(self, selected_filter):\n                super().selectNameFilter(selected_filter)\n                self.updateDefaultExtension(selected_filter)\n\n            def updateDefaultExtension(self, selected_filter):\n                self.suffix = \\\n                    self.save_cls._extension_from_filter(selected_filter)\n                files = self.selectedFiles()\n                if files and not os.path.isdir(files[0]):\n                    self.selectFile(files[0])\n\n            def selectFile(self, filename):\n                filename = \\\n                    self.save_cls._replace_extension(filename, self.suffix)\n                super().selectFile(filename)\n\n        def get_save_filename(self):\n            dlg = self.SaveFileDialog(\n                type(self),\n                None, \"Save File\", self.initial_start_dir(),\n                \";;\".join(self.valid_filters()))\n            dlg.selectNameFilter(self.default_valid_filter())\n            if dlg.exec() == QFileDialog.Rejected:\n                return \"\", \"\"\n            else:\n                return dlg.selectedFiles()[0], dlg.selectedNameFilter()\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:** Auto Save Disabled Incorrectly When Stored Path Is Relative and Missing

**Description:**
When the `stored_path` is set to a relative path that does not exist, the widget incorrectly disables the `auto_save` feature. This causes issues when attempting to move workflows, as the widget fails to update the `last_dir` and `filename` properties appropriately.

**Example Buggy Code:**
```python
# Setup with a relative path that does not exist
widget = OWSaveBase(stored_path="a/d", stored_name="c.foo", auto_save=True)

# Attempt to load a moved workflow
widget.load_workflow()

# Expected last_dir to be updated to "/home/u/orange/a/d"
# Instead, it remains as "/home/u/orange"
```

**Expected Behavior:**
The `auto_save` feature should remain enabled as long as the `stored_path` is relative, regardless of whether the path currently exists. When a workflow is moved, the `last_dir` and `filename` should correctly update to reflect the new location of the relative path.

**Actual Behavior:**
If the `stored_path` is relative and does not exist, `auto_save` is disabled. Consequently, when loading a moved workflow, the `last_dir` does not update to the expected new path (`"/home/u/orange/a/d"`) but instead remains at the base directory (`"/home/u/orange"`), preventing proper workflow management.

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

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

--- BEGIN FILE ---
```
### Orange/widgets/utils/save/owsavebase.py
import os.path
import sys
import re

from AnyQt.QtWidgets import QFileDialog, QGridLayout, QMessageBox

from Orange.widgets import gui, widget
from Orange.widgets.settings import Setting


_userhome = os.path.expanduser(f"~{os.sep}")


class OWSaveBase(widget.OWWidget, openclass=True):
    """
    Base class for Save widgets

    A derived class must provide, at minimum:

    - class `Inputs` and the corresponding handler that:

      - saves the input to an attribute `data`, and
      - calls `self.on_new_input`.

    - a class attribute `filters` with a list of filters or a dictionary whose
      keys are filters OR a class method `get_filters` that returns such a
      list or dictionary
    - method `do_save` that saves `self.data` into `self.filename`

    Alternatively, instead of defining `do_save` a derived class can make
    `filters` a dictionary whose keys are classes that define a method `write`
    (like e.g. `TabReader`). Method `do_save` defined in the base class calls
    the writer corresponding to the currently chosen filter.

    A minimum example of derived class is
    `Orange.widgets.model.owsavemodel.OWSaveModel`.
    A more advanced widget that overrides a lot of base class behaviour is
    `Orange.widgets.data.owsave.OWSave`.
    """

    class Information(widget.OWWidget.Information):
        empty_input = widget.Msg("Empty input; nothing was saved.")

    class Error(widget.OWWidget.Error):
        no_file_name = widget.Msg("File name is not set.")
        general_error = widget.Msg("{}")

    want_main_area = False
    resizing_enabled = False

    filter = Setting("")  # Default is provided in __init__

    # If the path is in the same directory as the workflow file or its
    # subdirectory, it is stored as a relative path, otherwise as absolute.
    # For the sake of security, we do not store relative paths from other
    # directories, like home or cwd. After loading the widget from a schema,
    # auto_save is set to off, unless the stored_path is relative (to the
    # workflow).
    stored_path = Setting("")
    stored_name = Setting("", schema_only=True)  # File name, without path
    auto_save = Setting(False)

    filters = []

    def __init__(self, start_row=0):
        """
        Set up the gui.

        The gui consists of a checkbox for auto save and two buttons put on a
        grid layout. Derived widgets that want to place controls above the auto
        save widget can set the `start_row` argument to the first free row,
        and this constructor will start filling the grid there.

        Args:
            start_row (int): the row at which to start filling the gui
        """
        super().__init__()
        self.data = None
        self._absolute_path = self._abs_path_from_setting()

        # This cannot be done outside because `filters` is defined by subclass
        if not self.filter:
            self.filter = next(iter(self.get_filters()))

        self.grid = grid = QGridLayout()
        gui.widgetBox(self.controlArea, orientation=grid)
        grid.addWidget(
            gui.checkBox(
                None, self, "auto_save", "Autosave when receiving new data",
                callback=self.update_messages),
            start_row, 0, 1, 2)
        grid.setRowMinimumHeight(start_row + 1, 8)
        self.bt_save = gui.button(
            None, self,
            label=f"Save as {self.stored_name}" if self.stored_name else "Save",
            callback=self.save_file)
        grid.addWidget(self.bt_save, start_row + 2, 0)
        grid.addWidget(
            gui.button(None, self, "Save as ...", callback=self.save_file_as),
            start_row + 2, 1)

        self.adjustSize()
        self.update_messages()

    @property
    def last_dir(self):
        # Not the best name, but kept for compatibility
        return self._absolute_path

    @last_dir.setter
    def last_dir(self, absolute_path):
        """Store _absolute_path and update relative path (stored_path)"""
        self._absolute_path = absolute_path

        workflow_dir = self.workflowEnv().get("basedir", None)
        if workflow_dir and absolute_path.startswith(workflow_dir.rstrip("/")):
            self.stored_path = os.path.relpath(absolute_path, workflow_dir)
        else:
            self.stored_path = absolute_path

    def _abs_path_from_setting(self):
        """
        Compute absolute path from `stored_path` from settings.

        Auto save is disabled unless stored_path is relative and exists.
        """
        workflow_dir = self.workflowEnv().get("basedir")
        if os.path.isabs(self.stored_path):
            path = self.stored_path
            self.auto_save = False
        elif workflow_dir:
            path = os.path.join(workflow_dir, self.stored_path)
        else:
            path = None

        if path and os.path.exists(path):
            return path
        else:
            self.stored_path = workflow_dir or _userhome
            self.auto_save = False
            return self.stored_path

    @property
    def filename(self):
        if self.stored_name:
            return os.path.join(self._absolute_path, self.stored_name)
        else:
            return ""

    @filename.setter
    def filename(self, value):
        self.last_dir, self.stored_name = os.path.split(value)

    # pylint: disable=unused-argument
    def workflowEnvChanged(self, key, value, oldvalue):
        # Trigger refresh of relative path, e.g. when saving the scheme
        if key == "basedir":
            self.last_dir = self._absolute_path

    @classmethod
    def get_filters(cls):
        return cls.filters

    @property
    def writer(self):
        """
        Return the active writer

        The base class uses this property only in `do_save` to find the writer
        corresponding to the filter. Derived classes (e.g. OWSave) may also use
        it elsewhere.
        """
        return self.get_filters()[self.filter]

    def on_new_input(self):
        """
        This method must be called from input signal handler.

        - It clears errors, warnings and information and calls
          `self.update_messages` to set the as needed.
        - It also calls `update_status` the can be overriden in derived
          methods to set the status (e.g. the number of input rows)
        - Calls `self.save_file` if `self.auto_save` is enabled and
          `self.filename` is provided.
        """
        self.Error.clear()
        self.Warning.clear()
        self.Information.clear()
        self.update_messages()
        self.update_status()
        if self.auto_save and self.filename:
            self.save_file()

    def save_file_as(self):
        """
        Ask the user for the filename and try saving the file
        """
        filename, selected_filter = self.get_save_filename()
        if not filename:
            return
        self.filename = filename
        self.filter = selected_filter
        self.bt_save.setText(f"Save as {self.stored_name}")
        self.update_messages()
        self._try_save()

    def save_file(self):
        """
        If file name is provided, try saving, else call save_file_as
        """
        if not self.filename:
            self.save_file_as()
        else:
            self._try_save()

    def _try_save(self):
        """
        Private method that calls do_save within try-except that catches and
        shows IOError. Do nothing if not data or no file name.
        """
        self.Error.general_error.clear()
        if self.data is None or not self.filename:
            return
        try:
            self.do_save()
        except IOError as err_value:
            self.Error.general_error(str(err_value))

    def do_save(self):
        """
        Do the saving.

        Default implementation calls the write method of the writer
        corresponding to the current filter. This requires that get_filters()
        returns is a dictionary whose keys are classes.

        Derived classes may simplify this by providing a list of filters and
        override do_save. This is particularly handy if the widget supports only
        a single format.
        """
        # This method is separated out because it will usually be overriden
        self.writer.write(self.filename, self.data)

    def update_messages(self):
        """
        Update errors, warnings and information.

        Default method sets no_file_name if auto_save is enabled but file name
        is not provided; and empty_input if file name is given but there is no
        data.

        Derived classes that define further messages will typically set them in
        this method.
        """
        self.Error.no_file_name(shown=not self.filename and self.auto_save)
        self.Information.empty_input(shown=self.filename and self.data is None)

    def update_status(self):
        """
        Update the input/output indicator. Default method does nothing.
        """

    def initial_start_dir(self):
        """
        Provide initial start directory

        Return either the current file's path, the last directory or home.
        """
        if self.filename and os.path.exists(os.path.split(self.filename)[0]):
            return self.filename
        else:
            return self.last_dir or _userhome

    @staticmethod
    def suggested_name():
        """
        Suggest the name for the output file or return an empty string.
        """
        return ""

    @classmethod
    def _replace_extension(cls, filename, extension):
        """
        Remove all extensions that appear in any filter.

        Double extensions are broken in different weird ways across all systems,
        including omitting some, like turning iris.tab.gz to iris.gz. This
        function removes anything that can appear anywhere.
        """
        known_extensions = set()
        for filt in cls.get_filters():
            known_extensions |= set(cls._extension_from_filter(filt).split("."))
        if "" in known_extensions:
            known_extensions.remove("")
        while True:
            base, ext = os.path.splitext(filename)
            if ext[1:] not in known_extensions:
                break
            filename = base
        return filename + extension

    @staticmethod
    def _extension_from_filter(selected_filter):
        return re.search(r".*\(\*?(\..*)\)$", selected_filter).group(1)

    def valid_filters(self):
        return self.get_filters()

    def default_valid_filter(self):
        return self.filter

    @classmethod
    def migrate_settings(cls, settings, version):
        # We cannot use versions because they are overriden in derived classes
        if "last_dir" in settings:
            settings["stored_path"] = settings.pop("last_dir")
        if "filename" in settings:
            settings["stored_name"] = os.path.split(
                settings.pop("filename") or "")[1]

    # As of Qt 5.9, QFileDialog.setDefaultSuffix does not support double
    # suffixes, not even in non-native dialogs. We handle each OS separately.
    if sys.platform in ("darwin", "win32"):
        # macOS and Windows native dialogs do not correctly handle double
        # extensions. We thus don't pass any suffixes to the dialog and add
        # the correct suffix after closing the dialog and only then check
        # if the file exists and ask whether to override.
        # It is a bit confusing that the user does not see the final name in the
        # dialog, but I see no better solution.
        def get_save_filename(self):  # pragma: no cover
            if sys.platform == "darwin":
                def remove_star(filt):
                    return filt.replace(" (*.", " (.")
            else:
                def remove_star(filt):
                    return filt

            no_ext_filters = {remove_star(f): f for f in self.valid_filters()}
            filename = self.initial_start_dir()
            while True:
                dlg = QFileDialog(
                    None, "Save File", filename, ";;".join(no_ext_filters))
                dlg.setAcceptMode(dlg.AcceptSave)
                dlg.selectNameFilter(remove_star(self.default_valid_filter()))
                dlg.setOption(QFileDialog.DontConfirmOverwrite)
                if dlg.exec() == QFileDialog.Rejected:
                    return "", ""
                filename = dlg.selectedFiles()[0]
                selected_filter = no_ext_filters[dlg.selectedNameFilter()]
                filename = self._replace_extension(
                    filename, self._extension_from_filter(selected_filter))
                if not os.path.exists(filename) or QMessageBox.question(
                        self, "Overwrite file?",
                        f"File {os.path.split(filename)[1]} already exists.\n"
                        "Overwrite?") == QMessageBox.Yes:
                    return filename, selected_filter

    else:  # Linux and any unknown platforms
        # Qt does not use a native dialog on Linux, so we can connect to
        # filterSelected and to overload selectFile to change the extension
        # while the dialog is open.
        # For unknown platforms (which?), we also use the non-native dialog to
        # be sure we know what happens.
        class SaveFileDialog(QFileDialog):
            # pylint: disable=protected-access
            def __init__(self, save_cls, *args, **kwargs):
                super().__init__(*args, **kwargs)
                self.save_cls = save_cls
                self.suffix = ""
                self.setAcceptMode(QFileDialog.AcceptSave)
                self.setOption(QFileDialog.DontUseNativeDialog)
                self.filterSelected.connect(self.updateDefaultExtension)

            def selectNameFilter(self, selected_filter):
                super().selectNameFilter(selected_filter)
                self.updateDefaultExtension(selected_filter)

            def updateDefaultExtension(self, selected_filter):
                self.suffix = \
                    self.save_cls._extension_from_filter(selected_filter)
                files = self.selectedFiles()
                if files and not os.path.isdir(files[0]):
                    self.selectFile(files[0])

            def selectFile(self, filename):
                filename = \
                    self.save_cls._replace_extension(filename, self.suffix)
                super().selectFile(filename)

        def get_save_filename(self):
            dlg = self.SaveFileDialog(
                type(self),
                None, "Save File", self.initial_start_dir(),
                ";;".join(self.valid_filters()))
            dlg.selectNameFilter(self.default_valid_filter())
            if dlg.exec() == QFileDialog.Rejected:
                return "", ""
            else:
                return dlg.selectedFiles()[0], dlg.selectedNameFilter()

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