# Path: osprofiler/profiler.py
# def clean():
# def _ensure_no_multiple_traced(traceable_attrs):
# def init(hmac_key, base_id=None, parent_id=None):
# def get():
# def start(name, info=None):
# def stop(info=None):
# def trace(name, info=None, hide_args=False, hide_result=True,
#           allow_multiple_trace=True):
#     def decorator(f):
#         def wrapper(*args, **kwargs):
# def trace_cls(name, info=None, hide_args=False, hide_result=True,
#               trace_private=False, allow_multiple_trace=True,
#               trace_class_methods=False, trace_static_methods=False):
#     def trace_checker(attr_name, to_be_wrapped):
#     def decorator(cls):
#     def __init__(cls, cls_name, bases, attrs):
#     def __init__(self, name, info=None):
#     def __enter__(self):
#     def __exit__(self, etype, value, traceback):
#     def __init__(self, hmac_key, base_id=None, parent_id=None):
#     def get_shorten_id(self, uuid_id):
#     def get_base_id(self):
#     def get_parent_id(self):
#     def get_id(self):
#     def start(self, name, info=None):
#     def stop(self, info=None):
#     def _notify(self, name, info):
# class TracedMeta(type):
# class Trace(object):
# class _Profiler(object):
# 
# Path: osprofiler/tests/test.py
# class TestCase(testcase.TestCase):
# class FunctionalTestCase(TestCase):
#     def setUp(self):


import collections
import copy
import datetime
import re
from unittest import mock
from osprofiler import profiler
from osprofiler.tests import test
    @mock.patch("osprofiler.profiler.start")
    def test_with_trace_etype(self, mock_start, mock_stop):

        def foo():
            with profiler.Trace("foo"):
                raise ValueError("bar")

        self.assertRaises(ValueError, foo)
        mock_start.assert_called_once_with("foo", info=None)
        mock_stop.assert_called_once_with(info={
            "etype": "ValueError",
            "message": "bar"
        })


@profiler.trace("function", info={"info": "some_info"})
def traced_func(i):
    return i


@profiler.trace("hide_args", hide_args=True)
def trace_hide_args_func(a, i=10):
    return (a, i)


@profiler.trace("foo", hide_args=True)
def test_fn_exc():
    raise ValueError()



# Path: osprofiler/profiler.py
# def clean():
# def _ensure_no_multiple_traced(traceable_attrs):
# def init(hmac_key, base_id=None, parent_id=None):
# def get():
# def start(name, info=None):
# def stop(info=None):
# def trace(name, info=None, hide_args=False, hide_result=True,
#           allow_multiple_trace=True):
#     def decorator(f):
#         def wrapper(*args, **kwargs):
# def trace_cls(name, info=None, hide_args=False, hide_result=True,
#               trace_private=False, allow_multiple_trace=True,
#               trace_class_methods=False, trace_static_methods=False):
#     def trace_checker(attr_name, to_be_wrapped):
#     def decorator(cls):
#     def __init__(cls, cls_name, bases, attrs):
#     def __init__(self, name, info=None):
#     def __enter__(self):
#     def __exit__(self, etype, value, traceback):
#     def __init__(self, hmac_key, base_id=None, parent_id=None):
#     def get_shorten_id(self, uuid_id):
#     def get_base_id(self):
#     def get_parent_id(self):
#     def get_id(self):
#     def start(self, name, info=None):
#     def stop(self, info=None):
#     def _notify(self, name, info):
# class TracedMeta(type):
# class Trace(object):
# class _Profiler(object):
# 
# Path: osprofiler/tests/test.py
# class TestCase(testcase.TestCase):
# class FunctionalTestCase(TestCase):
#     def setUp(self):


# Path: osprofiler/tests/unit/test_profiler.py
import collections
import copy
import datetime
import re
from unittest import mock
from osprofiler import profiler
from osprofiler.tests import test

    @mock.patch("osprofiler.profiler.start")
    def test_with_trace_etype(self, mock_start, mock_stop):

        def foo():
            with profiler.Trace("foo"):
                raise ValueError("bar")

        self.assertRaises(ValueError, foo)
        mock_start.assert_called_once_with("foo", info=None)
        mock_stop.assert_called_once_with(info={
            "etype": "ValueError",
            "message": "bar"
        })


@profiler.trace("function", info={"info": "some_info"})
def traced_func(i):
    return i


@profiler.trace("hide_args", hide_args=True)
def trace_hide_args_func(a, i=10):
    return (a, i)


@profiler.trace("foo", hide_args=True)
def test_fn_exc():
    raise ValueError()



@profiler.trace("hide_result", hide_result=False)