[gnome-music/wip/jfelder/artstack-type-hint: 1/2] artstack: Add missing type hint in the constructor




commit 7e2c3fa4c9c4517a3ef9f0a0505c8906a4a57c74
Author: Jean Felder <jfelder src gnome org>
Date:   Sun Dec 12 14:31:31 2021 +0100

    artstack: Add missing type hint in the constructor

 gnomemusic/widgets/artstack.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/gnomemusic/widgets/artstack.py b/gnomemusic/widgets/artstack.py
index d0a72e504..c69fa0607 100644
--- a/gnomemusic/widgets/artstack.py
+++ b/gnomemusic/widgets/artstack.py
@@ -22,12 +22,23 @@
 # code, but you are not obligated to do so.  If you do not wish to do so,
 # delete this exception statement from your version.
 
+from typing import Optional, Union
+import typing
+
 from gi.repository import GObject, Gtk
 
 from gnomemusic.asyncqueue import AsyncQueue
 from gnomemusic.artcache import ArtCache
 from gnomemusic.defaulticon import DefaultIcon
 from gnomemusic.utils import ArtSize
+if typing.TYPE_CHECKING:
+    from gnomemusic.corealbum import CoreAlbum
+    from gnomemusic.coreartist import CoreArtist
+    from gnomemusic.coresong import CoreSong
+
+
+if typing.TYPE_CHECKING:
+    CoreObject = Union[CoreAlbum, CoreArtist, CoreSong]
 
 
 class ArtStack(Gtk.Stack):
@@ -51,7 +62,7 @@ class ArtStack(Gtk.Stack):
 
         self._art_type = DefaultIcon.Type.ALBUM
         self._cache = ArtCache()
-        self._coreobject = None
+        self._coreobject: Optional[CoreObject] = None
         self._handler_id = 0
         self._size = size
         self._thumbnail_id = 0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]