From a1709e92aedcfa78df05ac62373df35860238cbf Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Sun, 22 Dec 2024 15:23:22 +0000 Subject: [PATCH] Misc tidying --- app/helpers.py | 16 ---------------- app/models.py | 9 ++++----- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/app/helpers.py b/app/helpers.py index a250a23..4e94a98 100644 --- a/app/helpers.py +++ b/app/helpers.py @@ -404,22 +404,6 @@ def show_warning(parent: Optional[QMainWindow], title: str, msg: str) -> None: QMessageBox.warning(parent, title, msg, buttons=QMessageBox.StandardButton.Cancel) -def singleton(cls): - """ - Make a class a Singleton class (see - https://realpython.com/primer-on-python-decorators/#creating-singletons) - """ - - @functools.wraps(cls) - def wrapper_singleton(*args, **kwargs): - if not wrapper_singleton.instance: - wrapper_singleton.instance = cls(*args, **kwargs) - return wrapper_singleton.instance - - wrapper_singleton.instance = None - return wrapper_singleton - - def trailing_silence( audio_segment: AudioSegment, silence_threshold: int = -50, diff --git a/app/models.py b/app/models.py index dc8e731..1d5f7ea 100644 --- a/app/models.py +++ b/app/models.py @@ -72,7 +72,9 @@ class NoteColours(dbtables.NoteColoursTable): return result @staticmethod - def get_colour(session: Session, text: str, foreground: bool = False) -> Optional[str]: + def get_colour( + session: Session, text: str, foreground: bool = False + ) -> Optional[str]: """ Parse text and return background (foreground if foreground==True) colour string if matched, else None @@ -245,10 +247,7 @@ class Playlists(dbtables.PlaylistsTable): return session.scalars( select(cls) - .where( - cls.is_template.is_(True), - cls.deleted.is_not(True) - ) + .where(cls.is_template.is_(True), cls.deleted.is_not(True)) .order_by(cls.name) ).all()