7
7
import tarfile
8
8
import string
9
9
import requests
10
- import warnings
11
10
from pkg_resources import resource_filename
12
11
from bs4 import BeautifulSoup
13
12
import pyvo
14
13
15
14
from urllib .parse import urljoin
16
15
from astropy .table import Table , Column , vstack
17
16
from astroquery import log
18
- from astropy .utils import deprecated
19
17
from astropy .utils .console import ProgressBar
20
- from astropy .utils .exceptions import AstropyDeprecationWarning
21
18
from astropy import units as u
22
19
from astropy .time import Time
23
20
from pyvo .dal .sia2 import SIA_PARAMETERS_DESC
@@ -236,7 +233,7 @@ def tap(self):
236
233
self ._tap = pyvo .dal .tap .TAPService (baseurl = self .tap_url )
237
234
return self ._tap
238
235
239
- def query_object_async (self , object_name , cache = None , public = True ,
236
+ def query_object_async (self , object_name , * , public = True ,
240
237
science = True , payload = None , ** kwargs ):
241
238
"""
242
239
Query the archive for a source name.
@@ -245,7 +242,6 @@ def query_object_async(self, object_name, cache=None, public=True,
245
242
----------
246
243
object_name : str
247
244
The object name. Will be resolved by astropy.coord.SkyCoord
248
- cache : deprecated
249
245
public : bool
250
246
True to return only public datasets, False to return private only,
251
247
None to return both
@@ -262,7 +258,7 @@ def query_object_async(self, object_name, cache=None, public=True,
262
258
return self .query_async (public = public , science = science ,
263
259
payload = payload , ** kwargs )
264
260
265
- def query_region_async (self , coordinate , radius , cache = None , public = True ,
261
+ def query_region_async (self , coordinate , radius , * , public = True ,
266
262
science = True , payload = None , ** kwargs ):
267
263
"""
268
264
Query the ALMA archive with a source name and radius
@@ -273,8 +269,6 @@ def query_region_async(self, coordinate, radius, cache=None, public=True,
273
269
the identifier or coordinates around which to query.
274
270
radius : str / `~astropy.units.Quantity`, optional
275
271
the radius of the region
276
- cache : Deprecated
277
- Cache the query?
278
272
public : bool
279
273
True to return only public datasets, False to return private only,
280
274
None to return both
@@ -299,18 +293,15 @@ def query_region_async(self, coordinate, radius, cache=None, public=True,
299
293
return self .query_async (public = public , science = science ,
300
294
payload = payload , ** kwargs )
301
295
302
- def query_async (self , payload , cache = None , public = True , science = True ,
303
- legacy_columns = False , max_retries = None ,
304
- get_html_version = None ,
305
- get_query_payload = None , ** kwargs ):
296
+ def query_async (self , payload , * , public = True , science = True ,
297
+ legacy_columns = False , get_query_payload = None , ** kwargs ):
306
298
"""
307
299
Perform a generic query with user-specified payload
308
300
309
301
Parameters
310
302
----------
311
303
payload : dictionary
312
304
Please consult the `help` method
313
- cache : deprecated
314
305
public : bool
315
306
True to return only public datasets, False to return private only,
316
307
None to return both
@@ -327,17 +318,6 @@ def query_async(self, payload, cache=None, public=True, science=True,
327
318
Table with results. Columns are those in the ALMA ObsCore model
328
319
(see ``help_tap``) unless ``legacy_columns`` argument is set to True.
329
320
"""
330
- local_args = dict (locals ().items ())
331
-
332
- for arg in local_args :
333
- # check if the deprecated attributes have been used
334
- for dep in ['cache' , 'max_retries' , 'get_html_version' ]:
335
- if arg [0 ] == dep and arg [1 ] is not None :
336
- warnings .warn (
337
- ("Argument '{}' has been deprecated "
338
- "since version 4.0.1 and will be ignored" .format (arg [0 ])),
339
- AstropyDeprecationWarning )
340
- del kwargs [arg [0 ]]
341
321
342
322
if payload is None :
343
323
payload = {}
@@ -500,53 +480,6 @@ def _get_dataarchive_url(self):
500
480
"on github." )
501
481
return self .dataarchive_url
502
482
503
- @deprecated (since = "v0.4.1" , alternative = "get_data_info" )
504
- def stage_data (self , uids , expand_tarfiles = False , return_json = False ):
505
- """
506
- Obtain table of ALMA files
507
-
508
- DEPRECATED: Data is no longer staged. This method is deprecated and
509
- kept here for backwards compatibility reasons but it's not fully
510
- compatible with the original implementation.
511
-
512
- Parameters
513
- ----------
514
- uids : list or str
515
- A list of valid UIDs or a single UID.
516
- UIDs should have the form: 'uid://A002/X391d0b/X7b'
517
- expand_tarfiles : DEPRECATED
518
- return_json : DEPRECATED
519
- Note: The returned astropy table can be easily converted to json
520
- through pandas:
521
- output = StringIO()
522
- stage_data(...).to_pandas().to_json(output)
523
- table_json = output.getvalue()
524
-
525
- Returns
526
- -------
527
- data_file_table : Table
528
- A table containing 3 columns: the UID, the file URL (for future
529
- downloading), and the file size
530
- """
531
-
532
- if return_json :
533
- raise AttributeError (
534
- 'return_json is deprecated. See method docs for a workaround' )
535
- table = Table ()
536
- res = self .get_data_info (uids , expand_tarfiles = expand_tarfiles )
537
- p = re .compile (r'.*(uid__.*)\.asdm.*' )
538
- if res :
539
- table ['name' ] = [u .split ('/' )[- 1 ] for u in res ['access_url' ]]
540
- table ['id' ] = [p .search (x ).group (1 ) if 'asdm' in x else 'None'
541
- for x in table ['name' ]]
542
- table ['type' ] = res ['content_type' ]
543
- table ['size' ] = res ['content_length' ]
544
- table ['permission' ] = ['UNKNOWN' ] * len (res )
545
- table ['mous_uid' ] = [uids ] * len (res )
546
- table ['URL' ] = res ['access_url' ]
547
- table ['isProprietary' ] = res ['readable' ]
548
- return table
549
-
550
483
def get_data_info (self , uids , expand_tarfiles = False ,
551
484
with_auxiliary = True , with_rawdata = True ):
552
485
0 commit comments