Codebase list python-osprofiler / db8aa94
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 Boris Pavlovic 8 years ago
1 changed file(s) with 3 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
180180 def __init__(cls, cls_name, bases, attrs):
181181 super(TracedMeta, cls).__init__(cls_name, bases, attrs)
182182
183 trace_args = getattr(cls, "__trace_args__", {})
183 trace_args = dict(getattr(cls, "__trace_args__", {}))
184 trace_private = trace_args.pop("trace_private", False)
184185 if "name" not in trace_args:
185186 raise TypeError("Please specify __trace_args__ class level "
186187 "dictionary attribute with mandatory 'name' key - "
192193 continue
193194 if attr_name.startswith("__"):
194195 continue
195 if (not trace_args.pop("trace_private", False) and
196 attr_name.startswith("_")):
196 if not trace_private and attr_name.startswith("_"):
197197 continue
198198
199199 setattr(cls, attr_name, trace(**trace_args)(getattr(cls,