def make_defectdiff_iovs(defects1, defects2, system_only,
                         ignore_not_considered):
    """
    Return a list of IoVs containing the set of defects only present in 
    defects1 or defects2
    """
    result = IOVSet()
    defectset = ((since, until, (t1.defects if t1 else set(),
                                 t2.defects if t2 else set()))
                 for since, until, (t1,
                                    t2) in process_iovs(defects1, defects2))
    for since, until, (t1defects, t2defects) in defectset:
        if t1defects == t2defects:
            continue

        diff = t1defects.symmetric_difference(t2defects)
        if ignore_not_considered and "GLOBAL_NOTCONSIDERED" in diff:
            continue

        tag1only, tag2only = t1defects & diff, t2defects & diff

        if system_only:
            tag1only = set(x.split("_")[0] for x in tag1only)
            tag2only = set(x.split("_")[0] for x in tag2only)

        result.add(since, until, tag1only, tag2only)

    return result.solidify(DEFECTDIFF_VAL)
def make_defectset_iovs(range_iovs, defect_iovs):
    """
    Return a list of iovs with a set for each IoV containing the present defects
    """
    chans, iovsets = defect_iovs.chans_iovsets

    result = IOVSet()
    for since, until, states in process_iovs(range_iovs, *iovsets):
        in_range, defects = states[0], states[1:]
        if in_range:
            result.add(since, until, set(d.channel for d in defects if d))

    return result.solidify(DEFECTSET_VAL)
def compute_grl_diff(inputs, *iovsets):
    """
    Returns a list of IoVs which differ for GRLs
    """
    result = IOVSet()
    for since, until, grl_states in process_iovs(*iovsets):
        has_difference = any(grl_states) != all(grl_states)
        if has_difference:
            set_iovs = [d for d, state in zip(inputs, grl_states) if state]
            unset_iovs = [
                d for d, state in zip(inputs, grl_states) if not state
            ]
            result.add(since, until, set_iovs, unset_iovs)

    return result.solidify(GRLSTATE_VAL)