From f959709f399f2f43ac5aeca8f75ca32f97245960 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Mon, 26 Mar 2018 17:16:16 +0200 Subject: [PATCH] mgr/dashboard: Renamed `types` as it clashes with std lib This will lead to a name clash, when importing `types` Signed-off-by: Sebastian Wagner --- src/pybind/mgr/dashboard/tools.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/pybind/mgr/dashboard/tools.py b/src/pybind/mgr/dashboard/tools.py index 718eec4334e5c..ad81033eda18b 100644 --- a/src/pybind/mgr/dashboard/tools.py +++ b/src/pybind/mgr/dashboard/tools.py @@ -468,27 +468,27 @@ class NotificationQueue(threading.Thread): logger.debug("notification queue stopped") @classmethod - def register(cls, func, types=None): + def register(cls, func, n_types=None): """Registers function to listen for notifications - If the second parameter `types` is omitted, the function in `func` + If the second parameter `n_types` is omitted, the function in `func` parameter will be called for any type of notifications. Args: func (function): python function ex: def foo(val) - types (str|list): the single type to listen, or a list of types + n_types (str|list): the single type to listen, or a list of notification types """ with cls._lock: - if not types: + if not n_types: cls._listeners[cls._ALL_TYPES_].add(func) return - if isinstance(types, str): - cls._listeners[types].add(func) - elif isinstance(types, list): - for typ in types: + if isinstance(n_types, str): + cls._listeners[n_types].add(func) + elif isinstance(n_types, list): + for typ in n_types: cls._listeners[typ].add(func) else: - raise Exception("types param is neither a string nor a list") + raise Exception("n_types param is neither a string nor a list") @classmethod def new_notification(cls, notify_type, notify_value): -- 2.39.5