From ebe3d9328cb29097c9a769b74d5348f94e9c1203 Mon Sep 17 00:00:00 2001 From: Hellow2 Date: Fri, 3 Mar 2023 12:13:23 +0100 Subject: [PATCH] =?UTF-8?q?=C3=B6lkjvy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/music_kraken/objects/collection.py | 2 +- src/music_kraken/objects/parents.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/music_kraken/objects/collection.py b/src/music_kraken/objects/collection.py index f066103..700d961 100644 --- a/src/music_kraken/objects/collection.py +++ b/src/music_kraken/objects/collection.py @@ -60,7 +60,7 @@ class Collection: if unified in self._by_attribute[name]: return self._by_attribute[name][unified] - def append(self, element: SourceAttribute): + def append(self, element: SourceAttribute, merge_on_conflict: bool = True): if type(element) is not self.element_type and self.element_type is not None: raise TypeError(f"{type(element)} is not the set type {self.element_type}") diff --git a/src/music_kraken/objects/parents.py b/src/music_kraken/objects/parents.py index 9f219dc..74819ff 100644 --- a/src/music_kraken/objects/parents.py +++ b/src/music_kraken/objects/parents.py @@ -7,6 +7,9 @@ from ..utils.shared import ( class DatabaseObject: + COLLECTION_ATTRIBUTES: tuple = tuple() + SIMPLE_ATTRIBUTES: tuple = tuple() + def __init__(self, _id: str = None, dynamic: bool = False, **kwargs) -> None: if _id is None and not dynamic: """ @@ -20,6 +23,9 @@ class DatabaseObject: self.id: Optional[str] = _id self.dynamic = dynamic + + def merge(self, other, override: bool = False): + for collection in class MainObject(DatabaseObject): @@ -33,6 +39,7 @@ class MainObject(DatabaseObject): It has all the functionality of the "DatabaseObject" (it inherits from said class) but also some added functions as well. """ + def __init__(self, _id: str = None, dynamic: bool = False, **kwargs): super().__init__(_id=_id, dynamic=dynamic, **kwargs)