Skip to content

Commit 362e5d8

Browse files
committed
adding back suspend cache for backward compatibility
1 parent 6df612a commit 362e5d8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

astroquery/query.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,22 @@ def _download_file(self, url, local_filepath, timeout=None, auth=None,
484484
return response
485485

486486

487+
class suspend_cache:
488+
"""
489+
A context manager that suspends caching.
490+
"""
491+
492+
def __init__(self, obj=None):
493+
self.original_cache_setting = conf.cache_active
494+
495+
def __enter__(self):
496+
conf.cache_active = False
497+
498+
def __exit__(self, exc_type, exc_value, traceback):
499+
conf.cache_active = self.original_cache_setting
500+
return False
501+
502+
487503
class QueryWithLogin(BaseQuery):
488504
"""
489505
This is the base class for all the query classes which are required to

0 commit comments

Comments
 (0)