<commit_before>import settings


def group_by_domain(domain, include_docs=True, **kwargs):
    from corehq.apps.groups.models import Group
    return Group.view(
        'groups/by_domain',
        key=domain,
        include_docs=include_docs,
        **kwargs
    )


def stale_group_by_domain(domain, include_docs=True, **kwargs):
    return group_by_domain(
        domain,
        include_docs=include_docs,
        stale=settings.COUCH_STALE_QUERY,
        **kwargs
    )


def group_by_name(domain, name, include_docs=True, **kwargs):
    from corehq.apps.groups.models import Group
    return Group.view(
        'groups/by_name',
        key=[domain, name],
        include_docs=include_docs,
        **kwargs
    )


def stale_group_by_name(domain, name, include_docs=True, **kwargs):
    return group_by_name(
        domain,
        name,
        include_docs=include_docs,
        stale=settings.COUCH_STALE_QUERY,
        **kwargs
    )


def refresh_group_views(group):
    group_by_domain(group.domain)
    group_by_name(group.domain, group.name)<commit_msg>actually execute queries when refreshing<commit_after>import settings


def group_by_domain(domain, include_docs=True, **kwargs):
    from corehq.apps.groups.models import Group
    return Group.view(
        'groups/by_domain',
        key=domain,
        include_docs=include_docs,
        **kwargs
    )


def stale_group_by_domain(domain, include_docs=True, **kwargs):
    return group_by_domain(
        domain,
        include_docs=include_docs,
        stale=settings.COUCH_STALE_QUERY,
        **kwargs
    )


def group_by_name(domain, name, include_docs=True, **kwargs):
    from corehq.apps.groups.models import Group
    return Group.view(
        'groups/by_name',
        key=[domain, name],
        include_docs=include_docs,
        **kwargs
    )


def stale_group_by_name(domain, name, include_docs=True, **kwargs):
    return group_by_name(
        domain,
        name,
        include_docs=include_docs,
        stale=settings.COUCH_STALE_QUERY,
        **kwargs
    )


def refresh_group_views(group):
    group_by_domain(group.domain).all()
    group_by_name(group.domain, group.name).all()
{'fraction_non_alphanumeric': 0.0978509373571102, 'fraction_numerical': 0.0, 'mean_word_length': 2.9854280510018216, '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': '1535962', 'n_tokens_mistral': 711, 'n_tokens_neox': 693, 'n_words': 121}