<commit_before>"""
    proclib.helpers
    ~~~~~~~~~~~~~~~

    Helper utility functions.
"""


import shlex
import signal


TO_RESTORE = tuple(
    getattr(signal, sig) for sig in ('SIGPIPE', 'SIGXFZ', 'SIGXFSZ')
    if hasattr(signal, sig)
    )


def restore_signals(signals=TO_RESTORE):
    """
    Restores signals before the process is
    executed so that they can be terminated
    with SIGPIPE.

    :param signals: Optimization detail
        that defaults to SIGPIPE, SIGXFZ,
        and SIGXFSZ (if available).
    """
    for sig in signals:
        signal.signal(sig, signal.SIG_DFL)


def str_parse(cmds):
    """
    Given a string of commands *cmds* yield the
    command in chunks, separated by the pipe
    operator '|'.

    :param cmds: String of commands.
    """
    buff = []
    for item in shlex.split(cmds):
        if item == '|':
            yield buff
            buff = []
            continue
        buff.append(item)
    yield buff


def list_parse(cmds):<commit_msg>more docs for restore_signals [skip ci]<commit_after>"""
    proclib.helpers
    ~~~~~~~~~~~~~~~

    Helper utility functions.
"""


import shlex
import signal


TO_RESTORE = tuple(
    getattr(signal, sig) for sig in ('SIGPIPE', 'SIGXFZ', 'SIGXFSZ')
    if hasattr(signal, sig)
    )


def restore_signals(signals=TO_RESTORE):
    """
    Restores signals before the process is
    executed so that they can be terminated
    with SIGPIPE.

    :param signals: Optimization detail
        that defaults to integers corresponding
        to SIGPIPE, SIGXFZ, and SIGXFSZ (if
        they are available).
    """
    for sig in signals:
        signal.signal(sig, signal.SIG_DFL)


def str_parse(cmds):
    """
    Given a string of commands *cmds* yield the
    command in chunks, separated by the pipe
    operator '|'.

    :param cmds: String of commands.
    """
    buff = []
    for item in shlex.split(cmds):
        if item == '|':
            yield buff
            buff = []
            continue
        buff.append(item)
    yield buff


def list_parse(cmds):
{'fraction_non_alphanumeric': 0.10719459198454853, 'fraction_numerical': 0.0, 'mean_word_length': 2.3691056910569106, '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': '2712679', 'n_tokens_mistral': 659, 'n_tokens_neox': 634, 'n_words': 203}