|
10 | 10 | import keyring
|
11 | 11 | import io
|
12 | 12 | import os
|
13 |
| -import warnings |
14 | 13 | import requests
|
15 | 14 | import textwrap
|
16 | 15 |
|
17 | 16 | from datetime import datetime, timedelta
|
18 | 17 | from pathlib import Path
|
19 | 18 |
|
20 | 19 | from astropy.config import paths
|
21 |
| -from astroquery import log |
22 | 20 | import astropy.units as u
|
23 | 21 | from astropy.utils.console import ProgressBarOrSpinner
|
24 | 22 | import astropy.utils.data
|
25 | 23 |
|
26 |
| -from . import version |
27 |
| -from .utils import system_tools |
28 |
| -from astroquery import conf |
| 24 | +from astroquery import version, log, conf |
| 25 | +from astroquery.utils import system_tools |
| 26 | + |
29 | 27 |
|
30 | 28 | __all__ = ['BaseQuery', 'QueryWithLogin']
|
31 | 29 |
|
@@ -133,7 +131,7 @@ def from_cache(self, cache_location, cache_timeout):
|
133 | 131 | else:
|
134 | 132 | log.debug("Cache expired for {0}...".format(request_file))
|
135 | 133 | response = None
|
136 |
| - except IOError: # TODO: change to FileNotFoundError once drop py2 support |
| 134 | + except FileNotFoundError: |
137 | 135 | response = None
|
138 | 136 | if response:
|
139 | 137 | log.debug("Retrieved data from {0}".format(request_file))
|
@@ -201,7 +199,6 @@ def __init__(self):
|
201 | 199 |
|
202 | 200 | self.name = self.__class__.__name__.split("Class")[0]
|
203 | 201 | self._cache_active = conf.use_cache
|
204 |
| - self.use_cache = conf.use_cache |
205 | 202 | self.cache_timeout = conf.default_cache_timeout
|
206 | 203 |
|
207 | 204 |
|
@@ -257,7 +254,7 @@ def reset_cache_preferences(self):
|
257 | 254 | conf.cache_location,
|
258 | 255 | self.__class__.__name__.split("Class")[0])
|
259 | 256 |
|
260 |
| - self.use_cache = conf.use_cache |
| 257 | + self._cache_active = conf.use_cache |
261 | 258 | self.cache_timeout = conf.default_cache_timeout
|
262 | 259 |
|
263 | 260 | def _request(self, method, url,
|
@@ -330,7 +327,7 @@ def _request(self, method, url,
|
330 | 327 | json=json
|
331 | 328 | )
|
332 | 329 |
|
333 |
| - if (cache is not False) and self.use_cache: |
| 330 | + if (cache is not False) and self._cache_active: |
334 | 331 | cache = True
|
335 | 332 | else:
|
336 | 333 | cache = False
|
|
0 commit comments