def _findOverlappingJobs(self, jobSet, troveSource, pathHashCache = None):
        """
        Returns a list of sets of jobs.

        Each set has the following property:

        For every job in the set, there is another job in the set such that:
        1) the job removes a path that the other job adds
        2) the job adds a path that other job removes
        3) both jobs add the same path
        or
        4) both jobs remove the same path (though this should be impossible
        because conary only allows one trove to own a file)

        All sets in a job should be connected to each other through
        some chain of these relationships.
        """
        if pathHashCache is None:
            pathHashCache = {}

        # overlapping is a dict from jobSet id -> overlapping id OR
        # jobSet id -> list of other ids that overlap.
        # for example, overlapping[3] -> 2, and overlapping[2] -> [2,3]
        # would be reasonable, meaning that the set at id 2 contains
        # all the overlapping troves there.
        overlapping = {}

        # d is a dict of pathHash -> id of first job that has that
        # pathHash.
        d = {}

        jobSet = list(enumerate(jobSet))

        oldTroves = [ (idx, (x[0], x[1][0], x[1][1]))
                        for idx, x in jobSet if x[1][0] ]
        pathHashesNeeded = [ x for (idx, x) in oldTroves
                                    if x not in pathHashCache and
                                    not trove.troveIsCollection(x[0]) ]
        oldPathHashes = self.db.getPathHashesForTroveList(pathHashesNeeded)
        pathHashCache.update(itertools.izip(pathHashesNeeded, oldPathHashes))
        oldJobs = [ (jobSet[idx], pathHashCache.get(info, None))
                                    for (idx, info) in oldTroves ]

        getHashes = troveSource.getPathHashesForTroveList
        justNewJobs = [ x for x in jobSet if x[1][2][0] ]
        newTroves = [ (x[1][0], x[1][2][0], x[1][2][1]) for x in justNewJobs ]
        newJobs = ( (x, hashes) for x, hashes in
                        itertools.izip(justNewJobs, getHashes(newTroves)) )

        for ((idx, job), pathHashes) in itertools.chain(oldJobs, newJobs):
            if pathHashes is None:
                continue
            for pathHash in pathHashes:
                if pathHash not in d:
                    d[pathHash] = idx
                else:
                    if d[pathHash] == idx:
                        continue
                    # someone else already had this issue.  Find out
                    # what overlapping set they are in and add ourselves to
                    # it.
                    newIdx = d[pathHash]

                    if idx in overlapping:
                        # if we're already part of a set, find our set.
                        while isinstance(overlapping[idx], int):
                            idx = overlapping[idx]

                        if newIdx in overlapping and overlapping[newIdx] == idx:
                            # in this case newIdx is already a part of our
                            # set.
                            continue
                        overlapping[idx].append(newIdx)
                    else:
                        # create a new set consisting of ourselves and
                        # newIdx.
                        overlapping[idx] = [idx, newIdx]

                    if overlapping in newIdx:
                        # if newIdx was already part of a set,
                        # find that set and extend our set with it.
                        while isinstance(overlapping[newIdx], int):
                            oldIdx = overlapping[newIdx]
                            overlapping[newIdx] = idx
                            newIdx = oldIdx
                        if newIdx == idx:
                            continue

                        overlapping[idx].extend(overlapping[newIdx])

                    # we've joined newIdx (and maybe all its friends) into
                    # our set, so now point newIdx to our set.
                    overlapping[newIdx] = idx

        sets = []
        for val in overlapping.itervalues():
            if isinstance(val, int):
                continue
            sets.append([ jobSet[x][1] for x in set(val) ])
        return sets
dataset/ETHPy150Open sassoftware/conary/conary/conaryclient/update.py/ClientUpdate._findOverlappingJobs/swapped operands of `in`