(fn)
return wrapper
Decorator to check the distribution of return values of a function.

    :param fn: the function to be decorated
    :type fn: C{func}

    :return: the decorated function
    :rtype: C{func}
Decorator to check the distribution of return values of a function.
Decorator to check the distribution of return values of a function .
def hist_calls(fn):
    """
    Decorator to check the distribution of return values of a function.

    :param fn: the function to be decorated
    :type fn: C{func}

    :return: the decorated function
    :rtype: C{func}
    """

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        _histogram = histogram("%s_calls" % get_qualname(fn))
        rtn = fn(*args, **kwargs)
        if type(rtn) in (int, float):
            _histogram.update(rtn)
        return rtn

    return wrapper
def hist_calls ( fn ) : @ functools . wraps ( fn ) def wrapper ( * args , * * kwargs ) : _histogram = histogram ( "%s_calls" % get_qualname ( fn ) ) rtn = fn ( * args , * * kwargs ) if type ( rtn ) in ( int , float ) : _histogram . update ( rtn ) return rtn return wrapper