示例#1
0
def _recursive_update(lhs, rhs, analysis: PartitionState, merge: bool):
    if isinstance(lhs, TupleExpr) and isinstance(rhs, TupleExpr):
        for l, r in zip(lhs.elements, rhs.elements):
            _recursive_update(l, r, analysis, merge)
    else:
        lhs = lhs.privacy_annotation_label()
        rhs = rhs.privacy_annotation_label()
        if lhs and rhs:
            if merge:
                analysis.merge(lhs, rhs)
            else:
                analysis.move_to(lhs, rhs)
示例#2
0
    def test_move_to(self):
        s = PartitionState()

        for i in range(10):
            s.insert(i)

        for i in range(5):
            s.merge(0, i)

        for i in range(5, 10):
            s.merge(5, i)

        s.move_to(0, 5)

        for i in range(1, 5):
            self.assertTrue(s.same_partition(1, i))

        for i in range(5, 10):
            self.assertTrue(s.same_partition(0, i))