<commit_before># <NAME> <<EMAIL>>
import os

##____________________________________________________________________________||
class WeightCalculatorOne(object):
    def __call__(self, event):
        return 1.0

##__________________________________________________________________||
def createOutFileName(columnNames, indices, prefix = 'tbl_component_', suffix = '.txt'):
    # for example, if columnNames = ('var1', 'var2', 'var3') and indices = (1, None, 2),
    # l will be ['var1', '1', 'var2', 'var3', '2']
    l = columnNames if indices is None else [str(e) for sublist in zip(columnNames, indices) for e in sublist if e is not None]
    ret = prefix + '_'.join(l) + suffix # e.g. "tbl_component_var1_1_var2_var3_2.txt"
    return ret

##__________________________________________________________________||
class TableConfigCompleter(object):
    def __init__(self, defaultCountsClass, outDir):
        self.defaultCountsClass = defaultCountsClass
        self.outDir = outDir

    def complete(self, tblcfg):
        ret = tblcfg.copy()
        if 'outColumnNames' not in ret: ret['outColumnNames'] = ret['branchNames']
        if 'indices' not in ret: ret['indices'] = None
        if 'countsClass' not in ret: ret['countsClass'] = self.defaultCountsClass
        if 'outFile' not in ret: ret['outFile'] = True
        if 'weight' not in ret: ret['weight'] = WeightCalculatorOne()
        if ret['outFile']:
            if 'outFileName' not in ret: ret['outFileName'] = createOutFileName(ret['outColumnNames'], ret['indices'])
            if 'outFilePath' not in ret: ret['outFilePath'] = os.path.join(self.outDir, ret['outFileName'])
            return ret

##__________________________________________________________________||<commit_msg>add a new variable defaultWeight to TableConfigCompleter<commit_after># <NAME> <<EMAIL>>
import os

##____________________________________________________________________________||
class WeightCalculatorOne(object):
    def __call__(self, event):
        return 1.0

##__________________________________________________________________||
def createOutFileName(columnNames, indices, prefix = 'tbl_component_', suffix = '.txt'):
    # for example, if columnNames = ('var1', 'var2', 'var3') and indices = (1, None, 2),
    # l will be ['var1', '1', 'var2', 'var3', '2']
    l = columnNames if indices is None else [str(e) for sublist in zip(columnNames, indices) for e in sublist if e is not None]
    ret = prefix + '_'.join(l) + suffix # e.g. "tbl_component_var1_1_var2_var3_2.txt"
    return ret

##__________________________________________________________________||
class TableConfigCompleter(object):
    def __init__(self, defaultCountsClass, outDir):
        self.defaultCountsClass = defaultCountsClass
        self.defaultWeight = WeightCalculatorOne()
        self.outDir = outDir

    def complete(self, tblcfg):
        ret = tblcfg.copy()
        if 'outColumnNames' not in ret: ret['outColumnNames'] = ret['branchNames']
        if 'indices' not in ret: ret['indices'] = None
        if 'countsClass' not in ret: ret['countsClass'] = self.defaultCountsClass
        if 'outFile' not in ret: ret['outFile'] = True
        if 'weight' not in ret: ret['weight'] = self.defaultWeight
        if ret['outFile']:
            if 'outFileName' not in ret: ret['outFileName'] = createOutFileName(ret['outColumnNames'], ret['indices'])
            if 'outFilePath' not in ret: ret['outFilePath'] = os.path.join(self.outDir, ret['outFileName'])
            return ret

##__________________________________________________________________||
{'fraction_non_alphanumeric': 0.12008916132627473, 'fraction_numerical': 0.009473390916689885, 'mean_word_length': 4.294985250737463, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4322433', 'n_tokens_mistral': 981, 'n_tokens_neox': 966, 'n_words': 286}