<commit_before>from __future__ import absolute_import, print_function
import functools
import types
import s.exceptions
import inspect
import sys


def pipe_last(value, *args):
    for arg in args:
        if callable(arg):
            value = arg(value)
        else:
            fn, arg = arg[0], list(arg[1:]) + [value]
            value = fn(*arg)
    return value


def pipe_some_last(value, *args):
    for arg in args:
        if value is None:
            return
        elif callable(arg):
            value = arg(value)
        else:
            fn, arg = arg[0], list(arg[1:]) + [value]
            value = fn(*arg)
    return value


def pipe(value, *args):
    for arg in args:
        if callable(arg):
            value = arg(value)
        else:
            fn, arg = arg[0], arg[1:]
            value = fn(value, *arg)
    return value


def pipe_some(value, *args):
    for arg in args:
        if value is None:
            return
        elif callable(arg):
            value = arg(value)
        else:
            fn, arg = arg[0], arg[1:]
            value = fn(value, *arg)
    return value


def name(fn):
    with s.exceptions.ignore():
        return '{}:{}'.format(fn.__module__, fn.__name__)
    with s.exceptions.ignore():
        return fn.__name__
    with s.exceptions.ignore():
        return str(fn)
    return fn


def source(fn):
    try:
        filename, linenum = fn.func_code.co_filename, fn.func_code.co_firstlineno
        with open(filename) as f:
            text = f.read().splitlines()[linenum - 1]
            return '{filename}:{linenum} => {text}'.format(**locals())
    except:
        return name(fn)


def module_name(fn):
    if fn.__module__ != '__main__':
        return fn.__module__<commit_msg>statsd<commit_after>from __future__ import absolute_import, print_function
import functools
import types
import s.exceptions
import inspect
import sys


def pipe_last(value, *args):
    for arg in args:
        if callable(arg):
            value = arg(value)
        else:
            fn, arg = arg[0], list(arg[1:]) + [value]
            value = fn(*arg)
    return value


def pipe_some_last(value, *args):
    for arg in args:
        if value is None:
            return
        elif callable(arg):
            value = arg(value)
        else:
            fn, arg = arg[0], list(arg[1:]) + [value]
            value = fn(*arg)
    return value


def pipe(value, *args):
    for arg in args:
        if callable(arg):
            value = arg(value)
        else:
            fn, arg = arg[0], arg[1:]
            value = fn(value, *arg)
    return value


def pipe_some(value, *args):
    for arg in args:
        if value is None:
            return
        elif callable(arg):
            value = arg(value)
        else:
            fn, arg = arg[0], arg[1:]
            value = fn(value, *arg)
    return value


def name(fn):
    with s.exceptions.ignore():
        return '{}.{}'.format(fn.__module__, fn.__name__)
    with s.exceptions.ignore():
        return fn.__name__
    with s.exceptions.ignore():
        return str(fn)
    return fn


def source(fn):
    try:
        filename, linenum = fn.func_code.co_filename, fn.func_code.co_firstlineno
        with open(filename) as f:
            text = f.read().splitlines()[linenum - 1]
            return '{filename}:{linenum} => {text}'.format(**locals())
    except:
        return name(fn)


def module_name(fn):
    if fn.__module__ != '__main__':
        return fn.__module__
{'fraction_non_alphanumeric': 0.1190271816881259, 'fraction_numerical': 0.005150214592274678, 'mean_word_length': 1.9378151260504202, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '698133', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1076, 'n_words': 305}