Beispiel #1
0
def appliedToFromSlotsIds(slotsIds):
    st = scaffold()
    appliedTo = 0
    for slotId in slotsIds:
        areaId, slotType, regionIdx = slotId
        slot = st[areaId].slotFor(slotType)
        if slot is not None:
            regions = slot.getRegions()
            region = regions[regionIdx] if len(regions) > regionIdx else ApplyArea.NONE
            appliedTo |= region

    return appliedTo
Beispiel #2
0
def slotsIdsFromAppliedTo(appliedTo, slotType):
    st = scaffold()
    result = list()
    for region in ApplyArea.RANGE:
        if appliedTo & region:
            areaId = AREA_ID_BY_REGION[region]
            slot = st[areaId].slotFor(slotType)
            if slot is not None:
                regions = slot.getRegions()
                regionIdx = next((i for i, rg in enumerate(regions) if rg == region), -1)
                result.append((areaId, slotType, regionIdx))

    return result