draft: the problem is in _list_renderer.py
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Hellow
2024-04-29 23:40:48 +02:00
parent 3e29e1d322
commit e9b1a12aa1
3 changed files with 18 additions and 51 deletions

View File

@@ -1,7 +1,7 @@
from __future__ import annotations
from collections import defaultdict
from typing import TypeVar, Generic, Dict, Optional, Iterable, List, Iterator, Tuple, Generator, Union, Any
from typing import TypeVar, Generic, Dict, Optional, Iterable, List, Iterator, Tuple, Generator, Union, Any, Set
from .parents import OuterProxy
from ..utils import object_trace
@@ -117,14 +117,26 @@ class Collection(Generic[T]):
if a is b:
continue
object_trace(f"Syncing [{a}] = [{b}]")
no_sync_collection: Set[Collection] = kwargs.get("no_sync_collection", set())
object_trace(f"Syncing [{a}] = [{b}]; {no_sync_collection}")
if id(b) in no_sync_collection:
continue
for synced_with, key in b._collection_for.items():
b_data = b.data.copy()
b_collection_for = b._collection_for.copy()
no_sync_collection.add(id(b))
kwargs["no_sync_collection"] = no_sync_collection
del b
for synced_with, key in b_collection_for.items():
synced_with.__setattr__(key, a)
a._collection_for.update(b._collection_for)
a._collection_for[synced_with] = key
a.extend(b.data, **kwargs)
print(synced_with, key)
a.extend(b_data, **kwargs)
else:
# merge only if the two objects are not the same
if existing_object.id == __object.id:

View File

@@ -45,6 +45,7 @@ class InnerData:
for key, value in kwargs.items():
if hasattr(value, "__is_collection__"):
value._collection_for[self] = key
self.__setattr__(key, value)
def __hash__(self):