From 420946d7d435983e86af81fe5500891070acbcec Mon Sep 17 00:00:00 2001 From: coderkun Date: Sun, 3 Nov 2024 10:42:29 +0100 Subject: [PATCH] Declare static methods with annotation (see #103) --- src/client.py | 1 + src/utils.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/client.py b/src/client.py index 81dbc42..79c5eec 100644 --- a/src/client.py +++ b/src/client.py @@ -1035,6 +1035,7 @@ class MCGAlbum: return False return True + @staticmethod def compare(album1, album2, criterion=None, reverse=False): if criterion == None: criterion = SortOrder.TITLE diff --git a/src/utils.py b/src/utils.py index 1a9e6e7..ed8a04f 100644 --- a/src/utils.py +++ b/src/utils.py @@ -13,6 +13,7 @@ class Utils: CSS_SELECTION = 'selection' STOCK_ICON_DEFAULT = 'image-x-generic-symbolic' + @staticmethod def load_pixbuf(data): loader = GdkPixbuf.PixbufLoader() try: @@ -21,6 +22,7 @@ class Utils: loader.close() return loader.get_pixbuf() + @staticmethod def load_thumbnail(cache, client, album, size): cache_url = cache.create_filename(album) pixbuf = None @@ -38,6 +40,7 @@ class Utils: pixbuf.savev(cache_url, 'jpeg', [], []) return pixbuf + @staticmethod def create_artists_label(album): label = ', '.join(album.get_albumartists()) if album.get_artists(): @@ -45,12 +48,14 @@ class Utils: label, ", ".join(album.get_artists())) return label + @staticmethod def create_length_label(album): minutes = album.get_length() // 60 seconds = album.get_length() - minutes * 60 return locale.gettext("{}:{} minutes").format(minutes, seconds) + @staticmethod def create_track_title(track): title = track.get_title() if track.get_artists(): @@ -58,6 +63,7 @@ class Utils: title, ", ".join(track.get_artists())) return title + @staticmethod def generate_id(values): if type(values) is not list: values = [values]