<commit_before># -*- coding:utf-8 -*-

from .run_cmd import RunCmd
from .input_stream import InputStream


def instream(s):
    return InputStream(s)


def cmd(cmd_str):
    return RunCmd(cmd_str)


def pipe_all(cmd_lst):
    # @TODO support first element as inputstream  03.04 2014 (houqp)
    ssr = RunCmd(cmd_lst.pop(0))
    for cmd in cmd_lst:
        ssr = ssr.p(cmd)
    return ssr


def p(arg):
    if isinstance(arg, str):
        return cmd(arg)
    elif isinstance(arg, list):
        return pipe_all(arg)


def ex(cmd_str):
    return RunCmd(cmd_str).run()


def ex_all(cmd_lst):
    return [ex(c) for c in cmd_lst]<commit_msg>api: raise value error on invalid type for p()<commit_after># -*- coding:utf-8 -*-

from .run_cmd import RunCmd
from .input_stream import InputStream


def instream(s):
    return InputStream(s)


def cmd(cmd_str):
    return RunCmd(cmd_str)


def pipe_all(cmd_lst):
    # @TODO support first element as inputstream  03.04 2014 (houqp)
    ssr = RunCmd(cmd_lst.pop(0))
    for cmd in cmd_lst:
        ssr = ssr.p(cmd)
    return ssr


def p(arg):
    if isinstance(arg, str):
        return cmd(arg)
    elif isinstance(arg, list):
        return pipe_all(arg)
    else:
        raise ValueError('argument must be a string or list')


def ex(cmd_str):
    return RunCmd(cmd_str).run()


def ex_all(cmd_lst):
    return [ex(c) for c in cmd_lst]
{'fraction_non_alphanumeric': 0.11151339608979001, 'fraction_numerical': 0.01448225923244026, 'mean_word_length': 3.0409356725146197, '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': '172003', 'n_tokens_mistral': 515, 'n_tokens_neox': 491, 'n_words': 142}