@@ -50,7 +50,7 @@ def get_njit_funcs():
50
50
func_name = node .name
51
51
for decorator in node .decorator_list :
52
52
decorator_name = None
53
- if isinstance (decorator , ast .Name ):
53
+ if isinstance (decorator , ast .Name ): # pragma: no cover
54
54
# Bare decorator
55
55
decorator_name = decorator .id
56
56
if isinstance (decorator , ast .Call ) and isinstance (
@@ -79,7 +79,7 @@ def _enable():
79
79
"""
80
80
frame = inspect .currentframe ()
81
81
caller_name = inspect .getouterframes (frame )[1 ].function
82
- if caller_name != "_save" :
82
+ if caller_name != "_save" : # pragma: no cover
83
83
msg = (
84
84
"The 'cache._enable()' function is deprecated and no longer supported. "
85
85
+ "Please use 'cache.save()' instead"
@@ -90,7 +90,16 @@ def _enable():
90
90
for module_name , func_name in njit_funcs :
91
91
module = importlib .import_module (f".{ module_name } " , package = "stumpy" )
92
92
func = getattr (module , func_name )
93
- func .enable_caching ()
93
+ try :
94
+ func .enable_caching ()
95
+ except AttributeError as e :
96
+ if (
97
+ numba .config .DISABLE_JIT
98
+ and str (e ) == "'function' object has no attribute 'enable_caching'"
99
+ ):
100
+ pass
101
+ else : # pragma: no cover
102
+ raise
94
103
95
104
96
105
def _clear ():
@@ -167,7 +176,16 @@ def _recompile():
167
176
for module_name , func_name in get_njit_funcs ():
168
177
module = importlib .import_module (f".{ module_name } " , package = "stumpy" )
169
178
func = getattr (module , func_name )
170
- func .recompile ()
179
+ try :
180
+ func .recompile ()
181
+ except AttributeError as e :
182
+ if (
183
+ numba .config .DISABLE_JIT
184
+ and str (e ) == "'function' object has no attribute 'recompile'"
185
+ ):
186
+ pass
187
+ else : # pragma: no cover
188
+ raise
171
189
172
190
return
173
191
@@ -206,8 +224,9 @@ def save():
206
224
if numba .config .DISABLE_JIT :
207
225
msg = "Could not save/cache function because NUMBA JIT is disabled"
208
226
warnings .warn (msg )
209
- else :
227
+ else : # pragma: no cover
210
228
warnings .warn (CACHE_WARNING )
211
- _save ()
229
+
230
+ _save ()
212
231
213
232
return
0 commit comments