From 98ce2a2c2996dd938892de10c16efed8f2a01081 Mon Sep 17 00:00:00 2001 From: Lint Action <95386651+weee-open-bot@users.noreply.github.com> Date: Wed, 23 Oct 2024 22:40:45 +0000 Subject: [PATCH] Fix code style issues with Black --- basilico.py | 2 +- constants.py | 2 +- pinolo.py | 14 ++++---------- ui/SelectSystemDialog.py | 1 + widgets/NetworkSettings.py | 11 ++++------- widgets/SelectSystem.py | 18 ++++++------------ 6 files changed, 17 insertions(+), 31 deletions(-) diff --git a/basilico.py b/basilico.py index 23b143a..6dddbbd 100755 --- a/basilico.py +++ b/basilico.py @@ -778,7 +778,7 @@ def sudo_password(self, _cmd: str, password: str): result = subprocess.run( ["sudo", "-vS"], - input=password+"\n", + input=password + "\n", encoding="utf-8", stderr=subprocess.PIPE, stdout=subprocess.PIPE, diff --git a/constants.py b/constants.py index aef277c..f02a885 100644 --- a/constants.py +++ b/constants.py @@ -61,7 +61,7 @@ # BASILICO -#TODO +# TODO # GENERIC VERSION = "2.0.0" diff --git a/pinolo.py b/pinolo.py index e534df9..ac6e1ef 100644 --- a/pinolo.py +++ b/pinolo.py @@ -114,7 +114,7 @@ def setup(self): self.actionSourceCode.triggered.connect(self.open_source_code) self.actionAboutUs.triggered.connect(self.open_website) self.actionVersion.triggered.connect(self.show_version) - + def start_client(self): """This method must be called in __init__ function of Ui class to initialize pinolo session""" @@ -516,10 +516,7 @@ def load_system(self, std=False, drives=None): if self.default_system_path: directory = self.default_system_path.rsplit("/", 1)[0] + "/" else: - critical_dialog( - "There is no default image set in Pinolo settings.", - dialog_type="ok" - ) + critical_dialog("There is no default image set in Pinolo settings.", dialog_type="ok") return if drives_qty == 0: if not std: @@ -801,7 +798,7 @@ def resize_queue_table_to_contents(self): def _send_sudo_password(self, password: str): # password = password.replace('\\', '\\\\').replace(" ", "\\ ") - self.client.send(f'sudo_password {password}') + self.client.send(f"sudo_password {password}") def gui_update(self, cmd: str, params: str): """ @@ -943,10 +940,7 @@ def gui_update(self, cmd: str, params: str): self._send_sudo_password(passwd) else: warning_dialog( - "You did not enter the root password.\n" - "Some commands may not work correctly.\n" - "Refresh to insert the password.", - dialog_type="ok" + "You did not enter the root password.\n" "Some commands may not work correctly.\n" "Refresh to insert the password.", dialog_type="ok" ) self.check_disk_usage() diff --git a/ui/SelectSystemDialog.py b/ui/SelectSystemDialog.py index 29cc866..eb67fa9 100644 --- a/ui/SelectSystemDialog.py +++ b/ui/SelectSystemDialog.py @@ -46,6 +46,7 @@ def retranslateUi(self, SelectSystemDialog): if __name__ == "__main__": import sys + app = QtWidgets.QApplication(sys.argv) SelectSystemDialog = QtWidgets.QDialog() ui = Ui_SelectSystemDialog() diff --git a/widgets/NetworkSettings.py b/widgets/NetworkSettings.py index f44afeb..d730c6b 100644 --- a/widgets/NetworkSettings.py +++ b/widgets/NetworkSettings.py @@ -184,17 +184,14 @@ def load_completer(self): def find_image(self): """ - This function opens a different dialog if - the user is in local or remote mode to search for a cannolo image. + This function opens a different dialog if + the user is in local or remote mode to search for a cannolo image. """ if self.parent.serverMode == REMOTE_MODE: directory = self.defaultSystemLineEdit.text() - if directory == '': - warning_dialog( - "Il path per l'immagine di sistema di default è vuoto. Impostalo plz.", - dialog_type="ok" - ) + if directory == "": + warning_dialog("Il path per l'immagine di sistema di default è vuoto. Impostalo plz.", dialog_type="ok") return splitted_dir = directory.rsplit("/", 1) if len(splitted_dir[1].split(".")) > 1: diff --git a/widgets/SelectSystem.py b/widgets/SelectSystem.py index 836252d..24d9ccf 100644 --- a/widgets/SelectSystem.py +++ b/widgets/SelectSystem.py @@ -8,15 +8,9 @@ from pinolo import PinoloMainWindow from widgets.NetworkSettings import NetworkSettings + class SelectSystemDialog(QDialog, Ui_SelectSystemDialog): - def __init__( - self, - parent: QObject, - is_load_system: bool, - path: str, - images: list = None, - network_settings_dialog: 'NetworkSettings' = None - ): + def __init__(self, parent: QObject, is_load_system: bool, path: str, images: list = None, network_settings_dialog: "NetworkSettings" = None): super(SelectSystemDialog, self).__init__(parent) self.setupUi(self) @@ -47,7 +41,7 @@ def ask_for_image(self, images: list): def select(self): """ - Selected iso from isoList is set as default system path in network settings. + Selected iso from isoList is set as default system path in network settings. """ if self.isoList.currentItem() is None: @@ -58,12 +52,12 @@ def select(self): for iso_dir in self.images: if iso in iso_dir: if self.is_load_system: - pinolo: 'PinoloMainWindow' = self.parent() + pinolo: "PinoloMainWindow" = self.parent() pinolo.load_selected_system(iso_dir, iso) break else: - network_settings: 'NetworkSettings' = self.parent() + network_settings: "NetworkSettings" = self.parent() network_settings.defaultSystemLineEdit.setText(iso_dir) break - self.close() \ No newline at end of file + self.close()