Compare commits

..

No commits in common. "f000ad448461d7b39e81a268e86cfbf975d2dfc2" and "56101d4a31a1e2041e917da332f07b73daea82e8" have entirely different histories.

2 changed files with 6 additions and 14 deletions

View File

@ -60,10 +60,8 @@ class Collection(Generic[T]):
self._contains_ids.remove(__object.id)
for name, value in self._id_to_index_values[__object.id]:
if name in self._indexed_values:
del self._indexed_values[name]
if value in self._indexed_to_objects:
del self._indexed_to_objects[value]
del self._indexed_values[name]
del self._indexed_to_objects[value]
del self._id_to_index_values[__object.id]
@ -283,7 +281,7 @@ class Collection(Generic[T]):
yield from c.__iter__(finished_ids=finished_ids)
def __merge__(self, __other: Collection, override: bool = False):
self.extend(__other)
self.extend(__other.__iter__())
def __getitem__(self, item: int):
if item < len(self._data):

View File

@ -194,23 +194,17 @@ class OuterProxy:
if a._inner is b._inner:
return
# switch instances if more efficient
if len(b._inner._refers_to_instances) > len(a._inner._refers_to_instances):
a, b = b, a
a._inner.__merge__(b._inner, override=override)
for collection, child_collection in b._inner._is_collection_child.items():
try:
collection.children.remove(child_collection)
except ValueError:
pass
collection.children.remove(child_collection)
for collection, parent_collection in b._inner._is_collection_parent.items():
try:
collection.parents.remove(parent_collection)
except ValueError:
pass
collection.parents.remove(parent_collection)
a._inner._refers_to_instances.update(b._inner._refers_to_instances)