fix/collections #7

Merged
Hazel merged 15 commits from fix/collections into experimental 2024-04-16 11:35:48 +00:00
Showing only changes of commit eec252cb16 - Show all commits

View File

@ -29,7 +29,7 @@ class InnerData:
_refers_to_instances: set = None
def __init__(self, object_type, **kwargs):
self._refers_to_instances = set()
self._refers_to_instances =set()
# initialize the default values
self.__default_values = {}
@ -105,6 +105,8 @@ class OuterProxy:
self._fetched_from: dict = {}
self._inner: InnerData = InnerData(type(self), **kwargs)
self._inner._refers_to_instances.add(self)
self.__init_collections__()
for name, data_list in collection_data.items():
@ -191,15 +193,10 @@ class OuterProxy:
a, b = b, a
a._inner.__merge__(b._inner, override=override)
a._inner._refers_to_instances.update(b._inner._refers_to_instances)
if len(b._inner._refers_to_instances) > 1:
for instance in b._inner._refers_to_instances:
instance._inner = a._inner
b._inner = a._inner
b._inner._refers_to_instances.add(a)
b._inner._refers_to_instances.add(b)
for instance in b._inner._refers_to_instances:
instance._inner = a._inner
def mark_as_fetched(self, *url_hash_list: List[str]):
for url_hash in url_hash_list: