<commit_before>from django.db.models import Field
from django.forms import widgets
from s3direct.widgets import S3DirectEditor
from django.conf import settings


class S3DirectField(Field):
    def __init__(self, *args, **kwargs):
        upload_to = kwargs.pop('upload_to', '')
        self.widget = S3DirectEditor(upload_to=upload_to)
        super(S3DirectField, self).__init__(*args, **kwargs)

    def get_internal_type(self):
        return "TextField"

    def formfield(self, **kwargs):
        defaults = {'widget': self.widget}
        defaults.update(kwargs)
        return super(S3DirectField, self).formfield(**defaults)


if 'south' in settings.INSTALLED_APPS:
    from south.modelsinspector import add_introspection_rules
    add_introspection_rules([], ["^s3direct\.fields\.S3DirectField"])<commit_msg>Return a URL field.<commit_after>from django.db.models import Field
from django.conf import settings
from s3direct.widgets import S3DirectWidget


S3DIRECT_DIR = getattr(settings, 'S3DIRECT_DIR', 's3direct')


class S3DirectField(Field):
    def __init__(self, upload_to=S3DIRECT_DIR):
        self.widget = S3DirectWidget(upload_to=upload_to)
        super(S3DirectField, self).__init__()

    def get_internal_type(self):
        return 'URLField'

    def formfield(self, **kwargs):
        defaults = {'widget': self.widget}
        defaults.update(kwargs)
        return super(S3DirectField, self).formfield(**defaults)


if 'south' in settings.INSTALLED_APPS:
    from south.modelsinspector import add_introspection_rules
    add_introspection_rules([], ["^s3direct\.fields\.S3DirectField"])
{'fraction_non_alphanumeric': 0.10835913312693499, 'fraction_numerical': 0.01238390092879257, 'mean_word_length': 4.3509933774834435, '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': '1830610', 'n_tokens_mistral': 509, 'n_tokens_neox': 486, 'n_words': 104}