feat: added extend
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful

This commit is contained in:
Hazel 2024-06-07 11:17:47 +02:00
parent eef3ea7f07
commit 346d273201

View File

@ -89,6 +89,7 @@ class ArtworkCollection:
self.crop_images: bool = crop_images self.crop_images: bool = crop_images
self._data = [] self._data = []
self.extend(data)
def search_artwork(self, url: str) -> Optional[ArtworkVariant]: def search_artwork(self, url: str) -> Optional[ArtworkVariant]:
for artwork in self._data: for artwork in self._data:
@ -129,6 +130,10 @@ class ArtworkCollection:
self._data.append(value) self._data.append(value)
return return
def extend(self, values: List[Union[Artwork, ArtworkVariant, dict]], **kwargs):
for value in values:
self.append(value, **kwargs)
def __merge__(self, other: ArtworkCollection, **kwargs) -> None: def __merge__(self, other: ArtworkCollection, **kwargs) -> None:
self.parent_artworks.update(other.parent_artworks) self.parent_artworks.update(other.parent_artworks)