<commit_before>import os

import jinja2
import PIL

from ..memberlookup import message_to_author
from ..statistic import statistic


class ScaledImage(object):
    def __init__(self, image_filename, max_height=200, max_width=200):
        self.link = image_filename
        pil_image = PIL.Image.open(image_filename)
        (self.width, self.height) = pil_image.size
        if self.height > max_height:
            self._resize(float(max_height) / self.height)
        if self.width > max_width:
            self._resize(float(max_width) / self.width)
        self.height = int(self.height)
        self.width = int(self.width)
    def _resize(self, scale):
        self.height *= scale
        self.width *= scale


@statistic
class MostHearted(object):
    def __init__(self, num_to_show=5):
        self._num_to_show = num_to_show

    def calculate(self, group, messages, **kwargs):
        heart_ordered = sorted(messages, reverse=True,
                               key=lambda message: len(message.favorited_by))<commit_msg>Increase number of most hearted stat to show<commit_after>import os

import jinja2
import PIL

from ..memberlookup import message_to_author
from ..statistic import statistic


class ScaledImage(object):
    def __init__(self, image_filename, max_height=200, max_width=200):
        self.link = image_filename
        pil_image = PIL.Image.open(image_filename)
        (self.width, self.height) = pil_image.size
        if self.height > max_height:
            self._resize(float(max_height) / self.height)
        if self.width > max_width:
            self._resize(float(max_width) / self.width)
        self.height = int(self.height)
        self.width = int(self.width)
    def _resize(self, scale):
        self.height *= scale
        self.width *= scale


@statistic
class MostHearted(object):
    def __init__(self, num_to_show=10):
        self._num_to_show = num_to_show

    def calculate(self, group, messages, **kwargs):
        heart_ordered = sorted(messages, reverse=True,
                               key=lambda message: len(message.favorited_by))
{'fraction_non_alphanumeric': 0.09723546234509056, 'fraction_numerical': 0.008102955195424213, 'mean_word_length': 2.802536231884058, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1198392', 'n_tokens_mistral': 650, 'n_tokens_neox': 629, 'n_words': 142}