<commit_before># -*- coding: utf-8 -*-

# Standard library imports
# Third party imports
from django.contrib.auth.models import Group
from django.contrib.auth.models import User
import factory
from faker import Factory as FakerFactory

# Local application / specific library imports

faker = FakerFactory.create()


class UserFactory(factory.DjangoModelFactory):
    FACTORY_FOR = User
    username = factory.LazyAttribute(lambda t: faker.user_name())
    email = factory.Sequence(lambda n: '<EMAIL>'.<EMAIL>(n))
    password = '<PASSWORD>'
    is_active = True

    @classmethod
    def _prepare(cls, create, **kwargs):
        password = kwargs.pop('password', None)
        user = super(UserFactory, cls)._prepare(create, **kwargs)
        if password:
            user.set_password(password)
            if create:
                user.save()
        return user


class GroupFactory(factory.DjangoModelFactory):
    FACTORY_FOR = Group
    name = factory.LazyAttribute(lambda t: faker.job())<commit_msg>Group test factory updated<commit_after># -*- coding: utf-8 -*-

# Standard library imports
# Third party imports
from django.contrib.auth.models import Group
from django.contrib.auth.models import User
import factory
from faker import Factory as FakerFactory

# Local application / specific library imports

faker = FakerFactory.create()


class UserFactory(factory.DjangoModelFactory):
    FACTORY_FOR = User
    username = factory.LazyAttribute(lambda t: faker.user_name())
    email = factory.Sequence(lambda n: '<EMAIL>'.<EMAIL>(n))
    password = '<PASSWORD>'
    is_active = True

    @classmethod
    def _prepare(cls, create, **kwargs):
        password = kwargs.pop('password', None)
        user = super(UserFactory, cls)._prepare(create, **kwargs)
        if password:
            user.set_password(password)
            if create:
                user.save()
        return user


class GroupFactory(factory.DjangoModelFactory):
    FACTORY_FOR = Group
    name = factory.Sequence(lambda n: '{}-{}'.format(str(n) + faker.job()))
{'fraction_non_alphanumeric': 0.10883357735480723, 'fraction_numerical': 0.0009760858955588092, 'mean_word_length': 3.343220338983051, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '2244122', 'n_tokens_mistral': 582, 'n_tokens_neox': 576, 'n_words': 155}