

def __call__(self, func):
    'Returns a wrapped version of the called function.\n\n        :param function func:    Function that should be wrapped.\n\n        :return:    Returns a wrapped version of the called function.\n        :rtype:     function\n        '

    def wrapped_func(*args, **kwargs):
        'This function gets executed, if the wrapped function gets called.\n\n            It automatically created a performance profile for the corresponding function call.\n            '
        profiler = profile.Profile()
        result = profiler.runcall(func, *args, **kwargs)
        filename = ('%s' % self._filelocation)
        profiler.dump_stats(filename)
        return result
    self._func = func
    setattr(wrapped_func, '__name__', self._func.__name__)
    setattr(wrapped_func, '__repr__', self._func.__repr__)
    setattr(wrapped_func, '__str__', self._func.__str__)
    setattr(wrapped_func, '__doc__', self._func.__doc__)
    return wrapped_func

dataset/ETHPy150Open T-002/pycast/pycast/common/profileme.py _ProfileDecorator.__call__/original