Skip to content

Commit 89825c9

Browse files
committed
move warnings to public API
1 parent cf4b183 commit 89825c9

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

stumpy/cache.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def _clear():
105105
-------
106106
None
107107
"""
108-
warnings.warn(CACHE_WARNING)
109108
site_pkg_dir = site.getsitepackages()[0]
110109
numba_cache_dir = site_pkg_dir + "/stumpy/__pycache__"
111110
[f.unlink() for f in pathlib.Path(numba_cache_dir).glob("*nb*") if f.is_file()]
@@ -123,6 +122,7 @@ def clear():
123122
-------
124123
None
125124
"""
125+
warnings.warn(CACHE_WARNING)
126126
_clear()
127127

128128
return
@@ -164,7 +164,6 @@ def _recompile():
164164
If the `numba` cache is enabled, this results in saving (and/or overwriting)
165165
the cached numba functions to disk.
166166
"""
167-
warnings.warn(CACHE_WARNING)
168167
for module_name, func_name in get_njit_funcs():
169168
module = importlib.import_module(f".{module_name}", package="stumpy")
170169
func = getattr(module, func_name)
@@ -185,11 +184,8 @@ def _save():
185184
-------
186185
None
187186
"""
188-
warnings.filterwarnings("once")
189-
warnings.warn(CACHE_WARNING)
190187
_enable()
191188
_recompile()
192-
warnings.filterwarnings("default")
193189

194190
return
195191

@@ -211,6 +207,7 @@ def save():
211207
msg = "Cannot save cache because NUMBA JIT is disabled"
212208
raise OSError(msg)
213209

210+
warnings.warn(CACHE_WARNING)
214211
_save()
215212

216213
return

0 commit comments

Comments
 (0)