def getChildLocalUpdates(self, searchSource, localUpdates,
                             installedTroves=None, missingTroves=None):
        """
        Given a set of primary local updates (the updates the user
        is likely to have typed at the command line, return their
        child updates). Given a primary update from a -> b, we look
        at the children of a and b and see if a child of a is not
        installed where a child of b is, and assert that that update is
        from childa -> childb.
        """
        localUpdates = [ x for x in localUpdates
                         if not (x[1][0] and x[1][0].isOnLocalHost()) ]
        oldTroveTups = [ (x[0], x[1][0], x[1][1]) for x in localUpdates]
        newTroveTups = [ (x[0], x[2][0], x[2][1]) for x in localUpdates]

        toGet = [ x for x in oldTroveTups if x[1] and trove.troveIsGroup(x[0])]

        oldTroveSource = trovesource.stack(searchSource, self.repos)
        oldTroves = oldTroveSource.getTroves(toGet, withFiles=False)

        troveDict = dict(zip(toGet, oldTroves))
        toGet = [ x for x in newTroveTups if x[1] ]
        newTroves = self.db.getTroves(toGet, withFiles=False)
        troveDict.update(zip(toGet, newTroves))

        isComponent = trove.troveIsComponent
        for trv in newTroves:
            if not trove.troveIsGroup(trv.getName()):
                continue
            for troveTup in trv.iterTroveList(strongRefs=True, weakRefs=True):
                if isComponent(troveTup[0]):
                    packageName = troveTup[0].split(':', 1)[0]
                    packageTup = packageName, troveTup[1], troveTup[2]
                    l = troveDict.setdefault(packageTup, [])
                    if isinstance(l, list):
                        l.append(troveTup)
                    troveDict.setdefault(troveTup, [])
        toGet = [ x for x in oldTroveTups if x[1] and x not in troveDict ]
        if toGet:
            moreOldTroves = oldTroveSource.getTroves(toGet, withFiles=False)
            troveDict.update(zip(toGet, moreOldTroves))
            oldTroves += moreOldTroves


        if installedTroves is None:
            assert(missingTroves is None)
            chain = itertools.chain
            izip = itertools.izip
            childNew = list(set(chain(*(x.iterTroveList(strongRefs=True,
                                                           weakRefs=True)
                                                        for x in newTroves))))
            childOld = list(set(chain(*(x.iterTroveList(strongRefs=True,
                                                        weakRefs=True)
                                                        for x in oldTroves))))
            childOld += [ x[0] for x in troveDict.items()
                          if isinstance(x[1], list) ]
            hasTroves = self.db.hasTroves(childNew + childOld)
            installedTroves = set(x[0] for x in izip(childNew, hasTroves)
                                                if x[1])
            installedTroves.update(newTroveTups)

            hasTroves = hasTroves[len(childNew):]
            missingTroves = set(x[0] for x in izip(childOld, hasTroves)
                                              if not x[1])
            missingTroves.update(oldTroveTups)
            del childNew, childOld, hasTroves
        else:
            assert(missingTroves is not None)
            installedTroves = installedTroves.copy()
            missingTroves = missingTroves.copy()

        erases = set()
        allJobs = []
        for oldTroveTup, newTroveTup in itertools.izip(oldTroveTups, newTroveTups):
            erases.discard(oldTroveTup)
            # find the relevant local updates by performing a
            # diff between oldTrove and a trove based on newTrove
            # that contains only those parts of newTrove that are actually
            # installed.
            if oldTroveTup[1]:
                oldTrove = troveDict[oldTroveTup]
            else:
                oldTrove = None
            if newTroveTup[1]:
                newTrove = troveDict[newTroveTup]
            else:
                newTrove = None

            notExistsOldTrove = trove.Trove('@update', versions.NewVersion(), deps.Flavor())
            existsNewTrove = trove.Trove('@update', versions.NewVersion(), deps.Flavor())

            # only create local updates between old troves that
            # don't exist and new troves that do.
            if oldTrove is not None:
                if isinstance(oldTrove, list):
                    oldTroveChildren = set(oldTrove)
                else:
                    oldTroveChildren = [ x for x in oldTrove.iterTroveList(
                                                            strongRefs=True,
                                                            weakRefs=True) ]
                for tup in oldTroveChildren:
                    if (tup in missingTroves and tup not in oldTroveTups
                        and not newTrove.hasTrove(*tup)):
                        notExistsOldTrove.addTrove(*tup)
                for tup, byDefault, isStrong in newTrove.iterTroveListInfo():
                    if (installedTroves in tup and tup not in newTroveTups
                        and tup not in oldTroveChildren):
                        existsNewTrove.addTrove( *tup)
                    elif not byDefault and tup in installedTroves:
                        existsNewTrove.addTrove(*tup)
                    if byDefault and tup in missingTroves:
                        notExistsOldTrove.addTrove(*tup)
            else:
                for tup, byDefault, isStrong in newTrove.iterTroveListInfo():
                    if byDefault:
                        if tup in missingTroves:
                            notExistsOldTrove.addTrove(*tup)
                    else:
                        if tup in installedTroves:
                            existsNewTrove.addTrove(*tup)

            newUpdateJobs = existsNewTrove.diff(notExistsOldTrove)[2]

            for newJob in newUpdateJobs:
                oldInfo = (newJob[0], newJob[1][0], newJob[1][1])
                if not newJob[1][0]:
                    continue
                if not newJob[2][0]:
                    erases.add(oldInfo)
                else:
                    erases.discard(oldInfo)
                    if newJob not in allJobs:
                        allJobs.append(newJob)
                if oldTrove is None:
                    # we some times will mark a trove as an install
                    # at one level but it will turn out to be more properly
                    # categorized as an update due to some intermediate level
                    # package that was modified.  Thus we don't count packages
                    # out of consideration when they are marked as installs
                    continue

                # no trove should be part of more than one update.
                if newJob[2][0]:
                    installedTroves.remove((newJob[0], newJob[2][0], newJob[2][1]))
                missingTroves.remove((newJob[0], newJob[1][0], newJob[1][1]))
        return allJobs + [(x[0], (x[1], x[2]), (None, None), False) for x in erases]
dataset/ETHPy150Open sassoftware/conary/conary/conaryclient/update.py/ClientUpdate.getChildLocalUpdates/swapped operands of `in`