diff options
author | Boris Pavlovic <boris@pavlovic.me> | 2015-12-28 16:32:18 -0800 |
---|---|---|
committer | Boris Pavlovic <boris@pavlovic.me> | 2015-12-28 16:32:18 -0800 |
commit | db8aa94c250e7df773abbd021895885e81a44621 (patch) | |
tree | 9a5be3ecf79747423b5a3f588ea12d39a43baf84 | |
parent | 53b66183240198726b4b3f1b817934c2d7ec6cf6 (diff) | |
download | osprofiler-db8aa94c250e7df773abbd021895885e81a44621.tar.gz |
Fix TracedMeta class
We shouldn't .pop() trace_private from trace_args because it will
work only for first method in class.
Change-Id: Id713d1a1a9452bbdd2f58fde9499159cdfc0a037
-rw-r--r-- | osprofiler/profiler.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/osprofiler/profiler.py b/osprofiler/profiler.py index ca2796e..001b401 100644 --- a/osprofiler/profiler.py +++ b/osprofiler/profiler.py @@ -181,7 +181,8 @@ class TracedMeta(type): def __init__(cls, cls_name, bases, attrs): super(TracedMeta, cls).__init__(cls_name, bases, attrs) - trace_args = getattr(cls, "__trace_args__", {}) + trace_args = dict(getattr(cls, "__trace_args__", {})) + trace_private = trace_args.pop("trace_private", False) if "name" not in trace_args: raise TypeError("Please specify __trace_args__ class level " "dictionary attribute with mandatory 'name' key - " @@ -193,8 +194,7 @@ class TracedMeta(type): continue if attr_name.startswith("__"): continue - if (not trace_args.pop("trace_private", False) and - attr_name.startswith("_")): + if not trace_private and attr_name.startswith("_"): continue setattr(cls, attr_name, trace(**trace_args)(getattr(cls, |