draft: improved debug even more

This commit is contained in:
Hazel 2024-04-30 17:43:00 +02:00
parent 4510520db6
commit be843f2c10
4 changed files with 9 additions and 3 deletions

View File

@ -50,7 +50,7 @@ class Collection(Generic[T]):
self.extend(data)
def __repr__(self) -> str:
return f"Collection({id(self)})"
return f"Collection({' | '.join(self._collection_for.values())} {id(self)})"
def _map_element(self, __object: T, from_map: bool = False):
self._unmap_element(__object.id)
@ -111,6 +111,8 @@ class Collection(Generic[T]):
if __object is None:
return
object_trace(f"Appending {__object.option_string} {__object.id} to {self}")
existing_object, map_to = self._find_object(__object, no_push_to=kwargs.get("no_push_to", False))
if map_to is self:

View File

@ -243,6 +243,10 @@ class OuterProxy:
return r
@property
def option_string(self) -> str:
return self.title_string
INDEX_DEPENDS_ON: List[str] = []
@property

View File

@ -348,7 +348,7 @@ class Album(Base):
@property
def option_string(self) -> str:
r = OPTION_FOREGROUND.value + self.title + BColors.ENDC.value + OPTION_BACKGROUND.value
r = OPTION_FOREGROUND.value + self.title_string + BColors.ENDC.value + OPTION_BACKGROUND.value
r += get_collection_string(self.artist_collection, " by {}")
r += get_collection_string(self.label_collection, " under {}")

View File

@ -30,7 +30,7 @@ class Source:
def __post_init__(self):
self.referrer_page = self.referrer_page or self.page_enum
@cached_property
@property
def parsed_url(self) -> ParseResult:
return urlparse(self.url)