Skip to content

Commit 93242ba

Browse files
committed
adding back suspend cache for backward compatibility
1 parent 732b253 commit 93242ba

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
@@ -478,6 +478,22 @@ def _download_file(self, url, local_filepath, timeout=None, auth=None,
478478
return response
479479

480480

481+
class suspend_cache:
482+
"""
483+
A context manager that suspends caching.
484+
"""
485+
486+
def __init__(self, obj=None):
487+
self.original_cache_setting = conf.cache_active
488+
489+
def __enter__(self):
490+
conf.cache_active = False
491+
492+
def __exit__(self, exc_type, exc_value, traceback):
493+
conf.cache_active = self.original_cache_setting
494+
return False
495+
496+
481497
class QueryWithLogin(BaseQuery):
482498
"""
483499
This is the base class for all the query classes which are required to

0 commit comments

Comments
 (0)