def __diff_iterable_with_deephash(self, level):
        """Diff of unhashable iterables. Only used when ignoring the order."""
        t1_hashtable = self.__create_hashtable(level.t1, level)
        t2_hashtable = self.__create_hashtable(level.t2, level)

        t1_hashes = set(t1_hashtable.keys())
        t2_hashes = set(t2_hashtable.keys())

        hashes_added = t2_hashes - t1_hashes
        hashes_removed = t1_hashes - t2_hashes

        if self.report_repetition:
            for hash_value in hashes_added:
                for i in t2_hashtable[hash_value].indexes:
                    change_level = level.branch_deeper(
                        notpresent,
                        t2_hashtable[hash_value].item,
                        child_relationship_class=SubscriptableIterableRelationship,  # TODO: that might be a lie!
                        child_relationship_param=i
                    )  # TODO: what is this value exactly?
                    self.__report_result('iterable_item_added', change_level)

            for hash_value in hashes_removed:
                for i in t1_hashtable[hash_value].indexes:
                    change_level = level.branch_deeper(
                        t1_hashtable[hash_value].item,
                        notpresent,
                        child_relationship_class=SubscriptableIterableRelationship,  # TODO: that might be a lie!
                        child_relationship_param=i)
                    self.__report_result('iterable_item_removed', change_level)

            items_intersect = t2_hashes.intersection(t1_hashes)

            for hash_value in items_intersect:
                t1_indexes = t1_hashtable[hash_value].indexes
                t2_indexes = t2_hashtable[hash_value].indexes
                t1_indexes_len = len(t1_indexes)
                t2_indexes_len = len(t2_indexes)
                if t1_indexes_len != t2_indexes_len:  # this is a repetition change!
                    # create "change" entry, keep current level untouched to handle further changes
                    repetition_change_level = level.branch_deeper(
                        t1_hashtable[hash_value].item,
                        t2_hashtable[hash_value].item,  # nb: those are equal!
                        child_relationship_class=SubscriptableIterableRelationship,  # TODO: that might be a lie!
                        child_relationship_param=t1_hashtable[hash_value]
                        .indexes[0])
                    repetition_change_level.additional['repetition'] = RemapDict(
                        old_repeat=t1_indexes_len,
                        new_repeat=t2_indexes_len,
                        old_indexes=t1_indexes,
                        new_indexes=t2_indexes)
                    self.__report_result('repetition_change',
                                         repetition_change_level)

        else:
            for hash_value in hashes_added:
                change_level = level.branch_deeper(
                    notpresent,
                    t2_hashtable[hash_value].item,
                    child_relationship_class=SubscriptableIterableRelationship,  # TODO: that might be a lie!
                    child_relationship_param=t2_hashtable[hash_value].indexes[
                        0])  # TODO: what is this value exactly?
                self.__report_result('iterable_item_added', change_level)

            for hash_value in hashes_removed:
                change_level = level.branch_deeper(
                    t1_hashtable[hash_value].item,
                    notpresent,
                    child_relationship_class=SubscriptableIterableRelationship,  # TODO: that might be a lie!
                    child_relationship_param=t1_hashtable[hash_value].indexes[
                        0])
                self.__report_result('iterable_item_removed', change_level)
def __diff_iterable_with_deephash ( self , level ) : t1_hashtable = self . __create_hashtable ( level . t1 , level ) t2_hashtable = self . __create_hashtable ( level . t2 , level ) t1_hashes = set ( t1_hashtable . keys ( ) ) t2_hashes = set ( t2_hashtable . keys ( ) ) hashes_added = t2_hashes - t1_hashes hashes_removed = t1_hashes - t2_hashes if self . report_repetition : for hash_value in hashes_added : for i in t2_hashtable [ hash_value ] . indexes : change_level = level . branch_deeper ( notpresent , t2_hashtable [ hash_value ] . item , child_relationship_class = SubscriptableIterableRelationship , child_relationship_param = i ) self . __report_result ( 'iterable_item_added' , change_level ) for hash_value in hashes_removed : for i in t1_hashtable [ hash_value ] . indexes : change_level = level . branch_deeper ( t1_hashtable [ hash_value ] . item , notpresent , child_relationship_class = SubscriptableIterableRelationship , child_relationship_param = i ) self . __report_result ( 'iterable_item_removed' , change_level ) items_intersect = t2_hashes . intersection ( t1_hashes ) for hash_value in items_intersect : t1_indexes = t1_hashtable [ hash_value ] . indexes t2_indexes = t2_hashtable [ hash_value ] . indexes t1_indexes_len = len ( t1_indexes ) t2_indexes_len = len ( t2_indexes ) if t1_indexes_len != t2_indexes_len : repetition_change_level = level . branch_deeper ( t1_hashtable [ hash_value ] . item , t2_hashtable [ hash_value ] . item , child_relationship_class = SubscriptableIterableRelationship , child_relationship_param = t1_hashtable [ hash_value ] . indexes [ 0 ] ) repetition_change_level . additional [ 'repetition' ] = RemapDict ( old_repeat = t1_indexes_len , new_repeat = t2_indexes_len , old_indexes = t1_indexes , new_indexes = t2_indexes ) self . __report_result ( 'repetition_change' , repetition_change_level ) else : for hash_value in hashes_added : change_level = level . branch_deeper ( notpresent , t2_hashtable [ hash_value ] . item , child_relationship_class = SubscriptableIterableRelationship , child_relationship_param = t2_hashtable [ hash_value ] . indexes [ 0 ] ) self . __report_result ( 'iterable_item_added' , change_level ) for hash_value in hashes_removed : change_level = level . branch_deeper ( t1_hashtable [ hash_value ] . item , notpresent , child_relationship_class = SubscriptableIterableRelationship , child_relationship_param = t1_hashtable [ hash_value ] . indexes [ 0 ] ) self . __report_result ( 'iterable_item_removed' , change_level )
Diff of unhashable iterables. Only used when ignoring the order.