<commit_before>from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import Permission
from bullet_train import BulletTrain
from django.conf import settings


def create_mc_permission(permission):
    ct, _ = ContentType.objects.get_or_create(
        app_label="mc",
        model=permission.content_type.model)
    new_perm, _ = Permission.objects.get_or_create(
        name=permission.name,
        content_type=ct,
        codename=permission.codename)
    for group in permission.group_set.all():
        group.permissions.add(new_perm)
    for user in permission.user_set.all():
        user.user_permissions.add(new_perm)


def bullet_train_has_feature(feature_name):
    bt = BulletTrain(environment_id=settings.BULLET_TRAIN_API_KEY)
    if bt:
        if bt.has_feature(feature_name):<commit_msg>[AC-8169] remove extra quotes in bullet_train key<commit_after>from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import Permission
from bullet_train import BulletTrain
from django.conf import settings


def create_mc_permission(permission):
    ct, _ = ContentType.objects.get_or_create(
        app_label="mc",
        model=permission.content_type.model)
    new_perm, _ = Permission.objects.get_or_create(
        name=permission.name,
        content_type=ct,
        codename=permission.codename)
    for group in permission.group_set.all():
        group.permissions.add(new_perm)
    for user in permission.user_set.all():
        user.user_permissions.add(new_perm)


def bullet_train_has_feature(feature_name):
    if settings.BULLET_TRAIN_API_KEY:
        bullet_tran_key = settings.BULLET_TRAIN_API_KEY.strip('"')
    else:
        bullet_tran_key = ''
    bt = BulletTrain(environment_id=bullet_tran_key)
    if bt:
        if bt.has_feature(feature_name):
{'fraction_non_alphanumeric': 0.08423326133909287, 'fraction_numerical': 0.0021598272138228943, 'mean_word_length': 3.941333333333333, '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': '7618090', 'n_tokens_mistral': 582, 'n_tokens_neox': 560, 'n_words': 101}