def fromXML(xml, source_ref = None):
    assert xml.tag == "node", xml

    kind = xml.attrib["kind"]

    node_class = NodeCheckMetaClass.kinds[kind]

    args = dict(xml.attrib)
    del args["kind"]

    if source_ref is None:
        source_ref = SourceCodeReference.fromFilenameAndLine(args["filename"], int(args["line"]), None)
        del args["filename"]
        del args["line"]
    else:
        source_ref = source_ref.atLineNumber(int(args["line"]))
        del args["line"]

    for child in xml:
        assert child.tag == "role", child.tag
        child_name = child.attrib["name"]

        if child.attrib.get("type") == "list":
            value = [
                fromXML(sub_child, source_ref)
                for sub_child in
                child
            ]
        else:
            value = fromXML(child[0], source_ref)

        args[child_name] = value

    try:
        return node_class( source_ref = source_ref, **args )
    except __HOLE__:
        Tracing.printLine(node_class)
        raise
dataset/ETHPy150Open kayhayen/Nuitka/nuitka/nodes/NodeBases.py/fromXML