From 4948a4a8b6e8485ca9263ad28a14611b66febf8e Mon Sep 17 00:00:00 2001 From: Kinsteen Date: Tue, 25 Apr 2023 19:35:00 +0200 Subject: [PATCH] Linting --- bottles/frontend/views/bottle_dependencies.py | 10 ++++---- bottles/frontend/widgets/dependency.py | 25 ++++++++++--------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/bottles/frontend/views/bottle_dependencies.py b/bottles/frontend/views/bottle_dependencies.py index fdf6cd8116..9b51fe24d2 100644 --- a/bottles/frontend/views/bottle_dependencies.py +++ b/bottles/frontend/views/bottle_dependencies.py @@ -28,9 +28,9 @@ from bottles.frontend.widgets.dependency import DependencyEntry -@Gtk.Template(resource_path='/com/usebottles/bottles/details-dependencies.ui') +@Gtk.Template(resource_path="/com/usebottles/bottles/details-dependencies.ui") class DependenciesView(Adw.Bin): - __gtype_name__ = 'DetailsDependencies' + __gtype_name__ = "DetailsDependencies" __registry = [] # region Widgets @@ -89,7 +89,7 @@ def empty_list(self): r.get_parent().remove(r) self.__registry = [] - def update(self, widget=False, config: Optional[BottleConfig] = None): + def update(self, _widget=False, config: Optional[BottleConfig] = None): """ This function update the dependencies list with the supported by the manager. @@ -99,7 +99,7 @@ def update(self, widget=False, config: Optional[BottleConfig] = None): self.config = config # Not sure if it's the best place to make this check - if self.manager.utils_conn.status == False: + if not self.manager.utils_conn.status: return self.stack.set_visible_child_name("page_loading") @@ -115,7 +115,7 @@ def new_dependency(dependency, plain=False): self.list_dependencies.append(entry) @GtkUtils.run_in_main_loop - def callback(result, error=False): + def callback(_result, _error=False): self.stack.set_visible_child_name("page_deps") def process_dependencies(): diff --git a/bottles/frontend/widgets/dependency.py b/bottles/frontend/widgets/dependency.py index e137925861..4d347f7cf7 100644 --- a/bottles/frontend/widgets/dependency.py +++ b/bottles/frontend/widgets/dependency.py @@ -28,9 +28,9 @@ from bottles.frontend.windows.generic import SourceDialog -@Gtk.Template(resource_path='/com/usebottles/bottles/dependency-entry.ui') +@Gtk.Template(resource_path="/com/usebottles/bottles/dependency-entry.ui") class DependencyEntry(Adw.ActionRow): - __gtype_name__ = 'DependencyEntry' + __gtype_name__ = "DependencyEntry" # region Widgets label_category = Gtk.Template.Child() @@ -56,10 +56,10 @@ def __init__(self, window, config: BottleConfig, dependency, plain=False, **kwar self.queue = window.page_details.queue if plain: - ''' + """ If the dependency is plain, treat it as a placeholder, it can be used to display "fake" elements on the list - ''' + """ self.set_title(dependency) self.set_subtitle("") self.btn_install.set_visible(False) @@ -87,24 +87,24 @@ def __init__(self, window, config: BottleConfig, dependency, plain=False, **kwar self.btn_license.connect("clicked", self.open_license) if dependency[0] in self.config.Installed_Dependencies: - ''' + """ If the dependency is installed, hide the btn_install button and show the btn_remove button - ''' + """ self.btn_install.set_visible(False) self.btn_remove.set_visible(True) self.btn_reinstall.set_visible(True) if dependency[0] in self.config.Uninstallers.keys(): - ''' + """ If the dependency has no uninstaller, disable the btn_remove button - ''' + """ uninstaller = self.config.Uninstallers[dependency[0]] if uninstaller in [False, "NO_UNINSTALLER"]: self.btn_remove.set_sensitive(False) - def open_manifest(self, widget): + def open_manifest(self, _widget): """ This function pop up a dialog with the manifest of the dependency @@ -118,7 +118,7 @@ def open_manifest(self, widget): ) ).present() - def open_license(self, widget): + def open_license(self, _widget): """ This function pop up a dialog with the license of the dependency @@ -128,7 +128,7 @@ def open_license(self, widget): ) webbrowser.open(manifest["License_url"]) - def install_dependency(self, widget): + def install_dependency(self, _widget): """ This function install the dependency in the bottle, it will also prevent user from installing other dependencies @@ -179,7 +179,8 @@ def set_install_status(self, result: Result, error=None): self.window.show_toast(_("\"{0}\" uninstalled").format(self.dependency[0])) else: self.window.show_toast(_("\"{0}\" installed").format(self.dependency[0])) - return self.set_installed(uninstaller, removed) + self.set_installed(uninstaller, removed) + return self.set_err() def set_err(self):