def __init__(self, context=None, **kwargs):
"""
When creating the placeholder, a process-specific context should be given.
Parameters
----------
context : str
Context is used to indicate the process that generated the processing statistics.
Returns
-------
Metrics
Instance where processing statistics can be added or modified.
"""
# If context is not given, determine it from calling function.
if context is None:
previous_frame = inspect.getouterframes(inspect.currentframe())[1]
module = inspect.getmodulename(previous_frame[1])
context = module + '.' + previous_frame[3]
self.context = context
for arg, value in kwargs.items():
setattr(self, arg, value)
评论列表
文章目录