<commit_before>import random
import calendar

from django.template import Library
from django.core.urlresolvers import reverse

from mezzanine.pages.models import Page
from mezzanine.conf import settings


register = Library()


@register.filter
def get_range(value):
    return range(value)


@register.filter
def get_absolute_url(obj):
    return obj.get_absolute_url()


@register.filter
def group_by(l, n):
    if l is None:
        return None
    return [l[i:i + n] for i in range(0, len(l), n)]


@register.filter
def get_type(object):
    return object.__class__.__name__.lower()


@register.filter
def get_random(obj, upper):
    return "%s%d" % (obj, random.randint(1, upper))


@register.filter
def get_request_url(obj, request):
    return request.build_absolute_uri(obj.get_absolute_url)


@register.filter
def lower(type):
    return type.lower()

<commit_msg>get_absolute_url may be a prop or method<commit_after>import random
import calendar
import inspect

from django.template import Library
from django.core.urlresolvers import reverse

from mezzanine.pages.models import Page
from mezzanine.conf import settings


register = Library()


@register.filter
def get_range(value):
    return range(value)


@register.filter
def get_absolute_url(obj):
    return obj.get_absolute_url()


@register.filter
def group_by(l, n):
    if l is None:
        return None
    return [l[i:i + n] for i in range(0, len(l), n)]


@register.filter
def get_type(object):
    return object.__class__.__name__.lower()


@register.filter
def get_random(obj, upper):
    return "%s%d" % (obj, random.randint(1, upper))


@register.filter
def get_request_url(obj, request):
    if inspect.ismethod(getattr(obj, 'get_absolute_url')):
        url = obj.get_absolute_url()
    else:
        url = obj.get_absolute_url
    return request.build_absolute_uri(url)


@register.filter
def lower(type):
    return type.lower()


{'fraction_non_alphanumeric': 0.10397074190177638, 'fraction_numerical': 0.0020898641588296763, 'mean_word_length': 4.2754820936639115, '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': '5315508', 'n_tokens_mistral': 638, 'n_tokens_neox': 616, 'n_words': 168}