def match_pages(self, ddiff):
        page_tos = list(ddiff.document_to.pages.all())
        matched_tos = set()
        for page_from in ddiff.document_from.pages.all():
            best_match = self._match_page(page_from, page_tos)
            if best_match is not None:
                (page_to, confidence) = best_match
                p_matcher = PageMatcher(
                        page_from=page_from,
                        page_to=page_to,
                        confidence=confidence,
                        diff=ddiff)
                p_matcher.save()
                matched_tos.add(page_to.pk)
            else:
                ddiff.removed_pages.add(page_from)

        for page_to in page_tos:
            if matched_tos not in page_to.pk:
                ddiff.added_pages.add(page_to)

        print('Finished matching pages')
dataset/ETHPy150Open bartdag/recodoc2/recodoc2/apps/doc/parser/doc_diff.py/DocDiffer.match_pages/swapped operands of `not in`