feat: implemented the merging from where it has been fetched from
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -32,6 +32,7 @@ class InnerData:
|
||||
|
||||
def __init__(self, object_type, **kwargs):
|
||||
self._refers_to_instances = set()
|
||||
self._fetched_from: dict = {}
|
||||
|
||||
# collection : collection that is a collection of self
|
||||
self._is_collection_child: Dict[Collection, Collection] = {}
|
||||
@@ -52,6 +53,8 @@ class InnerData:
|
||||
:return:
|
||||
"""
|
||||
|
||||
self._fetched_from.update(__other._fetched_from)
|
||||
|
||||
for key, value in __other.__dict__.copy().items():
|
||||
# just set the other value if self doesn't already have it
|
||||
if key not in self.__dict__ or (key in self.__dict__ and self.__dict__[key] == self._default_values.get(key)):
|
||||
@@ -109,7 +112,6 @@ class OuterProxy:
|
||||
|
||||
del kwargs[name]
|
||||
|
||||
self._fetched_from: dict = {}
|
||||
self._inner: InnerData = InnerData(type(self), **kwargs)
|
||||
self._inner._refers_to_instances.add(self)
|
||||
|
||||
@@ -220,13 +222,13 @@ class OuterProxy:
|
||||
|
||||
def mark_as_fetched(self, *url_hash_list: List[str]):
|
||||
for url_hash in url_hash_list:
|
||||
self._fetched_from[url_hash] = {
|
||||
self._inner._fetched_from[url_hash] = {
|
||||
"time": get_unix_time(),
|
||||
"url": url_hash,
|
||||
}
|
||||
|
||||
def already_fetched_from(self, url_hash: str) -> bool:
|
||||
res = self._fetched_from.get(url_hash, None)
|
||||
res = self._inner._fetched_from.get(url_hash, None)
|
||||
|
||||
if res is None:
|
||||
return False
|
||||
|
Reference in New Issue
Block a user