<commit_before>import logging

from pulsar import PermissionDenied
from pulsar.apps.wsgi import route, Json
from pulsar.utils.slugify import slugify

from lux import forms
from lux.extensions import rest

from .models import Repo, DataError


SLUG_LENGTH = 64
logger = logging.getLogger('lux.extensions.content')


class BlogForm(forms.Form):
    title = forms.CharField()
    slug = forms.CharField(required=False,
                           max_length=SLUG_LENGTH)
    author = forms.CharField()
    body = forms.TextField()
    tags = forms.CharField(required=False)
    published = forms.DateTimeField(required=False)


class TextCRUD(rest.RestRouter):
    '''CRUD views for the text APIs
    '''
    def __init__(self, name, path, *args, **kwargs):
        model = Repo(name, path, form=BlogForm)
        super().__init__(model, *args, **kwargs)

    def post(self, request):
        '''Create a new model
        '''
        backend = request.cache.auth_backend
        model = self.model
        if backend.has_permission(request, model.name, rest.CREATE):<commit_msg>added git repo content<commit_after>import logging

from pulsar import PermissionDenied
from pulsar.apps.wsgi import route, Json
from pulsar.utils.slugify import slugify

from lux import forms
from lux.extensions import rest

from .models import Content, DataError


SLUG_LENGTH = 64
logger = logging.getLogger('lux.extensions.content')


class BlogForm(forms.Form):
    title = forms.CharField()
    slug = forms.CharField(required=False,
                           max_length=SLUG_LENGTH)
    author = forms.CharField()
    body = forms.TextField()
    tags = forms.CharField(required=False)
    published = forms.DateTimeField(required=False)


class TextCRUD(rest.RestRouter):
    '''CRUD views for the text APIs
    '''
    def __init__(self, name, path, *args, **kwargs):
        model = Content(name, path, form=BlogForm)
        super().__init__(model, *args, **kwargs)

    def post(self, request):
        '''Create a new model
        '''
        backend = request.cache.auth_backend
        model = self.model
        if backend.has_permission(request, model.name, rest.CREATE):
{'fraction_non_alphanumeric': 0.10346420323325635, 'fraction_numerical': 0.0018475750577367205, 'mean_word_length': 3.263779527559055, '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': '3494323', 'n_tokens_mistral': 642, 'n_tokens_neox': 619, 'n_words': 168}