Skip to content

Commit bcfcbca

Browse files
committed
Removing long deprecated arguments and stage_data method.
1 parent 60db44d commit bcfcbca

File tree

1 file changed

+4
-71
lines changed

1 file changed

+4
-71
lines changed

astroquery/alma/core.py

Lines changed: 4 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,14 @@
77
import tarfile
88
import string
99
import requests
10-
import warnings
1110
from pkg_resources import resource_filename
1211
from bs4 import BeautifulSoup
1312
import pyvo
1413

1514
from urllib.parse import urljoin
1615
from astropy.table import Table, Column, vstack
1716
from astroquery import log
18-
from astropy.utils import deprecated
1917
from astropy.utils.console import ProgressBar
20-
from astropy.utils.exceptions import AstropyDeprecationWarning
2118
from astropy import units as u
2219
from astropy.time import Time
2320
from pyvo.dal.sia2 import SIA_PARAMETERS_DESC
@@ -236,7 +233,7 @@ def tap(self):
236233
self._tap = pyvo.dal.tap.TAPService(baseurl=self.tap_url)
237234
return self._tap
238235

239-
def query_object_async(self, object_name, cache=None, public=True,
236+
def query_object_async(self, object_name, *, public=True,
240237
science=True, payload=None, **kwargs):
241238
"""
242239
Query the archive for a source name.
@@ -245,7 +242,6 @@ def query_object_async(self, object_name, cache=None, public=True,
245242
----------
246243
object_name : str
247244
The object name. Will be resolved by astropy.coord.SkyCoord
248-
cache : deprecated
249245
public : bool
250246
True to return only public datasets, False to return private only,
251247
None to return both
@@ -262,7 +258,7 @@ def query_object_async(self, object_name, cache=None, public=True,
262258
return self.query_async(public=public, science=science,
263259
payload=payload, **kwargs)
264260

265-
def query_region_async(self, coordinate, radius, cache=None, public=True,
261+
def query_region_async(self, coordinate, radius, *, public=True,
266262
science=True, payload=None, **kwargs):
267263
"""
268264
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,
273269
the identifier or coordinates around which to query.
274270
radius : str / `~astropy.units.Quantity`, optional
275271
the radius of the region
276-
cache : Deprecated
277-
Cache the query?
278272
public : bool
279273
True to return only public datasets, False to return private only,
280274
None to return both
@@ -299,18 +293,15 @@ def query_region_async(self, coordinate, radius, cache=None, public=True,
299293
return self.query_async(public=public, science=science,
300294
payload=payload, **kwargs)
301295

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):
306298
"""
307299
Perform a generic query with user-specified payload
308300
309301
Parameters
310302
----------
311303
payload : dictionary
312304
Please consult the `help` method
313-
cache : deprecated
314305
public : bool
315306
True to return only public datasets, False to return private only,
316307
None to return both
@@ -327,17 +318,6 @@ def query_async(self, payload, cache=None, public=True, science=True,
327318
Table with results. Columns are those in the ALMA ObsCore model
328319
(see ``help_tap``) unless ``legacy_columns`` argument is set to True.
329320
"""
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]]
341321

342322
if payload is None:
343323
payload = {}
@@ -500,53 +480,6 @@ def _get_dataarchive_url(self):
500480
"on github.")
501481
return self.dataarchive_url
502482

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-
550483
def get_data_info(self, uids, expand_tarfiles=False,
551484
with_auxiliary=True, with_rawdata=True):
552485

0 commit comments

Comments
 (0)