| Index: tools/telemetry/telemetry/decorators.py
|
| diff --git a/tools/telemetry/telemetry/decorators.py b/tools/telemetry/telemetry/decorators.py
|
| index 8865408108e21391ee9da919532dd84601b5f989..1dac96425d0205d63e2bd6cf6a40559ee440168c 100644
|
| --- a/tools/telemetry/telemetry/decorators.py
|
| +++ b/tools/telemetry/telemetry/decorators.py
|
| @@ -111,15 +111,19 @@ def Disabled(*args):
|
| """
|
| def _Disabled(func):
|
| if not isinstance(func, types.FunctionType):
|
| - func._disabled_strings = disabled_strings
|
| + if not hasattr(func, '_disabled_strings'):
|
| + func._disabled_strings = set()
|
| + func._disabled_strings.update(disabled_strings)
|
| return func
|
| @functools.wraps(func)
|
| def wrapper(*args, **kwargs):
|
| func(*args, **kwargs)
|
| - wrapper._disabled_strings = disabled_strings
|
| + if not hasattr(wrapper, '_disabled_strings'):
|
| + wrapper._disabled_strings = set()
|
| + wrapper._disabled_strings.update(disabled_strings)
|
| return wrapper
|
| if len(args) == 1 and callable(args[0]):
|
| - disabled_strings = []
|
| + disabled_strings = set()
|
| return _Disabled(args[0])
|
| disabled_strings = list(args)
|
| for disabled_string in disabled_strings:
|
| @@ -140,12 +144,16 @@ def Enabled(*args):
|
| """
|
| def _Enabled(func):
|
| if not isinstance(func, types.FunctionType):
|
| - func._enabled_strings = enabled_strings
|
| + if not hasattr(func, '_enabled_strings'):
|
| + func._enabled_strings = set()
|
| + func._enabled_strings.update(enabled_strings)
|
| return func
|
| @functools.wraps(func)
|
| def wrapper(*args, **kwargs):
|
| func(*args, **kwargs)
|
| - wrapper._enabled_strings = enabled_strings
|
| + if not hasattr(wrapper, '_enabled_strings'):
|
| + wrapper._enabled_strings = set()
|
| + wrapper._enabled_strings.update(enabled_strings)
|
| return wrapper
|
| assert args and not callable(args[0]), '@Enabled requires arguments'
|
| enabled_strings = list(args)
|
|
|