Beispiel #1
0
def flatten(pks, flat_pks, cd_pks):
    while len(pks) > 0:
        pk = pks.getchildren().pop(0)
        flat_pks.append(pk)
        new_cd = ParameterList(pk.get("name"))
        new_cd.append(parameter.StringParameter("PK type", asearch.childByName(pk, "PK type").get("value")))
        cd_pks.append(new_cd)

        try:
            subpks = pk.pop("PKs")
        except aerrors.MissingXMLError:
            pass
        else:
            flatten(subpks, flat_pks, new_cd)
Beispiel #2
0
def coordinator_to_cycle_driver(xml):
    cycle_driver = asearch.childByName(xml, "coordinator")
    cycle_driver.set("name", "cycle driver")
    cycle_driver_pks = ParameterList("PK tree")
    cycle_driver.append(cycle_driver_pks)

    return cycle_driver_pks
Beispiel #3
0
def flatten(pks, flat_pks, cd_pks):
    while len(pks) > 0:
        pk = pks.getchildren().pop(0)
        flat_pks.append(pk)
        new_cd = ParameterList(pk.get("name"))
        new_cd.append(
            parameter.StringParameter(
                "PK type",
                asearch.childByName(pk, "PK type").get("value")))
        cd_pks.append(new_cd)

        try:
            subpks = pk.pop("PKs")
        except aerrors.MissingXMLError:
            pass
        else:
            flatten(subpks, flat_pks, new_cd)
Beispiel #4
0
def flatten(pks, flat_pks, cd_pks):
    while len(pks) > 0:
        pk_name = pks.getchildren()[0].get("name")
        new_cd = ParameterList(pk_name)
        pk = pks.pop(pk_name)
        flat_pks.append(pk)
        print(f'Flattened PK: {pk_name}')
        new_cd.append(
            parameter.StringParameter(
                "PK type",
                asearch.child_by_name(pk, "PK type").get("value")))
        cd_pks.append(new_cd)

        try:
            subpks = pk.pop("PKs")
        except aerrors.MissingXMLError:
            pass
        else:
            flatten(subpks, flat_pks, new_cd)
Beispiel #5
0
def flatten_pks(xml):
    try:
        cycle_driver = asearch.childByName(xml, "cycle driver")
    except aerrors.MissingXMLError():
        pass
    else:
        return

    pks = asearch.childByName(xml, "PKs")
    cd_pks = coordinator_to_cycle_driver(xml)
    flat_pks = ParameterList("PKs")
    flatten(pks, flat_pks, cd_pks)
    pks.extend(flat_pks)
Beispiel #6
0
def flatten_pks(xml):
    pks = asearch.childByName(xml, "PKs")
    cd_pks = coordinator_to_cycle_driver(xml)
    flat_pks = ParameterList("PKs")
    flatten(pks, flat_pks, cd_pks)
    pks.extend(flat_pks)