<commit_before>"""Thumbnail generation routines."""


import os

from PIL import Image  #@UnresolvedImport

from django.core.files.storage import default_storage
from django.utils import html


class Size(tuple):

    """Represents the size of an image."""
    
    __slots__ = ()
    
    def __new__(cls, width, height):
        """Creats a new Size."""
        return tuple.__new__(cls, (int(width), int(height)))
    
    @property
    def width(self):
        return self[0]
    
    @property
    def height(self):
        return self[1]
    
    @property
    def aspect(self):
        """Returns the aspect ratio of this size."""
        return float(self.width) / float(self.height)
    
    def intersect(self, size):
        """<commit_msg>Formalised new thumbnailing API.<commit_after>"""Thumbnail generation routines."""


import os

from PIL import Image  #@UnresolvedImport

from django.core.files.storage import default_storage
from django.utils import html


__all__ = ("create", "PROPORTIONAL", "RESIZED", "CROPPED",)


class Size(tuple):

    """Represents the size of an image."""
    
    __slots__ = ()
    
    def __new__(cls, width, height):
        """Creats a new Size."""
        return tuple.__new__(cls, (int(width), int(height)))
    
    @property
    def width(self):
        return self[0]
    
    @property
    def height(self):
        return self[1]
    
    @property
    def aspect(self):
        """Returns the aspect ratio of this size."""
        return float(self.width) / float(self.height)
    
    def intersect(self, size):
        """
{'fraction_non_alphanumeric': 0.12255211623499684, 'fraction_numerical': 0.002526847757422615, 'mean_word_length': 2.5918367346938775, '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': '4418676', 'n_tokens_mistral': 479, 'n_tokens_neox': 465, 'n_words': 138}