<commit_before>import datetime
import glob
import os

from django.conf import settings
from django.db import models
from django.utils.html import escapejs


DEFAULT_POSTS_PER_PAGE = 10

THEME_PATHS = glob.glob(os.path.join(os.path.dirname(__file__),
                                     'templates', 'tumbledore', 'themes', '*'))
for location in settings.TEMPLATE_DIRS:
    THEME_PATHS += glob.glob(os.path.join(location, 'tumbledore', 'themes', '*'))
TUMBL_THEME_CHOICES = [(path, path.split('/')[-1]) for path in THEME_PATHS]


class Tumblelog(models.Model):
    name = models.CharField(max_length=200,
                            help_text='This will display in the header area of your tumblelog.')
    description = models.TextField(blank=True, default='',
                                   help_text='This will display below the name.')
    mount_on = models.CharField(max_length=200, blank=True, default='',
                                unique=True, db_index=True,
                                help_text="The root url of your tumblelog.")
    theme = models.CharField(max_length=255, choices=TUMBL_THEME_CHOICES)
    posts_per_page = models.IntegerField(default=DEFAULT_POSTS_PER_PAGE)
    widgets = models.ManyToManyField('TumblelogWidget', through='TumblelogWidgetPlacement')
    extra_styles = models.TextField(blank=True, default='',
                                    help_text='Inserted before the close of the head tag.')
    extra_scripts = models.TextField(blank=True, default='',
                                     help_text='Inserted before the close of the body tag.')
    is_active = models.BooleanField(default=True)
    created_at = models.DateTimeField(auto_now_add=True, editable=False)
    updated_at = models.DateTimeField(auto_now=True, editable=False)

    class Meta:
        pass

    def __unicode__(self):
        return unicode(self.name)


class TumblelogPostManager(models.Manager):
    def published(qset):
        return qset.filter(is_published=True)<commit_msg>strip leading / trailing slashes from mount point<commit_after>import datetime
import glob
import os

from django.conf import settings
from django.db import models
from django.utils.html import escapejs


DEFAULT_POSTS_PER_PAGE = 10

THEME_PATHS = glob.glob(os.path.join(os.path.dirname(__file__),
                                     'templates', 'tumbledore', 'themes', '*'))
for location in settings.TEMPLATE_DIRS:
    THEME_PATHS += glob.glob(os.path.join(location, 'tumbledore', 'themes', '*'))
TUMBL_THEME_CHOICES = [(path, path.split('/')[-1]) for path in THEME_PATHS]


class Tumblelog(models.Model):
    name = models.CharField(max_length=200,
                            help_text='This will display in the header area of your tumblelog.')
    description = models.TextField(blank=True, default='',
                                   help_text='This will display below the name.')
    mount_on = models.CharField(max_length=200, blank=True, default='',
                                unique=True, db_index=True,
                                help_text="The root url of your tumblelog.")
    theme = models.CharField(max_length=255, choices=TUMBL_THEME_CHOICES)
    posts_per_page = models.IntegerField(default=DEFAULT_POSTS_PER_PAGE)
    widgets = models.ManyToManyField('TumblelogWidget', through='TumblelogWidgetPlacement')
    extra_styles = models.TextField(blank=True, default='',
                                    help_text='Inserted before the close of the head tag.')
    extra_scripts = models.TextField(blank=True, default='',
                                     help_text='Inserted before the close of the body tag.')
    is_active = models.BooleanField(default=True)
    created_at = models.DateTimeField(auto_now_add=True, editable=False)
    updated_at = models.DateTimeField(auto_now=True, editable=False)

    class Meta:
        pass

    def __unicode__(self):
        return unicode(self.name)

    def save(self, **kwargs):
        self.mount_on = self.mount_on.strip('/')

        super(Tumblelog, self).save(**kwargs)


class TumblelogPostManager(models.Manager):
    def published(qset):
        return qset.filter(is_published=True)
{'fraction_non_alphanumeric': 0.10332456350155465, 'fraction_numerical': 0.005740253527864147, 'mean_word_length': 2.937853107344633, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6397716', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1184, 'n_words': 264}