提交 c77b4ebc 编写于 作者: W wuzewu

Fix multi Module bug

上级 853c1e5b
...@@ -101,11 +101,7 @@ _module_runable_func = {} ...@@ -101,11 +101,7 @@ _module_runable_func = {}
def runable(func): def runable(func):
if six.PY3: mod = func.__module__ + "." + inspect.stack()[1][3]
mod = func.__qualname__.split(".")[:-1]
mod = ".".join(mod)
else:
mod = func.im_class.__name__
_module_runable_func[mod] = func.__name__ _module_runable_func[mod] = func.__name__
def _wrapper(*args, **kwargs): def _wrapper(*args, **kwargs):
...@@ -146,8 +142,9 @@ class Module(object): ...@@ -146,8 +142,9 @@ class Module(object):
if not directory: if not directory:
return return
if self.__class__.__name__ in _module_runable_func: mod = self.__class__.__module__ + "." + self.__class__.__name__
_run_func_name = _module_runable_func[self.__class__.__name__] if mod in _module_runable_func:
_run_func_name = _module_runable_func[mod]
self._run_func = getattr(self, _run_func_name) self._run_func = getattr(self, _run_func_name)
else: else:
self._run_func = None self._run_func = None
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册