<commit_before># coding: utf-8

# PYTHON IMPORTS
import os

# DJANGO IMPORTS
from django.db import models
from django import forms
from django.forms.widgets import Input
from django.db.models.fields import Field, CharField
from django.utils.encoding import force_unicode
from django.template.loader import render_to_string
from django.utils.translation import ugettext_lazy as _
from django.core import urlresolvers

# FILEBROWSER IMPORTS
from filebrowser.settings import *
from filebrowser.base import FileObject
from filebrowser.sites import site


class FileBrowseWidget(Input):
    input_type = 'text'
    
    class Media:
        js = ('filebrowser/js/AddFileBrowser.js',)
    
    def __init__(self, attrs={}):
        super(FileBrowseWidget, self).__init__(attrs)
        self.site = attrs.get('filebrowser_site', None)
        self.directory = attrs.get('directory', '')
        self.extensions = attrs.get('extensions', '')
        self.format = attrs.get('format', '')
        if attrs is not None:
            self.attrs = attrs.copy()
        else:
            self.attrs = {}
        super(FileBrowseWidget, self).__init__(attrs)
    
    def render(self, name, value, attrs=None):
        url = urlresolvers.reverse(self.site.name + ":fb_browse")
        if value is None:
            value = ""
        if value != "" and not isinstance(value, FileObject):<commit_msg>tidy imports, fixed #195<commit_after># coding: utf-8

# PYTHON IMPORTS
import os

# DJANGO IMPORTS
from django.core import urlresolvers
from django.db import models
from django.db.models.fields import Field, CharField
from django import forms
from django.forms.widgets import Input
from django.template.loader import render_to_string
from django.utils.encoding import force_unicode
from django.utils.translation import ugettext_lazy as _

# FILEBROWSER IMPORTS
from filebrowser.settings import *
from filebrowser.base import FileObject
from filebrowser.sites import site


class FileBrowseWidget(Input):
    input_type = 'text'
    
    class Media:
        js = ('filebrowser/js/AddFileBrowser.js',)
    
    def __init__(self, attrs={}):
        super(FileBrowseWidget, self).__init__(attrs)
        self.site = attrs.get('filebrowser_site', None)
        self.directory = attrs.get('directory', '')
        self.extensions = attrs.get('extensions', '')
        self.format = attrs.get('format', '')
        if attrs is not None:
            self.attrs = attrs.copy()
        else:
            self.attrs = {}
        super(FileBrowseWidget, self).__init__(attrs)
    
    def render(self, name, value, attrs=None):
        url = urlresolvers.reverse(self.site.name + ":fb_browse")
        if value is None:
            value = ""
        if value != "" and not isinstance(value, FileObject):
{'fraction_non_alphanumeric': 0.10147535084562792, 'fraction_numerical': 0.0017992083483267362, 'mean_word_length': 3.136904761904762, 'pattern_counts': {'":': 2, '<': 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': '5356467', 'n_tokens_mistral': 821, 'n_tokens_neox': 822, 'n_words': 218}