<commit_before>#coding: utf-8
import os, time
#import random

from django.db import models
from django.contrib.auth.models import User
from django.core.files.storage import default_storage
from django.db.models import Max
from django.utils.translation import ugettext_lazy as _

from generic_images.signals import image_saved, image_deleted
from generic_images.managers import AttachedImageManager
from generic_utils.models import GenericModelBase
from django.conf import settings
from athumb.fields import ImageWithThumbsField
from athumb.backends.s3boto import S3BotoStorage_AllPublic
PUBLIC_MEDIA_BUCKET = S3BotoStorage_AllPublic(settings.AWS_STORAGE_BUCKET_NAME)


class BaseImageModel(models.Model):
    ''' Simple abstract Model class with image field.

        .. attribute:: image

            ``models.ImageField``
    '''

    def get_upload_path(self, filename):
        ''' Override this to customize upload path '''
        raise NotImplementedError

    def _upload_path_wrapper(self, filename):
        return self.get_upload_path(filename)

    image = ImageWithThumbsField(
        _('Image'),
        thumbnail_format='jpeg',
        upload_to=_upload_path_wrapper,
        blank=True, null=True,
        storage=PUBLIC_MEDIA_BUCKET,
        thumbs=(
        ('100x100', {'size': (100, 100), 'crop':False, 'upscale': False }),
        ('300x300', {'size': (300, 300), 'crop':False, 'upscale': False }),
        ('480x1500', {'size': (480, 1500), 'crop':False, 'upscale': False }),
        ('300x100', {'size': (300, 100), 'crop':False, 'upscale': False}),
        ('130x100', {'size': (130, 100), 'crop': False, 'upscale': False}),
        ('130x100_crop', {'size': (130, 100), 'crop': 'center',
                          'upscale': False}),
        ))
<commit_msg>image shuold be mandatory<commit_after>#coding: utf-8
import os, time
#import random

from django.db import models
from django.contrib.auth.models import User
from django.core.files.storage import default_storage
from django.db.models import Max
from django.utils.translation import ugettext_lazy as _

from generic_images.signals import image_saved, image_deleted
from generic_images.managers import AttachedImageManager
from generic_utils.models import GenericModelBase
from django.conf import settings
from athumb.fields import ImageWithThumbsField
from athumb.backends.s3boto import S3BotoStorage_AllPublic
PUBLIC_MEDIA_BUCKET = S3BotoStorage_AllPublic(settings.AWS_STORAGE_BUCKET_NAME)


class BaseImageModel(models.Model):
    ''' Simple abstract Model class with image field.

        .. attribute:: image

            ``models.ImageField``
    '''

    def get_upload_path(self, filename):
        ''' Override this to customize upload path '''
        raise NotImplementedError

    def _upload_path_wrapper(self, filename):
        return self.get_upload_path(filename)

    image = ImageWithThumbsField(
        _('Image'),
        thumbnail_format='jpeg',
        upload_to=_upload_path_wrapper,
        storage=PUBLIC_MEDIA_BUCKET,
        thumbs=(
        ('100x100', {'size': (100, 100), 'crop':False, 'upscale': False }),
        ('300x300', {'size': (300, 300), 'crop':False, 'upscale': False }),
        ('480x1500', {'size': (480, 1500), 'crop':False, 'upscale': False }),
        ('300x100', {'size': (300, 100), 'crop':False, 'upscale': False}),
        ('130x100', {'size': (130, 100), 'crop': False, 'upscale': False}),
        ('130x100_crop', {'size': (130, 100), 'crop': 'center',
                          'upscale': False}),
        ))

{'fraction_non_alphanumeric': 0.12574006202424584, 'fraction_numerical': 0.04398082886946716, 'mean_word_length': 3.7433155080213902, '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': '2231878', 'n_tokens_mistral': 1188, 'n_tokens_neox': 1069, 'n_words': 273}