<commit_before># awl.utils.py

from django.shortcuts import render_to_response
from django.template import RequestContext
from django.template.loader import render_to_string

# =============================================================================
# Template Methods
# =============================================================================

def render_page(request, page_name, data={}):
    """A shortcut for using ``render_to_response` with a
    :class:`RequestContext` automatically.
    """
    return render_to_response(page_name, data,
        context_instance=RequestContext(request))


def render_page_to_string(request, page_name, data={}):
    """A shortcut for using ``render_to_string` with a
    :class:`RequestContext` automatically.
    """
    return render_to_string(page_name, data,
        context_instance=RequestContext(request))

# ============================================================================
# Object Model Tools
# ============================================================================

def refetch(obj):
    """Queries the database for the same object that is passed in, refetching
    its contents in case they are stale.

    :param obj:
        Object to refetch

    :returns:
        Refreshed version of the object
    """<commit_msg>Fix docstring problem<commit_after># awl.utils.py

from django.shortcuts import render_to_response
from django.template import RequestContext
from django.template.loader import render_to_string

# =============================================================================
# Template Methods
# =============================================================================

def render_page(request, page_name, data={}):
    """A shortcut for using ``render_to_response`` with a
    :class:`RequestContext` automatically.
    """
    return render_to_response(page_name, data,
        context_instance=RequestContext(request))


def render_page_to_string(request, page_name, data={}):
    """A shortcut for using ``render_to_string`` with a
    :class:`RequestContext` automatically.
    """
    return render_to_string(page_name, data,
        context_instance=RequestContext(request))

# ============================================================================
# Object Model Tools
# ============================================================================

def refetch(obj):
    """Queries the database for the same object that is passed in, refetching
    its contents in case they are stale.

    :param obj:
        Object to refetch

    :returns:
        Refreshed version of the object
    """
{'fraction_non_alphanumeric': 0.30344827586206896, 'fraction_numerical': 0.0, 'mean_word_length': 5.511221945137157, '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': '5162811', 'n_tokens_mistral': 636, 'n_tokens_neox': 583, 'n_words': 172}