<commit_before># These are just for the users to loop over

categories = ['example']
regions    = ['signal']

# Two dictionaries to define the cuts for separate categories and control regions

categoryCuts = {
    'example' : '1'
    }

regionCuts = {
    'signal' : '1'
    }

# A weight applied to all MC

defaultMCWeight = 'mcWeight'

# Additional weights applied to certain control regions

additions    = { # key : [Data,MC]
    'signal'  : ['0','1'],
    'default' : ['1',defaultMCWeight]
    }

# Do not change the names of these functions or required parameters
# Otherwise you cannot use some convenience functions
# Generally you can probably leave these alone

def cut(category, region):
    return '((' + categoryCuts[category] + ') && (' + regionCuts[region] + '))'

def dataMCCuts(region, isData):
    key = 'default'
    if additions.get(region):
        key = region

    index = 1
    if isData:
        index = 0<commit_msg>Some more pythonic way of doing cuts.<commit_after># Two dictionaries to define the cuts for separate categories and control regions

categoryCuts = {
    'example' : '1'
    }


regionCuts = {
    'signal' : '1'
    }

# These are just for the users to loop over

categories = categoryCuts.keys()
regions    = regionCuts.keys()

# Making selection of multiple entries

def joinCuts(toJoin=regionCuts.keys(), cuts=regionCuts):
    return ' && '.join([cuts[cut] for cut in toJoin])

# A weight applied to all MC

defaultMCWeight = 'mcWeight'

# Additional weights applied to certain control regions

additions    = { # key : [Data,MC]
    'signal'  : ['0','1'],
    'default' : ['1',defaultMCWeight]
    }

# Do not change the names of these functions or required parameters
# Otherwise you cannot use some convenience functions
# Multiple regions are concatenated with '+'
# Generally you can probably leave these alone

def cut(category, region):
    return '((' + categoryCuts[category] + ') && (' + joinCuts(toJoin=region.split('+')) + '))'

def dataMCCuts(region, isData):
    key = 'default'
    if region in additions.keys():
        key = region

    index = 1
    if isData:
        index = 0
{'fraction_non_alphanumeric': 0.11437908496732026, 'fraction_numerical': 0.006535947712418301, 'mean_word_length': 3.409465020576132, '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': '7526086', 'n_tokens_mistral': 651, 'n_tokens_neox': 639, 'n_words': 228}