Skip to content

Commit 71fe3aa

Browse files
committed
revised function
1 parent e543379 commit 71fe3aa

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

stumpy/cache.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
import site
1010
import warnings
1111

12-
import numba
13-
1412
CACHE_WARNING = "Caching `numba` functions is purely for experimental purposes "
1513
CACHE_WARNING += "and should never be used or depended upon as it is not supported! "
1614
CACHE_WARNING += "All caching capabilities are not tested and may be removed/changed "
@@ -131,16 +129,21 @@ def _recompile(func=None, fastmath=None):
131129
None
132130
"""
133131
warnings.warn(CACHE_WARNING)
132+
njit_funcs = get_njit_funcs()
133+
134+
recompile_funcs = []
134135
if func is None:
135-
njit_funcs = get_njit_funcs()
136136
for module_name, func_name in njit_funcs:
137137
module = importlib.import_module(f".{module_name}", package="stumpy")
138138
func = getattr(module, func_name)
139-
func.recompile()
139+
recompile_funcs.append(func)
140+
elif func in njit_funcs:
141+
recompile_funcs.append(func)
140142
else:
141-
if not numba.extending.is_jitted(func):
142-
msg = "The function `func` must be a (n)jit function."
143-
raise ValueError(msg)
143+
msg = "The function `func` is not a njit function in STUMPY"
144+
raise ValueError(msg)
145+
146+
for func in recompile_funcs:
144147
if fastmath is not None:
145148
func.targetoptions["fastmath"] = fastmath
146149
func.recompile()

0 commit comments

Comments
 (0)