<commit_before>import os
import json
import collections
import re
import sys
import array

try:
    from jinja2 import Environment
    from jinja2 import FileSystemLoader
except ImportError as e:
    if 'sdk-core' in sys.prefix :
        message = 'Jinja2 module is missing, you probably forgot to patch your current sdk\n'
        message += 'Fix the problem by executing the following command and relaunch your build:\n\n'
        message += 'pip install --target="%s/lib/python2.7/site-packages/" -r "%s/requirements.txt"\n' % (sys.prefix, os.path.dirname(os.path.abspath(__file__)))
        print message
        sys.exit(-1)
    else :
        raise e

def cvarname(name):
    """Convert a string to a valid c variable name (remove space,commas,slashes/...)."""
    return re.sub(r'([^\w\s]| )', '_', name)

def getid(item):
    """Return an identifier for the given config item, takes 'id' if it exists or 'messageKey'"""
    return item['id'] if 'id' in item else item['messageKey']

def maxdictsize(item):
    """Return the maximum size of the item in the dictionary"""
    size = 0
    if item['type'] == 'select' or item['type'] == 'radiogroup' :
        for option in item['options'] :
            size = max(size, len(str(option['value'])) + 1)
    return size

def getdefines(capabilities):
    """Generate the #define for the given capabilities"""
    if len(capabilities) == 0 :
        return "1"
    cap2defines = {<commit_msg>improve jinja installation instruction for osx<commit_after>import os
import json
import collections
import re
import sys
import array

try:
    from jinja2 import Environment
    from jinja2 import FileSystemLoader
except ImportError as e:
    if 'sdk-core' in sys.prefix :
        message = 'Jinja2 module is missing, you probably forgot to patch your current sdk\n'
        message += 'Fix the problem by executing the following command and relaunch your build:\n\n'
        message += '"%s/bin/python" -m pip install -r "%s/requirements.txt"\n' % (sys.prefix, os.path.dirname(os.path.abspath(__file__)))
        print message
        sys.exit(-1)
    else :
        raise e

def cvarname(name):
    """Convert a string to a valid c variable name (remove space,commas,slashes/...)."""
    return re.sub(r'([^\w\s]| )', '_', name)

def getid(item):
    """Return an identifier for the given config item, takes 'id' if it exists or 'messageKey'"""
    return item['id'] if 'id' in item else item['messageKey']

def maxdictsize(item):
    """Return the maximum size of the item in the dictionary"""
    size = 0
    if item['type'] == 'select' or item['type'] == 'radiogroup' :
        for option in item['options'] :
            size = max(size, len(str(option['value'])) + 1)
    return size

def getdefines(capabilities):
    """Generate the #define for the given capabilities"""
    if len(capabilities) == 0 :
        return "1"
    cap2defines = {
{'fraction_non_alphanumeric': 0.12633759061097688, 'fraction_numerical': 0.0069036934760096655, 'mean_word_length': 3.175792507204611, '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': '2031326', 'n_tokens_mistral': 886, 'n_tokens_neox': 865, 'n_words': 316}