<commit_before># coding: utf-8

from numbers import Number

from django import template

register = template.Library()


@register.filter
def subtract(lhs, rhs):
    rhs = int(rhs) if not isinstance(rhs, Number) else rhs
    lhs = int(lhs) if not isinstance(lhs, Number) else lhs
    return rhs - lhs


@register.filter
def divide(lhs, rhs):
    lhs = float(lhs) if not isinstance(lhs, Number) else lhs
    rhs = float(rhs) if not isinstance(rhs, Number) else rhs
    return lhs / rhs if rhs else None


@register.filter
def contains(enumeratable, obj):
    return obj in enumeratable


@register.filter
def split(value, separator=' '):
    return value.split(separator)


@register.filter
def eq(lhs, rhs):
    return lhs == rhs


@register.filter
def neq(lhs, rhs):
    return lhs != rhs


@register.filter
def yes(lhs, rhs, default=""):
    return rhs if lhs else default


@register.filter
def no(lhs, rhs, default=""):
    return rhs if not lhs else default<commit_msg>Added "get" template filter to vpfilters<commit_after># coding: utf-8

from numbers import Number

from django import template

register = template.Library()


@register.filter
def subtract(lhs, rhs):
    rhs = int(rhs) if not isinstance(rhs, Number) else rhs
    lhs = int(lhs) if not isinstance(lhs, Number) else lhs
    return rhs - lhs


@register.filter
def divide(lhs, rhs):
    lhs = float(lhs) if not isinstance(lhs, Number) else lhs
    rhs = float(rhs) if not isinstance(rhs, Number) else rhs
    return lhs / rhs if rhs else None


@register.filter
def contains(enumeratable, obj):
    return obj in enumeratable


@register.filter
def split(value, separator=' '):
    return value.split(separator)


@register.filter
def eq(lhs, rhs):
    return lhs == rhs


@register.filter
def neq(lhs, rhs):
    return lhs != rhs


@register.filter
def yes(lhs, rhs, default=""):
    return rhs if lhs else default


@register.filter
def no(lhs, rhs, default=""):
    return rhs if not lhs else default


@register.filter
def get(obj, key):
    return obj[key]
{'fraction_non_alphanumeric': 0.10526315789473684, 'fraction_numerical': 0.000983767830791933, 'mean_word_length': 3.7858823529411763, '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': '5915103', 'n_tokens_mistral': 674, 'n_tokens_neox': 662, 'n_words': 238}