<commit_before>from django.forms.widgets import TextInput, Select

class NoNameWidget(object):
    
    def _update_to_noname_class_name(self, name, kwargs_dict):
        if "attrs" in kwargs_dict:
            if "class" in kwargs_dict["attrs"]:
                kwargs_dict["attrs"]["class"] += " %s" % (name.replace("_","-"),)
            else:
                kwargs_dict["attrs"].update({'class':name.replace("_","-")})
        else:
            kwargs_dict["attrs"] = {'class':name.replace("_","-")}

        return kwargs_dict

    def _strip_name_attr(self, widget_string, name):
        return widget_string.replace("name=\"%s\"" % (name,), "")

    class Media:
        css = {
            'all': ('zebra/card-form.css',)
        }
        js = ('zebra/card-form.js','https://js.stripe.com/v1/')

class NoNameTextInput(TextInput, NoNameWidget):

    def render(self, name, *args, **kwargs):
        kwargs = self._update_to_noname_class_name(name, kwargs)
        return self._strip_name_attr(super(NoNameTextInput, self).render(name, *args, **kwargs), name)


class NoNameSelect(Select, NoNameWidget):
    
    def render(self, name, *args, **kwargs):
        kwargs = self._update_to_noname_class_name(name, kwargs)
        return self._strip_name_attr(super(NoNameSelect, self).render(name, *args, **kwargs), name)

<commit_msg>marked render returns as safe<commit_after>from django.forms.widgets import TextInput, Select
from django.utils.safestring import mark_safe

class NoNameWidget(object):
    
    def _update_to_noname_class_name(self, name, kwargs_dict):
        if "attrs" in kwargs_dict:
            if "class" in kwargs_dict["attrs"]:
                kwargs_dict["attrs"]["class"] += " %s" % (name.replace("_","-"),)
            else:
                kwargs_dict["attrs"].update({'class':name.replace("_","-")})
        else:
            kwargs_dict["attrs"] = {'class':name.replace("_","-")}

        return kwargs_dict

    def _strip_name_attr(self, widget_string, name):
        return widget_string.replace("name=\"%s\"" % (name,), "")

    class Media:
        css = {
            'all': ('zebra/card-form.css',)
        }
        js = ('zebra/card-form.js','https://js.stripe.com/v1/')

class NoNameTextInput(TextInput, NoNameWidget):

    def render(self, name, *args, **kwargs):
        kwargs = self._update_to_noname_class_name(name, kwargs)
        return mark_safe(self._strip_name_attr(super(NoNameTextInput, self).render(name, *args, **kwargs), name))


class NoNameSelect(Select, NoNameWidget):
    
    def render(self, name, *args, **kwargs):
        kwargs = self._update_to_noname_class_name(name, kwargs)
        return mark_safe(self._strip_name_attr(super(NoNameSelect, self).render(name, *args, **kwargs), name))


{'fraction_non_alphanumeric': 0.15713251267197684, 'fraction_numerical': 0.000724112961622013, 'mean_word_length': 3.167420814479638, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '5169918', 'n_tokens_mistral': 894, 'n_tokens_neox': 887, 'n_words': 162}