<commit_before>import os
import sys

sys.path.append(os.path.dirname(os.path.abspath(__file__)))

from commander.deploy import BadReturnCode, hostgroups, task

import commander_settings as settings


_src_dir = lambda *p: os.path.join(settings.SRC_DIR, *p)


@task
def create_virtualenv(ctx):
    venv = settings.VIRTUAL_ENV
    ctx.local("rm -f %s/lib64" % venv)
    try:
        try:
            ctx.local("virtualenv --distribute --never-download %s" % venv)
        except BadReturnCode:
            pass # if this is really broken, then the pip install should fail

        ctx.local("rm -f %s/lib64 && ln -s ./lib %s/lib64" % (venv, venv))

        ctx.local("%s/bin/pip install --exists-action=w --no-deps --no-index --download-cache=/tmp/pip-cache -f %s -r %s/requirements/prod.txt" %
                    (venv, settings.PYREPO, settings.SRC_DIR))
    finally:
        # make sure this always runs
        ctx.local("rm -f %s/lib/python2.6/no-global-site-packages.txt" % venv)
        ctx.local("%s/bin/python /usr/bin/virtualenv --relocatable %s" % (venv, venv))


@task
def update_locales(ctx):
    with ctx.lcd(_src_dir("locale")):
        ctx.local("svn revert -R .")
        ctx.local("svn up")
        ctx.local("./compile-mo.sh .")

@task
def loadtest(ctx, repo=''):
    if hasattr(settings, 'MARTEAU'):
        os.environ['MACAUTH_USER'] = settings.MARTEAU_USER
        os.environ['MACAUTH_SECRET'] = settings.MARTEAU_SECRET
        ctx.local('%s %s --server %s' % (settings.MARTEAU, repo, settings.MARTEAU_SERVER))

@task<commit_msg>Update scripts/update/update.py<commit_after>import os
import sys

sys.path.append(os.path.dirname(os.path.abspath(__file__)))

from commander.deploy import BadReturnCode, hostgroups, task

import commander_settings as settings


_src_dir = lambda *p: os.path.join(settings.SRC_DIR, *p)


@task
def create_virtualenv(ctx):
    venv = settings.VIRTUAL_ENV
    try:
        try:
            ctx.local("virtualenv --distribute --never-download %s" % venv)
        except BadReturnCode:
            pass # if this is really broken, then the pip install should fail

        ctx.local("%s/bin/pip install --exists-action=w --no-deps --no-index --download-cache=/tmp/pip-cache -f %s -r %s/requirements/prod.txt" %
                    (venv, settings.PYREPO, settings.SRC_DIR))
    finally:
        # make sure this always runs
        ctx.local("rm -f %s/lib/python2.6/no-global-site-packages.txt" % venv)
        ctx.local("%s/bin/python /usr/bin/virtualenv --relocatable %s" % (venv, venv))


@task
def update_locales(ctx):
    with ctx.lcd(_src_dir("locale")):
        ctx.local("svn revert -R .")
        ctx.local("svn up")
        ctx.local("./compile-mo.sh .")

@task
def loadtest(ctx, repo=''):
    if hasattr(settings, 'MARTEAU'):
        os.environ['MACAUTH_USER'] = settings.MARTEAU_USER
        os.environ['MACAUTH_SECRET'] = settings.MARTEAU_SECRET
        ctx.local('%s %s --server %s' % (settings.MARTEAU, repo, settings.MARTEAU_SERVER))

@task
{'fraction_non_alphanumeric': 0.14751914751914752, 'fraction_numerical': 0.00333000333000333, 'mean_word_length': 2.8414322250639388, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1518278', 'n_tokens_mistral': 1070, 'n_tokens_neox': 1038, 'n_words': 223}