Skip to content

Commit 9bf37f7

Browse files
committed
fix to catch njit functions with decorator
1 parent e4edee2 commit 9bf37f7

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

stumpy/cache.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,16 @@ def get_njit_funcs():
4343
if isinstance(node, ast.FunctionDef):
4444
func_name = node.name
4545
for decorator in node.decorator_list:
46-
if isinstance(decorator, ast.Call) and isinstance(
47-
decorator.func, ast.Name
48-
):
49-
if decorator.func.id == "njit":
50-
njit_funcs.append((module_name, func_name))
46+
scenario_1 = isinstance(decorator, ast.Name) and (
47+
decorator.id == "njit"
48+
)
49+
scenario_2 = (
50+
isinstance(decorator, ast.Call)
51+
and isinstance(decorator.func, ast.Name)
52+
and decorator.func.id == "njit"
53+
)
54+
if scenario_1 or scenario_2:
55+
njit_funcs.append((module_name, func_name))
5156

5257
return njit_funcs
5358

0 commit comments

Comments
 (0)