Skip to content

Commit

Permalink
🐛 fixed the callback function.
Browse files Browse the repository at this point in the history
  • Loading branch information
AirportR committed Jun 16, 2024
1 parent 7b77912 commit 895b77f
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions utils/cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,18 @@ def unsafe_load(name: str, pkg: str) -> bool:
self._script = dict(sorted(self._script.items(), key=lambda x: x[1][2]))
logger.info(f"外接测试脚本成功导入数量: {num}")

def init_callback(self) -> list:
path = os.path.join(os.getcwd(), "addons", "callback")
def init_callback(self, path: Union[str, List[str]] = None) -> list:
if path is None:
path = ["addons/callback"]
callbackfunc_list = []
num = 0

def unsafe_load(name: str, pkg: str) -> bool:
try:
mod = importlib.import_module(pathlib.Path(pkg).joinpath(name).as_posix().replace('/', '.'))
except (ModuleNotFoundError, NameError, Exception):
m = pathlib.Path(pkg).joinpath(name).as_posix().replace('/', '.')
mod = importlib.import_module(m)
except (ModuleNotFoundError, NameError, Exception) as e:
logger.error(str(e))
mod = None
if mod is None:
return False
Expand Down

0 comments on commit 895b77f

Please sign in to comment.