2424
2525import astropy .table
2626import astropy .utils .data
27- import astropy .units as u
2827import keyring
2928import requests .exceptions
3029from astropy .table import Table , Column
3130from astropy .utils .decorators import deprecated_renamed_argument
3231from bs4 import BeautifulSoup
3332import pyvo
3433
35- from astroquery import log , cache_conf
34+ from astroquery import log
3635from . import conf
3736from ..exceptions import RemoteServiceError , LoginError , \
3837 NoResultsWarning , MaxResultsWarning
3938from ..query import QueryWithLogin
4039from ..utils import schema
4140from .utils import py2adql , _split_str_as_list_of_str , \
42- adql_sanitize_val , to_cache , eso_hash , are_coords_valid , \
43- read_table_from_file , is_file_expired
41+ adql_sanitize_val , are_coords_valid
4442
4543__doctest_skip__ = ['EsoClass.*' ]
4644
@@ -87,25 +85,13 @@ class EsoClass(QueryWithLogin):
8785 AUTH_URL = "https://www.eso.org/sso/oidc/token"
8886 GUNZIP = "gunzip"
8987
90- def __init__ (self , timeout = None ):
88+ def __init__ (self ):
9189 super ().__init__ ()
9290 self ._instruments : Optional [List [str ]] = None
9391 self ._collections : Optional [List [str ]] = None
9492 self ._auth_info : Optional [AuthInfo ] = None
95- self .timeout = timeout # TODO: Is this timeout for login?
9693 self ._hash = None
97- self .USE_DEV_TAP = False
98-
99- @property
100- def timeout (self ):
101- return self ._timeout
102-
103- @timeout .setter
104- def timeout (self , value ):
105- if hasattr (value , 'to' ):
106- self ._timeout = value .to (u .s ).value
107- else :
108- self ._timeout = value
94+ self .USE_DEV_TAP = True
10995
11096 def tap_url (self ) -> str :
11197 url = conf .tap_url
@@ -120,37 +106,6 @@ def tap_url(self) -> str:
120106 log .info (logmsg )
121107 return url
122108
123- def request_file (self , query_str : str ):
124- h = eso_hash (query_str = query_str , url = self .tap_url ())
125- fn = self .cache_location .joinpath (h + ".pickle" )
126- return fn
127-
128- def from_cache (self , query_str , cache_timeout ):
129- table_file = self .request_file (query_str )
130- expired = is_file_expired (table_file , cache_timeout )
131- cached_table = None
132- if not expired :
133- cached_table = self .read_cached_table (table_file )
134- else :
135- logmsg = (f"Cache expired for { table_file } ..." )
136- log .debug (logmsg )
137- return cached_table
138-
139- def read_cached_table (self , table_file ):
140- try :
141- cached_table = read_table_from_file (table_file )
142- except FileNotFoundError :
143- cached_table = None
144-
145- if not isinstance (cached_table , Table ):
146- cached_table = None
147-
148- if cached_table :
149- logmsg = (f"Retrieved data from { table_file } ..." )
150- log .debug (logmsg )
151-
152- return cached_table
153-
154109 def _authenticate (self , * , username : str , password : str ) -> bool :
155110 """
156111 Get the access token from ESO SSO provider
@@ -237,7 +192,7 @@ def _get_auth_header(self) -> Dict[str, str]:
237192
238193 def query_tap_service (self ,
239194 query_str : str ,
240- cache : Optional [ bool ] = None ) -> Optional [astropy .table .Table ]:
195+ ) -> Optional [astropy .table .Table ]:
241196 """
242197 returns an astropy.table.Table from an adql query string
243198 Example use:
@@ -248,22 +203,12 @@ def query_tap_service(self,
248203 if self .ROW_LIMIT > 0 :
249204 maxrec = self .ROW_LIMIT
250205
251- if cache is None : # Global caching not overridden
252- cache = cache_conf .cache_active
253-
254206 tap = pyvo .dal .TAPService (self .tap_url ())
255207 table_to_return = None
256208 logmsg = f"querystr = { query_str } "
257209 log .debug (logmsg )
258210 try :
259- if not cache :
260- with cache_conf .set_temp ("cache_active" , False ):
261- table_to_return = tap .search (query_str , maxrec = maxrec ).to_table ()
262- else :
263- table_to_return = self .from_cache (query_str , cache_conf .cache_timeout )
264- if not table_to_return :
265- table_to_return = tap .search (query_str , maxrec = maxrec ).to_table ()
266- to_cache (table_to_return , self .request_file (query_str = query_str ))
211+ table_to_return = tap .search (query_str , maxrec = maxrec ).to_table ()
267212
268213 except pyvo .dal .exceptions .DALQueryError as e :
269214 raise pyvo .dal .exceptions .DALQueryError (
@@ -287,16 +232,12 @@ def query_tap_service(self,
287232
288233 return table_to_return
289234
290- def list_instruments (self , * , cache = True ) -> List [str ]:
235+ def list_instruments (self ) -> List [str ]:
291236 """ List all the available instrument-specific queries offered by the ESO archive.
292237
293238 Returns
294239 -------
295240 instrument_list : list of strings
296- cache : bool
297- Defaults to True. If set overrides global caching behavior.
298- See :ref:`caching documentation <astroquery_cache>`.
299-
300241 """
301242 tmpvar = self .ROW_LIMIT
302243 self .ROW_LIMIT = sys .maxsize
@@ -305,13 +246,13 @@ def list_instruments(self, *, cache=True) -> List[str]:
305246 self ._instruments = []
306247 query_str = ("select table_name from TAP_SCHEMA.tables "
307248 "where schema_name='ist' order by table_name" )
308- res = self .query_tap_service (query_str , cache = cache )["table_name" ].data
249+ res = self .query_tap_service (query_str )["table_name" ].data
309250 self ._instruments = list (map (lambda x : x .split ("." )[1 ], res ))
310251 finally :
311252 self .ROW_LIMIT = tmpvar
312253 return self ._instruments
313254
314- def list_collections (self , * , cache = True ) -> List [str ]:
255+ def list_collections (self ) -> List [str ]:
315256 """ List all the available collections (phase 3) in the ESO archive.
316257
317258 Returns
@@ -329,7 +270,7 @@ def list_collections(self, *, cache=True) -> List[str]:
329270 t = EsoNames .phase3_table
330271 c = EsoNames .phase3_collections_column
331272 query_str = f"select distinct { c } from { t } "
332- res = self .query_tap_service (query_str , cache = cache )[c ].data
273+ res = self .query_tap_service (query_str )[c ].data
333274
334275 self ._collections = list (res )
335276 finally :
@@ -361,7 +302,6 @@ def _query_on_allowed_values(
361302 top : int = None ,
362303 count_only : bool = False ,
363304 print_help : bool = False ,
364- cache : bool = True ,
365305 ** kwargs ) -> Union [astropy .table .Table , int ]:
366306 """
367307 Query instrument- or collection-specific data contained in the ESO archive.
@@ -402,7 +342,7 @@ def _query_on_allowed_values(
402342 count_only = count_only ,
403343 top = top )
404344
405- table_to_return = self .query_tap_service (query_str = query , cache = cache )
345+ table_to_return = self .query_tap_service (query_str = query )
406346
407347 if count_only : # this below is an int, not a table
408348 table_to_return = list (table_to_return [0 ].values ())[0 ]
@@ -416,7 +356,7 @@ def query_collections(
416356 columns : Union [List , str ] = None ,
417357 top : int = None ,
418358 count_only : bool = False ,
419- print_help = False , cache = True ,
359+ print_help = False ,
420360 ** kwargs ) -> Union [astropy .table .Table , int ]:
421361 return self ._query_on_allowed_values (table_name = EsoNames .phase3_table ,
422362 column_name = EsoNames .phase3_collections_column ,
@@ -425,7 +365,7 @@ def query_collections(
425365 columns = columns ,
426366 top = top ,
427367 count_only = count_only ,
428- print_help = print_help , cache = cache ,
368+ print_help = print_help ,
429369 ** kwargs )
430370
431371 def query_main (
@@ -435,7 +375,7 @@ def query_main(
435375 columns : Union [List , str ] = None ,
436376 top : int = None ,
437377 count_only : bool = False ,
438- print_help = False , cache = True ,
378+ print_help = False ,
439379 ** kwargs ) -> Union [astropy .table .Table , int ]:
440380 return self ._query_on_allowed_values (table_name = EsoNames .raw_table ,
441381 column_name = EsoNames .raw_instruments_column ,
@@ -444,7 +384,7 @@ def query_main(
444384 columns = columns ,
445385 top = top ,
446386 count_only = count_only ,
447- print_help = print_help , cache = cache ,
387+ print_help = print_help ,
448388 ** kwargs )
449389
450390 # ex query_instrument
@@ -455,7 +395,7 @@ def query_instrument(
455395 columns : Union [List , str ] = None ,
456396 top : int = None ,
457397 count_only : bool = False ,
458- print_help = False , cache = True ,
398+ print_help = False ,
459399 ** kwargs ) -> Union [astropy .table .Table , int ]:
460400 return self ._query_on_allowed_values (table_name = EsoNames .ist_table (instrument ),
461401 column_name = None ,
@@ -464,7 +404,7 @@ def query_instrument(
464404 columns = columns ,
465405 top = top ,
466406 count_only = count_only ,
467- print_help = print_help , cache = cache ,
407+ print_help = print_help ,
468408 ** kwargs )
469409
470410 def get_headers (self , product_ids , * , cache = True ):
@@ -790,7 +730,7 @@ def retrieve_data(self, datasets, *, continuation=False, destination=None,
790730 @deprecated_renamed_argument (('open_form' , 'help' ), (None , 'print_help' ),
791731 since = ['0.4.8' , '0.4.8' ])
792732 def query_apex_quicklooks (self , * , project_id = None , print_help = False ,
793- open_form = False , cache = True , ** kwargs ):
733+ open_form = False , ** kwargs ):
794734 """
795735 APEX data are distributed with quicklook products identified with a
796736 different name than other ESO products. This query tool searches by
@@ -803,11 +743,7 @@ def query_apex_quicklooks(self, *, project_id=None, print_help=False,
803743 """
804744 # TODO All this function
805745 _ = project_id , print_help , open_form , kwargs
806- if cache :
807- query = "APEX_QUERY_PLACEHOLDER"
808- return self .query_tap_service (query_str = query , cache = cache )
809- else :
810- raise NotImplementedError
746+ raise NotImplementedError
811747
812748
813749Eso = EsoClass ()
0 commit comments