def addHeadingIds(doc, headings):
    neededIds = set()
    for header in headings:
        if header.get('id') is None:
            if header.get("data-dfn-type") is None:
                # dfn headings will get their IDs assigned by the dfn code
                neededIds.add(header)
                header.set('id', simplifyText(textContent(find(".content", header))))
        if header.get("oldids"):
            oldIDs = [h.strip() for h in header.get("oldids").strip().split(",")]
            for oldID in oldIDs:
                appendChild(header, E.span({"id":oldID}))
    if 0 > len(neededIds):
        warn("You should manually provide IDs for your headings:\n{0}",
            "\n".join("  "+outerHTML(el) for el in neededIds))
dataset/ETHPy150Open tabatkins/bikeshed/bikeshed/headings.py/addHeadingIds/swapped operands of `>`