<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import random
from datetime import datetime

from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone


from opps.core.models import Publishable, Slugged
from opps.core.tags.models import Tagged


def get_file_path(instance, filename):
    ext = filename.split('.')[-1]
    filename = u"{0}-{1}.{2}".format(random.getrandbits(32),
                                     instance.slug[:100], ext)
    d = datetime.now()
    folder = u"archives/{0}".format(d.strftime("%Y/%m/%d/"))
    return os.path.join(folder, filename)


class Archive(Publishable, Slugged):

    title = models.CharField(_(u"Title"), max_length=140, db_index=True)
    archive = models.FileField(upload_to=get_file_path, max_length=255)
    description = models.TextField(_(u"Description"), null=True, blank=True)

    source = models.ForeignKey('sources.Source', null=True, blank=True)

    class Meta:<commit_msg>format clean on archives in get_file_path<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import random
from datetime import datetime

from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils import timezone


from opps.core.models import Publishable, Slugged
from opps.core.tags.models import Tagged


def get_file_path(instance, filename):
    ext = filename.split('.')[-1]
    filename = u"{}-{}.{}".format(random.getrandbits(32),
                                  instance.slug[:100], ext)
    d = datetime.now()
    folder = u"archives/{}".format(d.strftime("%Y/%m/%d/"))
    return os.path.join(folder, filename)


class Archive(Publishable, Slugged):

    title = models.CharField(_(u"Title"), max_length=140, db_index=True)
    archive = models.FileField(upload_to=get_file_path, max_length=255)
    description = models.TextField(_(u"Description"), null=True, blank=True)

    source = models.ForeignKey('sources.Source', null=True, blank=True)

    class Meta:
{'fraction_non_alphanumeric': 0.13638577691183634, 'fraction_numerical': 0.014612761811982464, 'mean_word_length': 3.9256594724220624, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5275976', 'n_tokens_mistral': 674, 'n_tokens_neox': 644, 'n_words': 144}