<commit_before>"""
Fabric tools for managing Debian/Ubuntu packages
"""
from __future__ import with_statement

from fabric.api import *


def is_running(service):
    """
    Check if a service is running
    """
    with settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True):
        res = sudo('/etc/init.d/%(service)s status' % locals())
        return res.succeeded


def start(service):
    """
    Start a service
    """
    sudo('/etc/init.d/%(service)s start' % locals())


def stop(service):
    """
    Stop a service
    """
    sudo('/etc/init.d/%(service)s stop' % locals())


def restart(service):
    """
    Restart a service
    """
    sudo('/etc/init.d/%(service)s restart' % locals())<commit_msg>Use service command to support both upstart and SysV scripts [#24]<commit_after>"""
Fabric tools for managing services

This uses the ``service`` command, supporting both upstart services
and traditional SysV-style ``/etc/init.d/`` scripts.
"""
from __future__ import with_statement

from fabric.api import *


def is_running(service):
    """
    Check if a service is running
    """
    with settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True):
        res = sudo('service %(service)s status' % locals())
        return res.succeeded


def start(service):
    """
    Start a service
    """
    sudo('service %(service)s start' % locals())


def stop(service):
    """
    Stop a service
    """
    sudo('service %(service)s stop' % locals())


def restart(service):
    """
    Restart a service
    """
    sudo('service %(service)s restart' % locals())
{'fraction_non_alphanumeric': 0.15379864113650402, 'fraction_numerical': 0.0012353304508956147, 'mean_word_length': 3.2857142857142856, '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': '5352809', 'n_tokens_mistral': 510, 'n_tokens_neox': 479, 'n_words': 142}