<commit_before># coding=utf-8
"""Tasks for setting up sphinx."""
import fabtools
from fabric.api import task, sudo, fastprint
from fabric.colors import green, blue


@task
def setup_latex():
    """Install latex and friends needed to generate sphinx PDFs."""
    fastprint(blue('Setting up LaTeX\n'))
    fabtools.deb.update_index(quiet=True)
    fabtools.require.deb.package('texlive-latex-extra')
    fabtools.require.deb.package('texinfo')
    fabtools.require.deb.package('texlive-fonts-recommended')
    fastprint(green('Setting up LaTeX completed\n'))


@task
def setup_sphinx():
    """Install sphinx from pip.

    We prefer packages from pip as ubuntu packages are usually old.
    To build the Documentation we also need to check and update the
    subjacent docutils installation"""
    fastprint(blue('Setting up Sphinx\n'))
    if fabtools.is_installed('docutils-common'):
        sudo('apt-get remove docutils-common')
    if fabtools.is_installed('docutils-doc'):
        sudo('apt-get remove docutils-doc')
    if fabtools.is_installed('python-docutils'):
        sudo('apt-get remove python-docutils')
    sudo('pip install --upgrade docutils==0.10')
    sudo('pip install sphinx')
    fastprint(green('Setting up Sphinx completed\n'))


@task
def setup_transifex():
    """Install transifex client."""
    fastprint(blue('Setting up transifex command line client\n'))
    sudo('pip install transifex-client')
    fastprint(green('Setting up transifex command line client completed\n'))<commit_msg>Fix #4 Sphinx installation fails<commit_after># coding=utf-8
"""Tasks for setting up sphinx."""
import fabtools
from fabric.api import task, sudo, fastprint
from fabric.colors import green, blue
from fabtools.deb import is_installed

@task
def setup_latex():
    """Install latex and friends needed to generate sphinx PDFs."""
    fastprint(blue('Setting up LaTeX\n'))
    fabtools.deb.update_index(quiet=True)
    fabtools.require.deb.package('texlive-latex-extra')
    fabtools.require.deb.package('texinfo')
    fabtools.require.deb.package('texlive-fonts-recommended')
    fastprint(green('Setting up LaTeX completed\n'))


@task
def setup_sphinx():
    """Install sphinx from pip.

    We prefer packages from pip as ubuntu packages are usually old.
    To build the Documentation we also need to check and update the
    subjacent docutils installation"""
    fastprint(blue('Setting up Sphinx\n'))
    if is_installed('docutils-common'):
        sudo('apt-get remove docutils-common')
    if is_installed('docutils-doc'):
        sudo('apt-get remove docutils-doc')
    if is_installed('python-docutils'):
        sudo('apt-get remove python-docutils')
    sudo('pip install --upgrade docutils==0.10')
    sudo('pip install sphinx')
    fastprint(green('Setting up Sphinx completed\n'))


@task
def setup_transifex():
    """Install transifex client."""
    fastprint(blue('Setting up transifex command line client\n'))
    sudo('pip install transifex-client')
    fastprint(green('Setting up transifex command line client completed\n'))
{'fraction_non_alphanumeric': 0.11801242236024845, 'fraction_numerical': 0.002942137953579601, 'mean_word_length': 4.221843003412969, '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': '5239035', 'n_tokens_mistral': 956, 'n_tokens_neox': 884, 'n_words': 261}