From 4e73ea6e6a2fe9b6a7e65ed56d74e2adcffeeb7a Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Wed, 5 Feb 2025 17:46:16 +0000 Subject: [PATCH] Black formatting --- app/file_importer.py | 22 +++++++++++++++------- app/musicmuster.py | 17 ++++++++--------- app/playlists.py | 8 ++++---- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/app/file_importer.py b/app/file_importer.py index 9c4f406..d58f433 100644 --- a/app/file_importer.py +++ b/app/file_importer.py @@ -176,7 +176,9 @@ class FileImporter: ] # Start the import if necessary - log.debug(f"Import files prepared: {[a.source_path for a in self.import_files_data]}") + log.debug( + f"Import files prepared: {[a.source_path for a in self.import_files_data]}" + ) self._import_next_file() def populate_trackfiledata(self, path: str) -> TrackFileData: @@ -454,7 +456,7 @@ class FileImporter: directory=Config.IMPORT_DESTINATION, ) if pathspec: - if pathspec == '': + if pathspec == "": # User cancelled tfd.error = "You did not select a location to save this track" return False @@ -516,7 +518,9 @@ class FileImporter: log.debug( f"remaining files: {[a.source_path for a in self.import_files_data]}" ) - self.signals.status_message_signal.emit(f"Importing {filename}", 10000) + self.signals.status_message_signal.emit( + f"Importing {filename}", 10000 + ) self._start_import(tfd) except IndexError: log.debug("import_next_file: no files remaining in queue") @@ -535,13 +539,17 @@ class FileImporter: tags=tfd.tags, destination_path=tfd.destination_path, track_id=tfd.track_id, - file_path_to_remove=tfd.file_path_to_remove + file_path_to_remove=tfd.file_path_to_remove, ) log.debug(f"{self.workers[tfd.source_path]=} created") - self.workers[tfd.source_path].import_finished.connect(self.post_import_processing) + self.workers[tfd.source_path].import_finished.connect( + self.post_import_processing + ) self.workers[tfd.source_path].finished.connect(lambda: self.cleanup_thread(tfd)) - self.workers[tfd.source_path].finished.connect(self.workers[tfd.source_path].deleteLater) + self.workers[tfd.source_path].finished.connect( + self.workers[tfd.source_path].deleteLater + ) self.workers[tfd.source_path].start() @@ -589,7 +597,7 @@ class DoTrackImport(QThread): tags: Tags, destination_path: str, track_id: int, - file_path_to_remove: Optional[str] = None + file_path_to_remove: Optional[str] = None, ) -> None: """ Save parameters diff --git a/app/musicmuster.py b/app/musicmuster.py index ffe41e9..1b661e2 100755 --- a/app/musicmuster.py +++ b/app/musicmuster.py @@ -630,7 +630,9 @@ class Window(QMainWindow, Ui_MainWindow): self.signals.search_songfacts_signal.connect(self.open_songfacts_browser) self.signals.search_wikipedia_signal.connect(self.open_wikipedia_browser) - def create_playlist(self, session: Session, playlist_name: str) -> Optional[Playlists]: + def create_playlist( + self, session: Session, playlist_name: str + ) -> Optional[Playlists]: """Create new playlist""" log.debug(f"create_playlist({playlist_name=}") @@ -856,10 +858,7 @@ class Window(QMainWindow, Ui_MainWindow): # We need to keep a reference to the FileImporter else it will be # garbage collected while import threads are still running - self.importer = FileImporter( - self.current.base_model, - self.current_row_or_end() - ) + self.importer = FileImporter(self.current.base_model, self.current_row_or_end()) self.importer.start() def insert_header(self) -> None: @@ -973,7 +972,9 @@ class Window(QMainWindow, Ui_MainWindow): playlist.delete(session) session.commit() else: - raise ApplicationError(f"Unrecognised action from EditDeleteDialog: {action=}") + raise ApplicationError( + f"Unrecognised action from EditDeleteDialog: {action=}" + ) def mark_rows_for_moving(self) -> None: """ @@ -1464,9 +1465,7 @@ class Window(QMainWindow, Ui_MainWindow): helpers.show_warning( self, "Duplicate template", "Template name already in use" ) - Playlists.save_as_template( - session, self.current.playlist_id, template_name - ) + Playlists.save_as_template(session, self.current.playlist_id, template_name) session.commit() helpers.show_OK("Template", "Template saved", self) diff --git a/app/playlists.py b/app/playlists.py index d994e6f..5c72ab8 100644 --- a/app/playlists.py +++ b/app/playlists.py @@ -213,10 +213,10 @@ class PlaylistDelegate(QStyledItemDelegate): doc.setTextWidth(option.rect.width()) doc.setDefaultFont(option.font) doc.setDocumentMargin(Config.ROW_PADDING) - if '\n' in option.text: - txt = option.text.replace('\n', '
') - elif '\u2028' in option.text: - txt = option.text.replace('\u2028', '
') + if "\n" in option.text: + txt = option.text.replace("\n", "
") + elif "\u2028" in option.text: + txt = option.text.replace("\u2028", "
") else: txt = option.text doc.setHtml(txt)