diff --git a/ovos_utils/__init__.py b/ovos_utils/__init__.py index 6a027bd7..98912ab8 100644 --- a/ovos_utils/__init__.py +++ b/ovos_utils/__init__.py @@ -148,19 +148,11 @@ def wait_for_exit_signal(): LOG.debug(f"Exiting on KeyboardInterrupt") -def get_handler_name(handler): - """Name (including class if available) of handler function. - - Arguments: - handler (function): Function to be named - - Returns: - string: handler name as string - """ - if '__self__' in dir(handler) and 'name' in dir(handler.__self__): - return handler.__self__.name + '.' + handler.__name__ - else: - return handler.__name__ +def get_handler_name(*args, **kwargs): + from ovos_utils.log import log_deprecation + log_deprecation("Import from `ovos_utils.events`", "0.1.0") + from ovos_utils.events import get_handler_name + return get_handler_name(*args, **kwargs) def camel_case_split(identifier: str) -> str: diff --git a/ovos_utils/messagebus.py b/ovos_utils/messagebus.py index 83ffe193..17cd09ea 100644 --- a/ovos_utils/messagebus.py +++ b/ovos_utils/messagebus.py @@ -4,8 +4,32 @@ from pyee import BaseEventEmitter -from ovos_utils.json_helper import merge_dict from ovos_utils.log import LOG, log_deprecation +from ovos_utils.events import EventContainer as _EC + + +class EventContainer(_EC): + def __init__(self, bus=None): + log_deprecation("Import from `ovos_utils.events`", "0.1.0") + _EC.__init__(self, bus=bus) + + +def create_wrapper(*args, **kwargs): + log_deprecation("Import from `ovos_utils.events`", "0.1.0") + from ovos_utils.events import create_wrapper + return create_wrapper(*args, **kwargs) + + +def get_handler_name(*args, **kwargs): + log_deprecation("Import from `ovos_utils.events`", "0.1.0") + from ovos_utils.events import get_handler_name + return get_handler_name(*args, **kwargs) + + +def merge_dict(*args, **kwargs): + log_deprecation("Import from `ovos_utils.json_helper`", "0.1.0") + from ovos_utils.json_helper import merge_dict + return get_handler_name(*args, **kwargs) def dig_for_message():