<commit_before>from django.forms.widgets import TextInput, PasswordInput, EmailInput
from django.utils.html import format_html

# ref https://github.com/django/django/blob/stable/1.8.x/django/forms/widgets.py

class PaperTextInput(TextInput):

    def render(self, name, value, attrs=None):
        # Unlike inputs using paper-input-decorator directly,
        # paper-input does not work out of the box with the native form
        # element.
        if value is None:
            html = """<paper-input-decorator label='{0}' floatingLabel>
            <input is="core-input" name="{0}">
            </paper-input-decorator>"""
            return format_html(html, name)
        else:
            html = """<paper-input-decorator label='{0}' floatingLabel>
            <input is="core-input" name="{0}" value="{1}">
            </paper-input-decorator>"""
            return format_html(html, name, value)


class PaperPasswordInput(PasswordInput):

    def render(self, name, value, attrs=None):
        if value is None:
            html = """<paper-input-decorator label='{0}' floatingLabel>
            <input is="core-input" name="password" type="password"/>
            </paper-input-decorator>"""
            return format_html(html, name)
        else:
            html = """<paper-input-decorator label='{0}'  type="password" floatingLabel>
            <input is="core-input" name="password" type="password" value="{1}"/>
            </paper-input-decorator>"""
            return format_html(html, name, value)

class PaperEmailInput(EmailInput):
    def render(self, name, value, attrs=None):
    # Unlike inputs using paper-input-decorator directly,
    # paper-input does not work out of the box with the native form
    # element.
        if value is None:
            html = """<paper-input-decorator label='{0}' floatingLabel autoValidate>
            <input is="core-input" name="{0}" type="email">
            </paper-input-decorator>"""
            return format_html(html, name)
        else:
            html = """<paper-input-decorator label='{0}' floatingLabel autoValidate>
            <input is="core-input" name="{0}" value="{1}" type="email">
            </paper-input-decorator>"""
            return format_html(html, name, value)<commit_msg>allow email's label to be changed a bit messy though<commit_after>from django.forms.widgets import TextInput, PasswordInput, EmailInput
from django.utils.html import format_html

# ref https://github.com/django/django/blob/stable/1.8.x/django/forms/widgets.py

class PaperTextInput(TextInput):

    def render(self, name, value, attrs=None):
        # Unlike inputs using paper-input-decorator directly,
        # paper-input does not work out of the box with the native form
        # element.
        if value is None:
            html = """<paper-input-decorator label='{0}' floatingLabel>
            <input is="core-input" name="{0}">
            </paper-input-decorator>"""
            return format_html(html, name)
        else:
            html = """<paper-input-decorator label='{0}' floatingLabel>
            <input is="core-input" name="{0}" value="{1}">
            </paper-input-decorator>"""
            return format_html(html, name, value)


class PaperPasswordInput(PasswordInput):

    def render(self, name, value, attrs=None):
        if value is None:
            html = """<paper-input-decorator label='{0}' floatingLabel>
            <input is="core-input" name="password" type="password"/>
            </paper-input-decorator>"""
            return format_html(html, name)
        else:
            html = """<paper-input-decorator label='{0}'  type="password" floatingLabel>
            <input is="core-input" name="password" type="password" value="{1}"/>
            </paper-input-decorator>"""
            return format_html(html, name, value)

class PaperEmailInput(EmailInput):
    def __init__(self, attrs=None):
        if attrs is not None:
            self.attrs = attrs.copy()
        else:
            self.attrs = {}
    def render(self, name, value, attrs=None):
        if value is None:
            html = """<paper-input-decorator label='{0}' floatingLabel autoValidate>
            <input is="core-input" name="{1}" type="email">
            </paper-input-decorator>"""
            if 'label' in self.attrs:
                print "Hello"
                return html.format(self.attrs['label'], name)
            else:
                return format_html(html, name, name)
        else:
            html = """<paper-input-decorator label='{0}' floatingLabel autoValidate>
            <input is="core-input" name="{0}" value="{1}" type="email">
            </paper-input-decorator>"""
            return format_html(html, name, value)
{'fraction_non_alphanumeric': 0.13948588284871472, 'fraction_numerical': 0.006321112515802781, 'mean_word_length': 2.462436177972283, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, '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': '891118', 'n_tokens_mistral': 1339, 'n_tokens_neox': 1319, 'n_words': 339}