<commit_before>""" smashlib.util.fabric
"""

from fabric.api import quiet, local

def qlocal(*args, **kargs):
    with quiet():
        return local(*args, **kargs)

def has_bin(name):
    result =  qlocal('which "{0}"'.format(name))
    return result.succeeded

def require_bin(name, msg=None):
    if not has_bin(name):
        msg = msg or "{0} is required".format(name)
        raise Exception(msg)<commit_msg>raise MissingSystemCommand instead of generic exception<commit_after>""" smashlib.util.fabric

    TODO: move to goulash
"""

from fabric.api import quiet, local
class MissingSystemCommand(RuntimeError):
    pass

def qlocal(*args, **kargs):
    with quiet():
        return local(*args, **kargs)

def has_bin(name):
    result =  qlocal('which "{0}"'.format(name))
    return result.succeeded

def require_bin(name, msg=None):
    if not has_bin(name):
        msg = msg or "{0} is required".format(name)
        raise MissingSystemCommand(msg)
{'fraction_non_alphanumeric': 0.13555787278415016, 'fraction_numerical': 0.004171011470281543, 'mean_word_length': 3.8, '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': '5969073', 'n_tokens_mistral': 311, 'n_tokens_neox': 298, 'n_words': 83}