<commit_before>from django.utils.text import slugify

from guardian.shortcuts import get_perms


def build_org_group_name(org_name, group):
    '''Returns org group name in the form of <ORGNAME>_ORG_<GROUP>'''
    return f'{slugify({org_name})}_ORG_{group}'.upper()


def build_study_group_name(org_name, study_name, study_pk, group):
    '''Returns org group name in the form of <ORGNAME>_ORG_<GROUP>'''
    return f'{slugify({org_name})}_{slugify({study_name})}_{study_pk}_STUDY_{group}'.upper()

status_tooltip_text = {
    'created': 'Study has not been submitted for approval',
    'active': 'Study is collecting data',
    'submitted': 'Study is awaiting approval',
    'draft': 'Study has not been submitted for approval',
    'approved': 'Study is approved but not started',
    'rejected': 'Study has been rejected. Please edit before resubmitting.',
    'retracted': 'Study has been withdrawn',
    'paused': 'Study is not collecting data',
    'deactivated': 'Study is not collecting data',
    'archived': 'Study has been archived and removed from search.'
}


def get_permitted_triggers(view_instance, triggers):
    ''' Get permitted triggers for study state '''
    permitted_triggers = []
    user = view_instance.request.user
    study = view_instance.object
    organization_permissions = get_perms(user, study)
    study_permissions = get_perms(user, view_instance.object )

    admin_triggers = ['approve', 'reject']
    for trigger in triggers:
        # remove autogenerated triggers
        if trigger.startswith('to_'):<commit_msg>Remove unused line.<commit_after>from django.utils.text import slugify

from guardian.shortcuts import get_perms


def build_org_group_name(org_name, group):
    '''Returns org group name in the form of <ORGNAME>_ORG_<GROUP>'''
    return f'{slugify({org_name})}_ORG_{group}'.upper()


def build_study_group_name(org_name, study_name, study_pk, group):
    '''Returns org group name in the form of <ORGNAME>_ORG_<GROUP>'''
    return f'{slugify({org_name})}_{slugify({study_name})}_{study_pk}_STUDY_{group}'.upper()

status_tooltip_text = {
    'created': 'Study has not been submitted for approval',
    'active': 'Study is collecting data',
    'submitted': 'Study is awaiting approval',
    'draft': 'Study has not been submitted for approval',
    'approved': 'Study is approved but not started',
    'rejected': 'Study has been rejected. Please edit before resubmitting.',
    'retracted': 'Study has been withdrawn',
    'paused': 'Study is not collecting data',
    'deactivated': 'Study is not collecting data',
    'archived': 'Study has been archived and removed from search.'
}


def get_permitted_triggers(view_instance, triggers):
    ''' Get permitted triggers for study state '''
    permitted_triggers = []
    user = view_instance.request.user
    study = view_instance.object
    study_permissions = get_perms(user, view_instance.object )

    admin_triggers = ['approve', 'reject']
    for trigger in triggers:
        # remove autogenerated triggers
        if trigger.startswith('to_'):
{'fraction_non_alphanumeric': 0.11528412802090138, 'fraction_numerical': 0.0, 'mean_word_length': 4.548913043478261, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '6153912', 'n_tokens_mistral': 965, 'n_tokens_neox': 906, 'n_words': 276}