Skip to content

Commit aa23b21

Browse files
committed
Deprecate unused kwargs, cleanup tests
1 parent 44cf4ba commit aa23b21

File tree

3 files changed

+21
-20
lines changed

3 files changed

+21
-20
lines changed

astroquery/ipac/irsa/core.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def query_tap(self, query, *, maxrec=None):
6060
log.debug(f'TAP query: {query}')
6161
return self.tap.search(query, language='ADQL', maxrec=maxrec)
6262

63+
@deprecated_renamed_argument(("cache", "verbose"), (None, None), since="0.4.7")
6364
def query_region(self, coordinates=None, *, catalog=None, spatial='Cone',
6465
radius=10 * u.arcsec, width=None, polygon=None,
6566
get_query_payload=False, selcols=None,
@@ -103,11 +104,6 @@ def query_region(self, coordinates=None, *, catalog=None, spatial='Cone',
103104
Defaults to `False`.
104105
selcols : str, optional
105106
Target column list with value separated by a comma(,)
106-
verbose : bool, optional.
107-
If `True` then displays warnings when the returned VOTable does not
108-
conform to the standard. Defaults to `False`.
109-
cache : bool, optional
110-
Use local cache when set to `True`.
111107
112108
Returns
113109
-------
@@ -160,18 +156,24 @@ def query_region(self, coordinates=None, *, catalog=None, spatial='Cone',
160156

161157
return response.to_table()
162158

163-
def list_tap_tables(self):
164-
tap_tables = Irsa.query_tap("SELECT * FROM TAP_SCHEMA.tables")
165-
return tap_tables
166-
167-
# TODO, deprecate this legacy in favour of full TAP table Table
168-
@deprecated_renamed_argument("cache", None, "0.4.7")
169-
def list_catalogs(self, cache=False):
159+
@deprecated_renamed_argument("cache", None, since="0.4.7")
160+
def list_catalogs(self, full=False, cache=False):
170161
"""
171-
Return a dictionary of IRSA catalogs.
162+
Return information of available IRSA catalogs.
163+
164+
Parameters
165+
----------
166+
full : bool
167+
If True returns the full schema VOTable. If False returns a dictionary of the table names and
168+
their description.
169+
172170
"""
173171
tap_tables = Irsa.query_tap("SELECT * FROM TAP_SCHEMA.tables")
174-
return {tap_table['table_name']: tap_table['description'] for tap_table in tap_tables}
172+
173+
if full:
174+
return tap_tables
175+
else:
176+
return {tap_table['table_name']: tap_table['description'] for tap_table in tap_tables}
175177

176178
# TODO, deprecate this as legacy
177179
def print_catalogs(self):

astroquery/ipac/irsa/tests/test_irsa.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from astroquery.ipac.irsa import Irsa
99
from astroquery.exceptions import InvalidQueryError
1010

11-
OBJ_LIST = ["m31", "00h42m44.330s +41d16m07.50s",
11+
OBJ_LIST = ["00h42m44.330s +41d16m07.50s",
1212
SkyCoord(l=121.1743 * u.deg, b=-21.5733 * u.deg, frame="galactic")]
1313

1414

@@ -62,7 +62,7 @@ def test_query_allsky():
6262
@pytest.mark.parametrize('spatial', ['cone', 'box', 'polygon', 'all-Sky', 'All-sky', 'invalid'])
6363
def test_spatial_invalid(spatial):
6464
with pytest.raises(ValueError):
65-
Irsa.query_region("m31", catalog='invalid_spatial', spatial=spatial)
65+
Irsa.query_region(OBJ_LIST[0], catalog='invalid_spatial', spatial=spatial)
6666

6767

6868
def test_no_catalog():

astroquery/ipac/irsa/tests/test_irsa_remote.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_query_region_cone(self, coordinates):
2626
"""
2727
Test multiple ways of specifying coordinates for a conesearch
2828
"""
29-
result = Irsa.query_region(coordinates, catalog='fp_psc', spatial='Cone', cache=False)
29+
result = Irsa.query_region(coordinates, catalog='fp_psc', spatial='Cone')
3030
assert isinstance(result, Table)
3131
assert len(result) == 19
3232
# assert all columns are returned
@@ -51,8 +51,7 @@ def test_query_region_box(self):
5151
def test_query_region_polygon(self):
5252
polygon = [(10.1, 10.1), (10.0, 10.1), (10.0, 10.0)]
5353
with pytest.warns(UserWarning, match='Polygon endpoints are being interpreted'):
54-
result = Irsa.query_region("m31", catalog="fp_psc", spatial="Polygon",
55-
polygon=polygon, cache=False)
54+
result = Irsa.query_region("m31", catalog="fp_psc", spatial="Polygon", polygon=polygon)
5655

5756
assert isinstance(result, Table)
5857

@@ -68,4 +67,4 @@ def test_tap(self):
6867
match="Partial result set. Potential causes MAXREC, async storage space, etc."):
6968
result = Irsa.query_tap(query=query)
7069
assert len(result) == 5
71-
assert result.colnames == ['ra', 'dec']
70+
assert result.to_table().colnames == ['ra', 'dec']

0 commit comments

Comments
 (0)