improvements
This commit is contained in:
parent
4bce29d288
commit
80c4117629
@ -1,10 +1,12 @@
|
||||
from typing import Tuple, Type, Dict, List, Set
|
||||
from typing import Tuple, Type, Dict, Set
|
||||
|
||||
from .results import SearchResults
|
||||
from ..objects import DatabaseObject, Source
|
||||
|
||||
from ..utils.enums.source import SourcePages
|
||||
from ..utils.support_classes import Query, DownloadResult
|
||||
from ..utils.exception.download import UrlNotFoundException
|
||||
|
||||
from ..pages import Page, EncyclopaediaMetallum, Musify, YouTube, YoutubeMusic, INDEPENDENT_DB_OBJECTS
|
||||
|
||||
DEBUGGING_PAGE = YoutubeMusic
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import List, Iterable, Dict, TypeVar, Generic
|
||||
from typing import List, Iterable, Dict, TypeVar, Generic, Iterator
|
||||
from collections import defaultdict
|
||||
from dataclasses import dataclass
|
||||
|
||||
@ -125,7 +125,7 @@ class Collection(Generic[T]):
|
||||
for element in element_list:
|
||||
self.append(element, merge_on_conflict=merge_on_conflict, merge_into_existing=merge_into_existing)
|
||||
|
||||
def __iter__(self):
|
||||
def __iter__(self) -> Iterator[T]:
|
||||
for element in self.shallow_list:
|
||||
yield element
|
||||
|
||||
@ -135,7 +135,7 @@ class Collection(Generic[T]):
|
||||
def __len__(self) -> int:
|
||||
return len(self._data)
|
||||
|
||||
def __getitem__(self, key):
|
||||
def __getitem__(self, key) -> T:
|
||||
if type(key) != int:
|
||||
return ValueError("key needs to be an integer")
|
||||
|
||||
|
@ -18,7 +18,8 @@ from .parents import MainObject, DatabaseObject
|
||||
from .source import Source, SourceCollection
|
||||
from .target import Target
|
||||
from ..utils.string_processing import unify
|
||||
from ..utils.shared import SORT_BY_ALBUM_TYPE, SORT_BY_DATE
|
||||
|
||||
from ..utils import settings
|
||||
|
||||
"""
|
||||
All Objects dependent
|
||||
@ -473,10 +474,7 @@ class Artist(MainObject):
|
||||
i mean do as you want but there is no strict rule about em so good luck
|
||||
"""
|
||||
self.notes: FormattedText = notes or FormattedText()
|
||||
"""
|
||||
TODO
|
||||
implement in db
|
||||
"""
|
||||
|
||||
self.lyrical_themes: List[str] = lyrical_themes or []
|
||||
self.general_genre = general_genre
|
||||
|
||||
@ -515,7 +513,7 @@ class Artist(MainObject):
|
||||
AlbumType.STUDIO_ALBUM: 0,
|
||||
AlbumType.EP: 0,
|
||||
AlbumType.SINGLE: 1
|
||||
}) if SORT_BY_ALBUM_TYPE else defaultdict(lambda: 0)
|
||||
}) if settings["sort_album_by_type"] else defaultdict(lambda: 0)
|
||||
|
||||
sections = defaultdict(list)
|
||||
|
||||
@ -528,7 +526,7 @@ class Artist(MainObject):
|
||||
# album is just a value used in loops
|
||||
nonlocal album
|
||||
|
||||
if SORT_BY_DATE:
|
||||
if settings["sort_by_date"]:
|
||||
_section.sort(key=lambda _album: _album.date, reverse=True)
|
||||
|
||||
new_last_albumsort = last_albumsort
|
||||
|
Loading…
Reference in New Issue
Block a user