def _getTrovesByTypeTuples(self, troveSpecs,
                         versionType=_GTL_VERSION_TYPE_NONE,
                         latestFilter=_GET_TROVE_ALL_VERSIONS,
                         bestFlavor=False, troveTypes=TROVE_QUERY_PRESENT):
        # some cases explained:
        # if latestFilter ==  _GET_TROVE_ALL_VERSIONS and
        # flavorFilter == _GET_TROVE_BEST_FLAVOR,
        # for each version, return the best flavor for that version.

        # if latestFilter == _GET_TROVE_VERY_LATEST and flavorFilter
        # == _GET_TROVE_BEST_FLAVOR
        # get the latest version that has an allowed flavor, then get
        # only the best one of the flavors at that latest version

        # we don't handle queries for non-present troves at this moment.
        # doing so may be impossible and/or expensive - for example, we would
        # have to instantiate matching troves from changesets before we could
        # filter by flavor.

        # That said, we just ignore the troveType and assume that
        # the trove source only has the correct types in it.
        #assert(troveTypes == TROVE_QUERY_PRESENT)

        if bestFlavor:
            flavorFilter = _GET_TROVE_BEST_FLAVOR
        else:
            flavorFilter = _GET_TROVE_ALL_FLAVORS
        finalResults = [ [] for x in troveSpecs ]
        finalAltFlavors = [ [] for x in troveSpecs ]

        splitByBranch = (versionType == _GTL_VERSION_TYPE_LABEL)
        filterOptions = FilterOptions(latestFilter, flavorFilter,
                                      self._flavorCheck, troveTypes,
                                      splitByBranch=splitByBranch)

        scoreCache = {}

        troveSpecDict = {}
        for idx, (name, versionSpec, flavorSpec) in enumerate(troveSpecs):
            vDict = troveSpecDict.setdefault(name, {})
            fDict = vDict.setdefault(versionSpec, {})
            fDict.setdefault(flavorSpec, []).append(idx)

        for name, versionQuery in troveSpecDict.iteritems():
            troves = self._toQueryDict(self.trovesByName(name))
            if not troves:
                continue
            if not versionQuery:
                allTroves.update(troves)
                continue
            for resultName in troves:
                versionResults = self._filterByVersionQuery(versionType,
                                                            troves[resultName].keys(),
                                                            versionQuery)

                for queryKey, versionList in versionResults.iteritems():

                    flavorQueryList = versionQuery[queryKey]
                    versionFlavorDict = dict((x, troves[resultName][x])
                                              for x in versionList)
                    for flavorQuery, idxList in flavorQueryList.iteritems():
                        results, altFlavors = self._filterResultsByFlavor(
                                                    versionFlavorDict,
                                                    flavorQuery, filterOptions,
                                                    scoreCache)
                        for idx in idxList:
                            if results:
                                finalAltFlavors[idx] = []
                            else:
                                finalAltFlavors[idx] = altFlavors
                            for idx in troveSpecDict[name][queryKey][flavorQuery]:
                                for version, flavorList in results.iteritems():
                                    finalResults[idx].extend((resultName, version, x)
                                                             for x in flavorList)

        return finalResults, finalAltFlavors
Test _schedule_slice method with an empty hooks class installed.
dataset/ETHPy150Open sassoftware/conary/conary/repository/trovesource.py/SearchableTroveSource._getTrovesByTypeTuples--crossover with--dataset/ETHPy150Open GoogleCloudPlatform/appengine-mapreduce/python/test/mapreduce/handlers_test.py/MapperWorkerCallbackHandlerTest.testScheduleSlice_RaisingHooks