<commit_before>import os.path

from fabric.api import sudo, cd, put, task, local, env, run, settings, get
from fabric.contrib.files import exists
from fabric.colors import red, yellow
from fabric.utils import abort

APP_NAME = 'keplerphone'
URL = '{}.jonath.in'.format(APP_NAME)
GITHUB_ORGANIZATION = 'bmcfee'
INSTALL_HOME = '/opt'
APP_DIR = os.path.join(INSTALL_HOME, APP_NAME)
REPO = '<EMAIL>:{}/{}.git'.format(GITHUB_ORGANIZATION, APP_NAME)
THIS_DIR = os.path.dirname(os.path.realpath(__file__))

env.user = 'ubuntu'
env.hosts = [URL]
env.use_ssh_config = True


def notice(s):
    print(red('### ') + yellow(s, bold=True))


@task
def update_repo():
    notice('Updating application repo from GitHub')

    sudo('mkdir -p {}'.format(INSTALL_HOME))
    sudo('chown {} {}'.format(env.user, INSTALL_HOME))

    ssh_dir = '/home/{}/.ssh'.format(env.user)
    if not exists(ssh_dir):
        run('mkdir -p {}'.format(ssh_dir))
    ssh_id = os.path.join(ssh_dir, 'id_rsa')
    put(os.path.join(THIS_DIR, 'conf', 'github_deploy_key'), ssh_id, use_sudo=True, mode=0600)

    if not exists(os.path.join(APP_DIR, '.git')):
        print(red('FIRST CHECKOUT'))
        with cd(INSTALL_HOME):
            run('git clone {}'.format(REPO))

    with cd(APP_DIR):
        run('git fetch --all')
        run('git checkout -f master')
        run('git pull')


@task
def install_dependencies():
    notice('Updating system packages')
    packages = [
        'git',
        'python-pip',
        'python-setuptools',
        'supervisor',
        'nginx-full',
        'build-essential',
        'python-dev',
        'uwsgi-plugin-python',
        'htop',
        'ipython',
        'python-numpy',
        'libasound2-dev',<commit_msg>apt-get scipy and sklearn.<commit_after>import os.path

from fabric.api import sudo, cd, put, task, local, env, run, settings, get
from fabric.contrib.files import exists
from fabric.colors import red, yellow
from fabric.utils import abort

APP_NAME = 'keplerphone'
URL = '{}.jonath.in'.format(APP_NAME)
GITHUB_ORGANIZATION = 'bmcfee'
INSTALL_HOME = '/opt'
APP_DIR = os.path.join(INSTALL_HOME, APP_NAME)
REPO = '<EMAIL>:{}/{}.git'.format(GITHUB_ORGANIZATION, APP_NAME)
THIS_DIR = os.path.dirname(os.path.realpath(__file__))

env.user = 'ubuntu'
env.hosts = [URL]
env.use_ssh_config = True


def notice(s):
    print(red('### ') + yellow(s, bold=True))


@task
def update_repo():
    notice('Updating application repo from GitHub')

    sudo('mkdir -p {}'.format(INSTALL_HOME))
    sudo('chown {} {}'.format(env.user, INSTALL_HOME))

    ssh_dir = '/home/{}/.ssh'.format(env.user)
    if not exists(ssh_dir):
        run('mkdir -p {}'.format(ssh_dir))
    ssh_id = os.path.join(ssh_dir, 'id_rsa')
    put(os.path.join(THIS_DIR, 'conf', 'github_deploy_key'), ssh_id, use_sudo=True, mode=0600)

    if not exists(os.path.join(APP_DIR, '.git')):
        print(red('FIRST CHECKOUT'))
        with cd(INSTALL_HOME):
            run('git clone {}'.format(REPO))

    with cd(APP_DIR):
        run('git fetch --all')
        run('git checkout -f master')
        run('git pull')


@task
def install_dependencies():
    notice('Updating system packages')
    packages = [
        'git',
        'python-pip',
        'python-setuptools',
        'supervisor',
        'nginx-full',
        'build-essential',
        'python-dev',
        'uwsgi-plugin-python',
        'htop',
        'ipython',
        'python-numpy',
        'python-scipy',
        'python-sklearn',
        'libasound2-dev',
{'fraction_non_alphanumeric': 0.16234690971233268, 'fraction_numerical': 0.0028481913984619764, 'mean_word_length': 3.1220657276995305, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6012225', 'n_tokens_mistral': 1302, 'n_tokens_neox': 1215, 'n_words': 256}