fix: fixed previous introduced bugs
This commit is contained in:
parent
66539e6614
commit
60297d6faf
@ -184,7 +184,7 @@ class Collection(Generic[T]):
|
|||||||
return len(self._contained_in_sub(__object)) > 0
|
return len(self._contained_in_sub(__object)) > 0
|
||||||
|
|
||||||
def _append(self, __object: T, from_map: bool = False):
|
def _append(self, __object: T, from_map: bool = False):
|
||||||
# print(self, __object)
|
print(self, __object)
|
||||||
self._map_element(__object, from_map=from_map)
|
self._map_element(__object, from_map=from_map)
|
||||||
self._data.append(__object)
|
self._data.append(__object)
|
||||||
|
|
||||||
@ -264,4 +264,5 @@ class Collection(Generic[T]):
|
|||||||
yield element
|
yield element
|
||||||
|
|
||||||
def __merge__(self, __other: Collection, override: bool = False):
|
def __merge__(self, __other: Collection, override: bool = False):
|
||||||
|
print(__other)
|
||||||
self.extend(__other.shallow_list)
|
self.extend(__other.shallow_list)
|
@ -38,7 +38,7 @@ class InnerData:
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
for key, value in __other.__dict__.items():
|
for key, value in __other.__dict__.copy().items():
|
||||||
# just set the other value if self doesn't already have it
|
# just set the other value if self doesn't already have it
|
||||||
if key not in self.__dict__:
|
if key not in self.__dict__:
|
||||||
self.__setattr__(key, value)
|
self.__setattr__(key, value)
|
||||||
@ -78,20 +78,25 @@ class OuterProxy:
|
|||||||
kwargs["dynamic"] = dynamic
|
kwargs["dynamic"] = dynamic
|
||||||
|
|
||||||
for name, factory in type(self)._default_factories.items():
|
for name, factory in type(self)._default_factories.items():
|
||||||
if name not in kwargs:
|
if kwargs.get(name, None) is None:
|
||||||
kwargs[name] = factory()
|
kwargs[name] = factory()
|
||||||
|
|
||||||
|
collection_data: Dict[str, list] = {}
|
||||||
|
for name, value in kwargs.copy().items():
|
||||||
|
if isinstance(value, list) and name.endswith("_list"):
|
||||||
|
collection_name = name.replace("_list", "_collection")
|
||||||
|
collection_data[collection_name] = value
|
||||||
|
|
||||||
|
del kwargs[name]
|
||||||
|
|
||||||
self._inner: InnerData = InnerData(**kwargs)
|
self._inner: InnerData = InnerData(**kwargs)
|
||||||
self.__init_collections__()
|
self.__init_collections__()
|
||||||
|
|
||||||
for name, data_list in kwargs.items():
|
for name, data_list in collection_data.items():
|
||||||
if isinstance(data_list, list) and name.endswith("_list"):
|
collection = self._inner.__getattribute__(name)
|
||||||
collection_name = name.replace("_list", "_collection")
|
collection.extend(data_list)
|
||||||
|
|
||||||
collection = self._inner.__getattribute__(collection_name)
|
self._inner.__setattr__(name, collection)
|
||||||
collection.extend(data_list)
|
|
||||||
|
|
||||||
self._inner.__setattr__(collection_name, collection)
|
|
||||||
|
|
||||||
def __init_collections__(self):
|
def __init_collections__(self):
|
||||||
pass
|
pass
|
||||||
@ -106,7 +111,7 @@ class OuterProxy:
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if __name.startswith("__"):
|
if __name.startswith("_"):
|
||||||
return super().__getattribute__(__name)
|
return super().__getattribute__(__name)
|
||||||
|
|
||||||
_inner: InnerData = super().__getattribute__("_inner")
|
_inner: InnerData = super().__getattribute__("_inner")
|
||||||
|
@ -61,15 +61,18 @@ class Song(Base):
|
|||||||
"album_collection": Collection,
|
"album_collection": Collection,
|
||||||
"feature_artist_collection": Collection,
|
"feature_artist_collection": Collection,
|
||||||
|
|
||||||
|
"title": lambda: None,
|
||||||
"unified_title": lambda: None,
|
"unified_title": lambda: None,
|
||||||
"isrc": lambda: None,
|
"isrc": lambda: None,
|
||||||
"genre": lambda: None,
|
"genre": lambda: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, title: str, unified_title: str = None, isrc: str = None, length: int = None, genre: str = None,
|
def __init__(self, title: str = None, unified_title: str = None, isrc: str = None, length: int = None,
|
||||||
note: FormattedText = None, source_list: SourceCollection = None, target_list: List[Target] = None,
|
genre: str = None, note: FormattedText = None, source_list: SourceCollection = None,
|
||||||
lyrics_list: List[Lyrics] = None, main_artist_list: List[Artist] = None,
|
target_list: List[Target] = None, lyrics_list: List[Lyrics] = None,
|
||||||
feature_artist_list: List[Artist] = None, album_list: List[Album] = None, **kwargs) -> None:
|
main_artist_list: List[Artist] = None, feature_artist_list: List[Artist] = None,
|
||||||
|
album_list: List[Album] = None, **kwargs) -> None:
|
||||||
|
|
||||||
super().__init__(title=title, unified_title=unified_title, isrc=isrc, length=length, genre=genre, note=note,
|
super().__init__(title=title, unified_title=unified_title, isrc=isrc, length=length, genre=genre, note=note,
|
||||||
source_list=source_list, target_list=target_list, lyrics_list=lyrics_list,
|
source_list=source_list, target_list=target_list, lyrics_list=lyrics_list,
|
||||||
main_artist_list=main_artist_list, feature_artist_list=feature_artist_list,
|
main_artist_list=main_artist_list, feature_artist_list=feature_artist_list,
|
||||||
@ -193,6 +196,7 @@ class Album(Base):
|
|||||||
label_collection: Collection[Label]
|
label_collection: Collection[Label]
|
||||||
|
|
||||||
_default_factories = {
|
_default_factories = {
|
||||||
|
"title": lambda: None,
|
||||||
"unified_title": lambda: None,
|
"unified_title": lambda: None,
|
||||||
"album_status": lambda: None,
|
"album_status": lambda: None,
|
||||||
"barcode": lambda: None,
|
"barcode": lambda: None,
|
||||||
@ -211,7 +215,7 @@ class Album(Base):
|
|||||||
}
|
}
|
||||||
|
|
||||||
# This is automatically generated
|
# This is automatically generated
|
||||||
def __init__(self, title: str, unified_title: str = None, album_status: AlbumStatus = None,
|
def __init__(self, title: str = None, unified_title: str = None, album_status: AlbumStatus = None,
|
||||||
album_type: AlbumType = None, language: Language = None, date: ID3Timestamp = None,
|
album_type: AlbumType = None, language: Language = None, date: ID3Timestamp = None,
|
||||||
barcode: str = None, albumsort: int = None, notes: FormattedText = None,
|
barcode: str = None, albumsort: int = None, notes: FormattedText = None,
|
||||||
source_list: SourceCollection = None, artist_list: List[Artist] = None, song_list: List[Song] = None,
|
source_list: SourceCollection = None, artist_list: List[Artist] = None, song_list: List[Song] = None,
|
||||||
@ -390,6 +394,7 @@ class Artist(Base):
|
|||||||
label_collection: Collection[Label]
|
label_collection: Collection[Label]
|
||||||
|
|
||||||
_default_factories = {
|
_default_factories = {
|
||||||
|
"name": lambda: None,
|
||||||
"unified_name": lambda: None,
|
"unified_name": lambda: None,
|
||||||
"country": lambda: None,
|
"country": lambda: None,
|
||||||
"unformated_location": lambda: None,
|
"unformated_location": lambda: None,
|
||||||
@ -407,11 +412,12 @@ class Artist(Base):
|
|||||||
}
|
}
|
||||||
|
|
||||||
# This is automatically generated
|
# This is automatically generated
|
||||||
def __init__(self, name: str, unified_name: str = None, country: Country = None, formed_in: ID3Timestamp = None,
|
def __init__(self, name: str = None, unified_name: str = None, country: Country = None,
|
||||||
notes: FormattedText = None, lyrical_themes: List[str] = None, general_genre: str = None,
|
formed_in: ID3Timestamp = None, notes: FormattedText = None, lyrical_themes: List[str] = None,
|
||||||
unformated_location: str = None, source_list: SourceCollection = None,
|
general_genre: str = None, unformated_location: str = None, source_list: SourceCollection = None,
|
||||||
contact_list: List[Contact] = None, feature_song_list: List[Song] = None,
|
contact_list: List[Contact] = None, feature_song_list: List[Song] = None,
|
||||||
main_album_list: List[Album] = None, label_list: List[Label] = None, **kwargs) -> None:
|
main_album_list: List[Album] = None, label_list: List[Label] = None, **kwargs) -> None:
|
||||||
|
|
||||||
super().__init__(name=name, unified_name=unified_name, country=country, formed_in=formed_in, notes=notes,
|
super().__init__(name=name, unified_name=unified_name, country=country, formed_in=formed_in, notes=notes,
|
||||||
lyrical_themes=lyrical_themes, general_genre=general_genre,
|
lyrical_themes=lyrical_themes, general_genre=general_genre,
|
||||||
unformated_location=unformated_location, source_list=source_list, contact_list=contact_list,
|
unformated_location=unformated_location, source_list=source_list, contact_list=contact_list,
|
||||||
@ -598,11 +604,11 @@ class Label(Base):
|
|||||||
"current_artist_collection": Collection,
|
"current_artist_collection": Collection,
|
||||||
"source_collection": SourceCollection,
|
"source_collection": SourceCollection,
|
||||||
"contact_collection": Collection,
|
"contact_collection": Collection,
|
||||||
|
"name": lambda: None,
|
||||||
"unified_name": lambda: None,
|
"unified_name": lambda: None,
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, name: str, unified_name: str = None, notes: FormattedText = None,
|
def __init__(self, name: str = None, unified_name: str = None, notes: FormattedText = None,
|
||||||
source_list: SourceCollection = None, contact_list: List[Contact] = None,
|
source_list: SourceCollection = None, contact_list: List[Contact] = None,
|
||||||
album_list: List[Album] = None, current_artist_list: List[Artist] = None, **kwargs) -> None:
|
album_list: List[Album] = None, current_artist_list: List[Artist] = None, **kwargs) -> None:
|
||||||
super().__init__(name=name, unified_name=unified_name, notes=notes, source_list=source_list,
|
super().__init__(name=name, unified_name=unified_name, notes=notes, source_list=source_list,
|
||||||
|
@ -24,7 +24,7 @@ class Source(OuterProxy):
|
|||||||
}
|
}
|
||||||
|
|
||||||
# This is automatically generated
|
# This is automatically generated
|
||||||
def __init__(self, url: str, page_enum: SourcePages, referer_page: SourcePages = None, audio_url: str = None,
|
def __init__(self, page_enum: SourcePages, url: str, referer_page: SourcePages = None, audio_url: str = None,
|
||||||
**kwargs) -> None:
|
**kwargs) -> None:
|
||||||
|
|
||||||
if referer_page is None:
|
if referer_page is None:
|
||||||
|
Loading…
Reference in New Issue
Block a user