<commit_before>import rest_framework
from django.forms import widgets
from distutils.version import StrictVersion


if StrictVersion(rest_framework.VERSION) < StrictVersion('3.0.0'):
    from rest_framework.serializers import Serializer, CharField

    class PasswordField(CharField):
        widget = widgets.PasswordInput
else:
    class Serializer(rest_framework.serializers.Serializer):
        @property
        def object(self):
            return self.validated_data

    class PasswordField(rest_framework.serializers.CharField):
        style = {
            'input_type': 'password'
        }


def get_user_model():
    try:
        from django.contrib.auth import get_user_model
    except ImportError:  # Django < 1.5
        from django.contrib.auth.models import User
    else:
        User = get_user_model()

    return User


def get_username_field():
    try:
        username_field = get_user_model().USERNAME_FIELD
    except:
        username_field = 'username'<commit_msg>Fixes #150<commit_after>import rest_framework
from django.forms import widgets
from distutils.version import StrictVersion


if StrictVersion(rest_framework.VERSION) < StrictVersion('3.0.0'):
    from rest_framework.serializers import Serializer, CharField

    class PasswordField(CharField):
        widget = widgets.PasswordInput
else:
    import rest_framework.serializers
    class Serializer(rest_framework.serializers.Serializer):
        @property
        def object(self):
            return self.validated_data

    class PasswordField(rest_framework.serializers.CharField):
        style = {
            'input_type': 'password'
        }


def get_user_model():
    try:
        from django.contrib.auth import get_user_model
    except ImportError:  # Django < 1.5
        from django.contrib.auth.models import User
    else:
        User = get_user_model()

    return User


def get_username_field():
    try:
        username_field = get_user_model().USERNAME_FIELD
    except:
        username_field = 'username'
{'fraction_non_alphanumeric': 0.07604938271604939, 'fraction_numerical': 0.006419753086419753, 'mean_word_length': 3.0601202404809618, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3802086', 'n_tokens_mistral': 577, 'n_tokens_neox': 554, 'n_words': 128}