<commit_before>#
# Copyright (c) 2008 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/permanent/licenses/CPL-1.0.
#
# This program is distributed in the hope that it will be useful, but
# without any warranty; without even the implied warranty of merchantability
# or fitness for a particular purpose. See the Common Public License for
# full details.
#

from conary.build.packagerecipe import AbstractPackageRecipe
from conary.build import defaultrecipes

from conary.build.recipe import RECIPE_TYPE_FACTORY
from conary.build.errors import RecipeFileError

class FactoryException(RecipeFileError):

    pass

class Factory:

    internalAbstractBaseClass = True
    _recipeType = RECIPE_TYPE_FACTORY
    _trackedFlags = None

    def __init__(self, packageName, sourceFiles = [], openSourceFileFn = None):
        self.packageName = packageName
        self.sources = sourceFiles
        self._openSourceFileFn = openSourceFileFn

    @classmethod
    def getType(class_):
        return class_._recipeType

    @classmethod
    def validateClass(class_):
        if class_.version == '':
            raise ParseError("empty release string")

    def openSourceFile(self, path):
        return self._openSourceFileFn(path)

FactoryRecipe = '''
from conary.build import recipe
class FactoryRecipe(AbstractPackageRecipe, BaseRequiresRecipe):
    name = '%(name)s'
    version = '%(version)s'
    abstractBaseClass = True

    originalFactoryClass = None
    _sourcePath = None
    _trove = None

    def __init__(r, *arg, **kw):
        assert(r.originalFactoryClass is not None, 'You must set the originalFactoryClass before creating the FactoryRecipe object')
        AbstractPackageRecipe.__init__(r, *arg, **kw)

    def setup(r):
        pass

    def setupAbstractBaseClass(r):
        AbstractPackageRecipe.setupAbstractBaseClass(r)
        ofc = r.originalFactoryClass
        # getAdditionalSourceFiles has to be a static or class
        # method
        if  hasattr(ofc, "getAdditionalSourceFiles"):
            additionalFiles = ofc.getAdditionalSourceFiles()
            for ent in additionalFiles:
                srcFile, destLoc = ent[:2]<commit_msg>Removing paranthesis, assert is always True otherwise<commit_after>#
# Copyright (c) 2008 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/permanent/licenses/CPL-1.0.
#
# This program is distributed in the hope that it will be useful, but
# without any warranty; without even the implied warranty of merchantability
# or fitness for a particular purpose. See the Common Public License for
# full details.
#

from conary.build.packagerecipe import AbstractPackageRecipe
from conary.build import defaultrecipes

from conary.build.recipe import RECIPE_TYPE_FACTORY
from conary.build.errors import RecipeFileError

class FactoryException(RecipeFileError):

    pass

class Factory:

    internalAbstractBaseClass = True
    _recipeType = RECIPE_TYPE_FACTORY
    _trackedFlags = None

    def __init__(self, packageName, sourceFiles = [], openSourceFileFn = None):
        self.packageName = packageName
        self.sources = sourceFiles
        self._openSourceFileFn = openSourceFileFn

    @classmethod
    def getType(class_):
        return class_._recipeType

    @classmethod
    def validateClass(class_):
        if class_.version == '':
            raise ParseError("empty release string")

    def openSourceFile(self, path):
        return self._openSourceFileFn(path)

FactoryRecipe = '''
from conary.build import recipe
class FactoryRecipe(AbstractPackageRecipe, BaseRequiresRecipe):
    name = '%(name)s'
    version = '%(version)s'
    abstractBaseClass = True

    originalFactoryClass = None
    _sourcePath = None
    _trove = None

    def __init__(r, *arg, **kw):
        assert r.originalFactoryClass is not None,\
            'You must set the originalFactoryClass before creating the FactoryRecipe object')
        AbstractPackageRecipe.__init__(r, *arg, **kw)

    def setup(r):
        pass

    def setupAbstractBaseClass(r):
        AbstractPackageRecipe.setupAbstractBaseClass(r)
        ofc = r.originalFactoryClass
        # getAdditionalSourceFiles has to be a static or class
        # method
        if  hasattr(ofc, "getAdditionalSourceFiles"):
            additionalFiles = ofc.getAdditionalSourceFiles()
            for ent in additionalFiles:
                srcFile, destLoc = ent[:2]
{'fraction_non_alphanumeric': 0.07097305081259, 'fraction_numerical': 0.003702941781526435, 'mean_word_length': 3.4079782411604715, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3478774', 'n_tokens_mistral': 1349, 'n_tokens_neox': 1304, 'n_words': 436}