def add_ancestors(code_element, ancestors, pk_set):
    if code_element is None:
        return

    for parent in code_element.parents.all():
        if parent.kind.is_type and pk_set not in parent.pk:
            ancestors.append(parent)
            pk_set.add(parent.pk)
            add_ancestors(parent, ancestors, pk_set)
dataset/ETHPy150Open bartdag/recodoc2/recodoc2/apps/codebase/linker/context.py/add_ancestors/swapped operands of `not in`