Skip to content

Commit ce251d2

Browse files
ysmustanley-msft
andauthored
Ensure _get_function_full_qual_name() can get always get the module name (#62)
* Ensure _get_function_full_qual_name() can get the module name when the module is imported through importlib * lint Co-authored-by: Stanley Hsieh <pehsieh@microsoft.com>
1 parent 39b2773 commit ce251d2

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

inference_schema/schema_util.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# ---------------------------------------------------------
44

55
import copy
6-
import inspect
76

87
from inference_schema._constants import INPUT_SCHEMA_ATTR, OUTPUT_SCHEMA_ATTR
98

@@ -108,10 +107,9 @@ def _get_function_full_qual_name(func):
108107
:rtype: str
109108
"""
110109

111-
decorators = _get_decorators(func)
112-
base_func_name = decorators[-1].__name__
113-
module = inspect.getmodule(decorators[-1])
114-
module_name = "" if module is None else module.__name__
110+
original_func = _get_decorators(func)[-1]
111+
base_func_name = original_func.__name__
112+
module_name = getattr(original_func, '__module__', '<unknown>')
115113
return '{}.{}'.format(module_name, base_func_name)
116114

117115

0 commit comments

Comments
 (0)