<commit_before>#
# Copyright (c) 2006-2007 rPath, Inc.  All Rights Reserved.
#
import copy
import itertools
from conary.deps import deps
from conary.local import deptable

from conary.conaryclient import resolve
from conary.repository import findtrove,trovesource

from rmake.lib import flavorutil

class TroveSourceMesh(trovesource.SearchableTroveSource):
    def __init__(self, extraSource, mainSource, repos):
        trovesource.SearchableTroveSource.__init__(self)
        self.extraSource = extraSource
        self.mainSource = mainSource
        self.repos = repos
        trovesource.SearchableTroveSource.__init__(self)
        self.searchAsRepository()
        for source in self.mainSource, self.repos, self.extraSource:
            if not source:
                continue
            self._allowNoLabel = source._allowNoLabel
            self._bestFlavor = source._bestFlavor
            self._getLeavesOnly = source._getLeavesOnly
            self._flavorCheck = source._flavorCheck
            break
        self.sources = [ self.extraSource]
        if self.mainSource:
            self.sources.append(self.mainSource)
        if self.repos:
            self.sources.append(self.repos)

    def __getattr__(self, key):
        if self.repos:
            return getattr(self.repos, key)
        return getattr(self.mainSource, key)<commit_msg>We need a resolveSource to explicitly support getFileVersions now due to changes in trovesource.<commit_after>#
# Copyright (c) 2006-2007 rPath, Inc.  All Rights Reserved.
#
import copy
import itertools
from conary.deps import deps
from conary.local import deptable

from conary.conaryclient import resolve
from conary.repository import findtrove,trovesource

from rmake.lib import flavorutil

class TroveSourceMesh(trovesource.SearchableTroveSource):
    def __init__(self, extraSource, mainSource, repos):
        trovesource.SearchableTroveSource.__init__(self)
        self.extraSource = extraSource
        self.mainSource = mainSource
        self.repos = repos
        trovesource.SearchableTroveSource.__init__(self)
        self.searchAsRepository()
        for source in self.mainSource, self.repos, self.extraSource:
            if not source:
                continue
            self._allowNoLabel = source._allowNoLabel
            self._bestFlavor = source._bestFlavor
            self._getLeavesOnly = source._getLeavesOnly
            self._flavorCheck = source._flavorCheck
            break
        self.sources = [ self.extraSource]
        if self.mainSource:
            self.sources.append(self.mainSource)
        if self.repos:
            self.sources.append(self.repos)

    def __getattr__(self, key):
        if self.repos:
            return getattr(self.repos, key)
        return getattr(self.mainSource, key)

    def getFileVersions(self, *args, **kw):
        if self.repos:
            return self.repos.getFileVersions(*args, **kw)
        return self.mainSource.getFileVersions(*args, **kw)
{'fraction_non_alphanumeric': 0.0740120562625586, 'fraction_numerical': 0.0053583389149363695, 'mean_word_length': 2.701363073110285, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3803784', 'n_tokens_mistral': 869, 'n_tokens_neox': 820, 'n_words': 198}