<commit_before>from random import randint, choice
from datetime import timedelta
from decimal import Decimal

from django.core.management.base import BaseCommand
from django.contrib.auth.models import User

from faker import Factory

from core.models import Client, Entry, Project, Task


class Command(BaseCommand):
    help = 'Generates a bunch of fake clients, projects, and entries'

    def add_arguments(self, parser):
        parser.add_argument(
            '--iterations',
            dest='iterations',
            default=5,
            help='The amount of data we add do the database'
        )

    def handle(self, *args, **kwargs):
        fake = Factory.create()
        verbosity = kwargs['verbosity']
        iterations = kwargs['iterations']
        if not iterations:
            iterations = 5

        for i in range(randint(iterations, iterations*2)):
            Task.objects.create(
                name=fake.sentence(),
                hourly_rate=Decimal(
                    '%d.%d' % (randint(0, 200), randint(0, 99)))
            )

        for i in range(iterations):
            Client.objects.create(name=fake.company())

        for client in Client.objects.iterator():
            project_iterations = randint(iterations, iterations*2)
            for i in range(project_iterations):
                estimated = choice([True, False])
                estimate = None
                if estimated:
                    estimate = timedelta(hours=randint(5, 150))
                Project.objects.create(
                    client=client,
                    estimate=estimate,
                    name=fake.job()
                )
<commit_msg>Update fake generation for task and project names<commit_after>from random import randint, choice
from datetime import timedelta
from decimal import Decimal

from django.core.management.base import BaseCommand
from django.contrib.auth.models import User

from faker import Factory

from core.models import Client, Entry, Project, Task


class Command(BaseCommand):
    help = 'Generates a bunch of fake clients, projects, and entries'

    def add_arguments(self, parser):
        parser.add_argument(
            '--iterations',
            dest='iterations',
            default=5,
            help='The amount of data we add do the database'
        )

    def handle(self, *args, **kwargs):
        fake = Factory.create()
        verbosity = kwargs['verbosity']
        iterations = kwargs['iterations']
        if not iterations:
            iterations = 5

        for i in range(randint(iterations, iterations*2)):
            task_name = (fake
                         .sentence(nb_words=3, variable_nb_words=True)
                         .replace('.', '')
                         .capitalize())
            Task.objects.create(
                name=task_name,
                hourly_rate=Decimal(
                    '%d.%d' % (randint(0, 200), randint(0, 99)))
            )

        for i in range(iterations):
            Client.objects.create(name=fake.company())

        for client in Client.objects.iterator():
            project_iterations = randint(iterations, iterations*2)
            for i in range(project_iterations):
                estimated = choice([True, False])
                estimate = None
                if estimated:
                    estimate = timedelta(hours=randint(5, 150))
                project_name = (fake
                            .sentence(nb_words=3, variable_nb_words=True)
                            .replace('.', '')
                            .capitalize())
                Project.objects.create(
                    client=client,
                    estimate=estimate,
                    name=project_name
                )

{'fraction_non_alphanumeric': 0.09028146574614976, 'fraction_numerical': 0.008497079129049389, 'mean_word_length': 1.7356572258533043, 'pattern_counts': {'":': 0, '<': 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': '6696878', 'n_tokens_mistral': 983, 'n_tokens_neox': 919, 'n_words': 255}