<commit_before>import json
import os
import re

from fabric.api import cd, env, get, hide, local, put, require, run, settings, sudo, task
from fabric.colors import red
from fabric.contrib import files, project
from fabric.utils import abort, error

# Directory structure
PROJECT_ROOT = os.path.dirname(__file__)
env.project = 'pycon'
env.project_user = os.environ['LOGNAME']
env.shell = '/bin/bash -c'
env.settings = 'symposion.settings'

@task
def staging():
    env.environment = 'staging'
    env.hosts = ['virt-nsz0jn.psf.osuosl.org']
    env.site_hostname = 'staging-pycon.python.org'
    env.root = '/srv/staging-pycon.python.org'
    env.branch = 'staging'
    env.db = 'psf-pycon-2015-staging'
    env.db_host = 'pg2.osuosl.org'
    env.db_user = 'psf-pycon-2015-staging'
    setup_path()

@task
def production():
    env.environment = 'production'
    env.hosts = ['virt-ak9lsk.psf.osuosl.org']
    env.site_hostname = 'us.pycon.org'
    env.root = '/srv/staging-pycon.python.org'
    env.branch = 'production'
    env.db = 'psf-pycon-2015'
    env.db_host = 'pg2.osuosl.org'
    env.db_user = 'psf-pycon-2015'
    setup_path()


def setup_path():
    env.home = '/home/%(project_user)s/' % env
    env.code_root = os.path.join(env.root, 'current')
    env.virtualenv_root = os.path.join(env.root, 'shared/env')
    env.media_root = os.path.join(env.root, 'shared', 'media')


@task
def manage_run(command):
    """Run a Django management command on the remote server."""
    require('environment')
    manage_cmd = ("{env.virtualenv_root}/bin/python "
        "manage.py {command}").format(env=env, command=command)
    dotenv_path = os.path.join(env.root, 'shared')
    source_dotenv_cmd = "source {env}/.env".format(env=dotenv_path)
    with cd(env.code_root):
        sudo(' && '.join((source_dotenv_cmd, manage_cmd)))


@task
def manage_shell():
    """Drop into the remote Django shell."""
    manage_run("shell")


@task
def deploy():<commit_msg>Changes source command to . for portability<commit_after>import json
import os
import re

from fabric.api import cd, env, get, hide, local, put, require, run, settings, sudo, task
from fabric.colors import red
from fabric.contrib import files, project
from fabric.utils import abort, error

# Directory structure
PROJECT_ROOT = os.path.dirname(__file__)
env.project = 'pycon'
env.project_user = os.environ['LOGNAME']
env.shell = '/bin/bash -c'
env.settings = 'symposion.settings'

@task
def staging():
    env.environment = 'staging'
    env.hosts = ['virt-nsz0jn.psf.osuosl.org']
    env.site_hostname = 'staging-pycon.python.org'
    env.root = '/srv/staging-pycon.python.org'
    env.branch = 'staging'
    env.db = 'psf-pycon-2015-staging'
    env.db_host = 'pg2.osuosl.org'
    env.db_user = 'psf-pycon-2015-staging'
    setup_path()

@task
def production():
    env.environment = 'production'
    env.hosts = ['virt-ak9lsk.psf.osuosl.org']
    env.site_hostname = 'us.pycon.org'
    env.root = '/srv/staging-pycon.python.org'
    env.branch = 'production'
    env.db = 'psf-pycon-2015'
    env.db_host = 'pg2.osuosl.org'
    env.db_user = 'psf-pycon-2015'
    setup_path()


def setup_path():
    env.home = '/home/%(project_user)s/' % env
    env.code_root = os.path.join(env.root, 'current')
    env.virtualenv_root = os.path.join(env.root, 'shared/env')
    env.media_root = os.path.join(env.root, 'shared', 'media')


@task
def manage_run(command):
    """Run a Django management command on the remote server."""
    require('environment')
    manage_cmd = ("{env.virtualenv_root}/bin/python "
        "manage.py {command}").format(env=env, command=command)
    dotenv_path = os.path.join(env.root, 'shared')
    source_dotenv_cmd = ". {env}/.env".format(env=dotenv_path)
    with cd(env.code_root):
        sudo(' && '.join((source_dotenv_cmd, manage_cmd)))


@task
def manage_shell():
    """Drop into the remote Django shell."""
    manage_run("shell")


@task
def deploy():
{'fraction_non_alphanumeric': 0.15446948594580906, 'fraction_numerical': 0.010129146619397315, 'mean_word_length': 3.6198830409356724, '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': '699956', 'n_tokens_mistral': 1477, 'n_tokens_neox': 1428, 'n_words': 291}