diff --git a/Orange/widgets/data/owfile.py b/Orange/widgets/data/owfile.py index 67b46a3a32b..4a33416efe5 100644 --- a/Orange/widgets/data/owfile.py +++ b/Orange/widgets/data/owfile.py @@ -10,7 +10,6 @@ from AnyQt.QtCore import Qt, QTimer, QSize from Orange.canvas.gui.utils import OSX_NSURL_toLocalFile -from Orange.data import StringVariable from Orange.data.table import Table, get_sample_datasets_dir from Orange.data.io import FileFormat, UrlReader, class_from_qualified_name from Orange.widgets import widget, gui @@ -18,7 +17,7 @@ PerfectDomainContextHandler, SettingProvider from Orange.widgets.utils.domaineditor import DomainEditor from Orange.widgets.utils.itemmodels import PyListModel -from Orange.widgets.utils.filedialogs import RecentPathsWComboMixin, dialog_formats, \ +from Orange.widgets.utils.filedialogs import RecentPathsWComboMixin, \ open_filename_dialog from Orange.widgets.widget import Output @@ -41,7 +40,7 @@ def add_origin(examples, filename): return vars = examples.domain.variables + examples.domain.metas strings = [var for var in vars if var.is_string] - dir_name, basename = os.path.split(filename) + dir_name, _ = os.path.split(filename) for var in strings: if "type" in var.attributes and "origin" not in var.attributes: var.attributes["origin"] = dir_name diff --git a/Orange/widgets/utils/filedialogs.py b/Orange/widgets/utils/filedialogs.py index 44b2303132f..63279693616 100644 --- a/Orange/widgets/utils/filedialogs.py +++ b/Orange/widgets/utils/filedialogs.py @@ -235,8 +235,6 @@ def search(self, searchpaths): path = os.path.join(base, self.relpath) if os.path.exists(path): return os.path.normpath(path) - else: - return None def resolve(self, searchpaths): if self.prefix is None and os.path.exists(self.abspath): @@ -371,7 +369,7 @@ def select_file(self, n): def last_path(self): """Return the most recent absolute path or `None` if there is none""" - return self.recent_paths and self.recent_paths[0].abspath or None + return self.recent_paths[0].abspath if self.recent_paths else None class RecentPathsWComboMixin(RecentPathsWidgetMixin):