<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import template
from ..generate import image_url as url


register = template.Library()


@register.simple_tag
def image_url(image_url, **kwargs):
    return url(image_url=image_url, **kwargs)


@register.simple_tag
def image_obj(image, **kwargs):
    new = {}
    new['flip'] = image.flip
    new['flop'] = image.flop
    """
    if image.halign != "":
        new['halign'] = image.halign
    if image.valign != "":
        new['valign'] = image.valign
    """
    new['fit_in'] = image.fit_in
    new['smart'] = image.smart

    if image.crop_x1 > 0 or image.crop_x2 > 0 or image.crop_y1 > 0 or \
       image.crop_y2 > 0:
        new['crop'] = ((image.crop_y1, image.crop_y2),
                       (image.crop_x1, image.crop_x2))

    kwargs = dict(new, **kwargs)
    return url(image_url=image.image.url, **kwargs)<commit_msg>Invert x per y on image_obj<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import template
from ..generate import image_url as url


register = template.Library()


@register.simple_tag
def image_url(image_url, **kwargs):
    return url(image_url=image_url, **kwargs)


@register.simple_tag
def image_obj(image, **kwargs):
    new = {}
    new['flip'] = image.flip
    new['flop'] = image.flop
    """
    if image.halign != "":
        new['halign'] = image.halign
    if image.valign != "":
        new['valign'] = image.valign
    """
    new['fit_in'] = image.fit_in
    new['smart'] = image.smart

    if image.crop_x1 > 0 or image.crop_x2 > 0 or image.crop_y1 > 0 or \
       image.crop_y2 > 0:
        new['crop'] = ((image.crop_x1, image.crop_x2),
                       (image.crop_y1, image.crop_y2))

    kwargs = dict(new, **kwargs)
    return url(image_url=image.image.url, **kwargs)
{'fraction_non_alphanumeric': 0.15772179627601315, 'fraction_numerical': 0.014238773274917854, 'mean_word_length': 2.80625, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 11, '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': '1545762', 'n_tokens_mistral': 683, 'n_tokens_neox': 655, 'n_words': 138}