From 32279ae94dbfac45c2168223386fbccaad019927 Mon Sep 17 00:00:00 2001 From: Emanuele Morrone <67059270+Pingdred@users.noreply.github.com> Date: Fri, 3 Nov 2023 00:04:00 +0100 Subject: [PATCH] Fix for #514 --- core/cat/mad_hatter/plugin.py | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/core/cat/mad_hatter/plugin.py b/core/cat/mad_hatter/plugin.py index 27d487e61..f978dfce6 100644 --- a/core/cat/mad_hatter/plugin.py +++ b/core/cat/mad_hatter/plugin.py @@ -4,7 +4,6 @@ import glob import traceback import importlib -from importlib import machinery from typing import Dict from inspect import getmembers from pydantic import BaseModel @@ -207,27 +206,8 @@ def _load_decorated_functions(self): tools = [] plugin_overrides = [] - """ for py_file in self.py_files: - module_name = os.path.splitext(os.path.basename(py_file))[0] - - log.info(f"Import module {py_file}") - - # save a reference to decorated functions - try: - plugin_module = machinery.SourceFileLoader(module_name, py_file).load_module() - hooks += getmembers(plugin_module, self._is_cat_hook) - tools += getmembers(plugin_module, self._is_cat_tool) - plugin_overrides += getmembers(plugin_module, self._is_cat_plugin_override) - except Exception as e: - log.error(f"Error in {module_name}: {str(e)}") - traceback.print_exc() - raise Exception(f"Unable to load the plugin {self._id}") - """ - - - for py_file in self.py_files: - py_filename = py_file.replace("/", ".").replace(".py", "") # this is UGLY I know. I'm sorry + py_filename = py_file.replace(".py", "").replace("/", ".") log.info(f"Import module {py_filename}")