Skip to content

Commit

Permalink
Merge pull request #538 from Pingdred/fix_py
Browse files Browse the repository at this point in the history
Fix for plugins name that start with ''.py''
  • Loading branch information
Pingdred authored Nov 2, 2023
2 parents f95828a + 32279ae commit 33d36d8
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions core/cat/mad_hatter/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}")

Expand Down

0 comments on commit 33d36d8

Please sign in to comment.