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

from fabric.api import cd, env, require, run, task
from fabric.colors import green, white
from fabric.context_managers import contextmanager, shell_env
from fabric.utils import puts

from fabutils import arguments, join, options
from fabutils.env import set_env_from_json_file
from fabutils.context import cmd_msg
from fabutils.tasks import ulocal, urun, ursync_project
from fabutils.text import SUCCESS_ART


@contextmanager
def virtualenv():
    """
    Activates the virtualenv in which the commands shall be run.
    """
    require('site_dir', 'django_settings')

    with cd(env.site_dir):
        with shell_env(DJANGO_SETTINGS_MODULE=env.django_settings):
            yield


@task
def environment(env_name):
    """
    Creates a dynamic environment based on the contents of the given
    environments_file.
    """
    if env_name == 'vagrant':
        result = ulocal('vagrant ssh-config | grep IdentityFile', capture=True)
        env.key_filename = result.split()[1].replace('"', '')

    set_env_from_json_file('environments.json', env_name)
    env.env_name = env_name


@task
def createdb():
    """
    Creates a new database instance with utf-8 encoding for the project.
    """
    urun('createdb idneo -l en_US.UTF-8 -E UTF8 -T template0')


@task
def resetdb():
    """
    Reset the project's database by dropping an creating it again.
    """
    urun('dropdb idneo')
    createdb()
    migrate()


@task
def bootstrap():
    """
    Builds the environment to start the project.
    """
    # Build the DB schema and collect the static files.
    createdb()
    migrate()
    collectstatic()


@task
def loaddata(*args):
    """
    Loads the given data fixtures into the project's database.
    """
    with virtualenv():
        run(join('python manage.py loaddata', arguments(*args)))<commit_msg>add dummy data fot fabfile<commit_after># -*- coding: utf-8 -*-
import os

from fabric.api import cd, env, require, run, task
from fabric.colors import green, white
from fabric.context_managers import contextmanager, shell_env
from fabric.utils import puts

from fabutils import arguments, join, options
from fabutils.env import set_env_from_json_file
from fabutils.context import cmd_msg
from fabutils.tasks import ulocal, urun, ursync_project
from fabutils.text import SUCCESS_ART


@contextmanager
def virtualenv():
    """
    Activates the virtualenv in which the commands shall be run.
    """
    require('site_dir', 'django_settings')

    with cd(env.site_dir):
        with shell_env(DJANGO_SETTINGS_MODULE=env.django_settings):
            yield


@task
def environment(env_name):
    """
    Creates a dynamic environment based on the contents of the given
    environments_file.
    """
    if env_name == 'vagrant':
        result = ulocal('vagrant ssh-config | grep IdentityFile', capture=True)
        env.key_filename = result.split()[1].replace('"', '')

    set_env_from_json_file('environments.json', env_name)
    env.env_name = env_name


@task
def createdb():
    """
    Creates a new database instance with utf-8 encoding for the project.
    """
    urun('createdb idneo -l en_US.UTF-8 -E UTF8 -T template0')


@task
def resetdb():
    """
    Reset the project's database by dropping an creating it again.
    """
    urun('dropdb idneo')
    createdb()
    migrate()
    loaddummydata()


@task
def bootstrap():
    """
    Builds the environment to start the project.
    """
    # Build the DB schema and collect the static files.
    createdb()
    migrate()
    loaddummydata()
    collectstatic()


@task
def loaddata(*args):
    """
    Loads the given data fixtures into the project's database.
    """
    with virtualenv():
        run(join('python manage.py loaddata', arguments(*args)))


@task
def loaddummydata():
    loaddata('catalogs')
    loaddata('books')
{'fraction_non_alphanumeric': 0.10379550735863671, 'fraction_numerical': 0.003098373353989156, 'mean_word_length': 3.3823529411764706, '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': '4454946', 'n_tokens_mistral': 1181, 'n_tokens_neox': 1151, 'n_words': 370}