<commit_before>import urlparse

from django.apps import apps
from django.conf import settings
from django.http import QueryDict


def querydict_from_dict(input_dict):
    """
    Given a dict, return a QueryDict.
    """
    querydict = QueryDict('', mutable=True)
    querydict.update(input_dict)

    return querydict


def full_url(url_fragment):
    """
    Given a fragment, return that fragment joined to the full Open Humans URL.
    """
    return urlparse.urljoin(settings.DEFAULT_HTTP_PROTOCOL + '://' +
                            settings.DOMAIN,
                            url_fragment)

def get_source_labels_and_configs():
    """
    Return a list of all current data source app labels and names.
    """
    sources = [(app_config.label, app_config)
               for app_config in apps.get_app_configs()
               if app_config.name.startswith('studies.') or
               app_config.name.startswith('activities.')]

    return sorted(sources, key=lambda x: x[1].verbose_name)


def get_activities():
    """
    Get just the activities.
    """
    return [activity for activity in get_source_labels_and_configs()
            if activity[1].name.startswith('activities.')]


def get_studies():
    """
    Get just the studies.
    """
    return [study for study in get_source_labels_and_configs()
            if study[1].name.startswith('studies.')]
<commit_msg>🐛 sort on lowercase verbose_name<commit_after>import urlparse

from django.apps import apps
from django.conf import settings
from django.http import QueryDict


def querydict_from_dict(input_dict):
    """
    Given a dict, return a QueryDict.
    """
    querydict = QueryDict('', mutable=True)
    querydict.update(input_dict)

    return querydict


def full_url(url_fragment):
    """
    Given a fragment, return that fragment joined to the full Open Humans URL.
    """
    return urlparse.urljoin(settings.DEFAULT_HTTP_PROTOCOL + '://' +
                            settings.DOMAIN,
                            url_fragment)


def get_source_labels_and_configs():
    """
    Return a list of all current data source app labels and names.
    """
    sources = [(app_config.label, app_config)
               for app_config in apps.get_app_configs()
               if app_config.name.startswith('studies.') or
               app_config.name.startswith('activities.')]

    return sorted(sources, key=lambda x: x[1].verbose_name.lower())


def get_activities():
    """
    Get just the activities.
    """
    return [activity for activity in get_source_labels_and_configs()
            if activity[1].name.startswith('activities.')]


def get_studies():
    """
    Get just the studies.
    """
    return [study for study in get_source_labels_and_configs()
            if study[1].name.startswith('studies.')]

{'fraction_non_alphanumeric': 0.100355871886121, 'fraction_numerical': 0.002135231316725979, 'mean_word_length': 2.6841415465268676, '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': '603560', 'n_tokens_mistral': 841, 'n_tokens_neox': 813, 'n_words': 214}