Skip to content

Commit d254369

Browse files
authored
Merge pull request #2431 from eerovaher/rm-nasa-exoplanet-deprecated
Remove deprecated NASA Exoplanet Archive code
2 parents eceb776 + f53f956 commit d254369

File tree

3 files changed

+5
-106
lines changed

3 files changed

+5
-106
lines changed

CHANGES.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ casda
2626
- Use the standard ``login`` method for authenticating, which supports the system
2727
keyring [#2386]
2828

29+
ipac.nexsci.nasa_exoplanet_archive
30+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
31+
32+
- The deprecated methods ``query_planet()`` and ``query_star()`` have been removed.
33+
2934
jplsbdb
3035
^^^^^^^
3136

astroquery/ipac/nexsci/nasa_exoplanet_archive/core.py

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from astropy.io import ascii
1818
from astropy.io.votable import parse_single_table
1919
from astropy.table import QTable
20-
from astropy.utils import deprecated, deprecated_renamed_argument
2120
from astropy.utils.exceptions import AstropyWarning
2221

2322
# Import astroquery utilities
@@ -629,25 +628,6 @@ def _parse_result(self, response, verbose=False):
629628

630629
return data
631630

632-
def _handle_all_columns_argument(self, **kwargs):
633-
"""
634-
Deal with the ``all_columns`` argument that was exposed by earlier versions
635-
636-
This method will warn users about this deprecated argument and update the query syntax
637-
to use ``select='*'``.
638-
"""
639-
# We also have to manually pop these arguments from the dict because
640-
# `deprecated_renamed_argument` doesn't do that for some reason for all supported astropy
641-
# versions (v3.1 was beheaving as expected)
642-
kwargs.pop("show_progress", None)
643-
kwargs.pop("table_path", None)
644-
645-
# Deal with `all_columns` properly
646-
if kwargs.pop("all_columns", None):
647-
kwargs["select"] = kwargs.get("select", "*")
648-
649-
return kwargs
650-
651631
@class_or_instance
652632
def _request_to_sql(self, request_payload):
653633
"""Convert request_payload dict to SQL query string to be parsed by TAP."""
@@ -677,51 +657,5 @@ def _request_to_sql(self, request_payload):
677657

678658
return tap_query
679659

680-
@deprecated(since="v0.4.1", alternative="query_object")
681-
@deprecated_renamed_argument(["show_progress", "table_path"],
682-
[None, None], "v0.4.1", arg_in_kwargs=True)
683-
def query_planet(self, planet_name, cache=None, **criteria):
684-
"""
685-
Search the ``exoplanets`` table for a confirmed planet
686-
687-
Parameters
688-
----------
689-
planet_name : str
690-
The name of a confirmed planet. If ``regularize`` is ``True``, an attempt will be made
691-
to regularize this name using the ``aliastable`` table.
692-
cache : bool, optional
693-
Should the request result be cached? This can be useful for large repeated queries,
694-
but since the data in the archive is updated regularly, this defaults to ``False``.
695-
**criteria
696-
Any other filtering criteria to apply. Values provided using the ``where`` keyword will
697-
be ignored.
698-
"""
699-
criteria = self._handle_all_columns_argument(**criteria)
700-
criteria["where"] = "pl_name='{0}'".format(planet_name.strip())
701-
return self.query_criteria("exoplanets", cache=cache, **criteria)
702-
703-
@deprecated(since="v0.4.1", alternative="query_object")
704-
@deprecated_renamed_argument(["show_progress", "table_path"],
705-
[None, None], "v0.4.1", arg_in_kwargs=True)
706-
def query_star(self, host_name, cache=None, **criteria):
707-
"""
708-
Search the ``exoplanets`` table for a confirmed planet host
709-
710-
Parameters
711-
----------
712-
host_name : str
713-
The name of a confirmed planet host. If ``regularize`` is ``True``, an attempt will be
714-
made to regularize this name using the ``aliastable`` table.
715-
cache : bool, optional
716-
Should the request result be cached? This can be useful for large repeated queries,
717-
but since the data in the archive is updated regularly, this defaults to ``False``.
718-
**criteria
719-
Any other filtering criteria to apply. Values provided using the ``where`` keyword will
720-
be ignored.
721-
"""
722-
criteria = self._handle_all_columns_argument(**criteria)
723-
criteria["where"] = "pl_hostname='{0}'".format(host_name.strip())
724-
return self.query_criteria("exoplanets", cache=cache, **criteria)
725-
726660

727661
NasaExoplanetArchive = NasaExoplanetArchiveClass()

astroquery/ipac/nexsci/nasa_exoplanet_archive/tests/test_nasa_exoplanet_archive.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -168,46 +168,6 @@ def test_get_access_url():
168168
assert get_access_url('aliaslookup') == conf.url_aliaslookup
169169

170170

171-
def test_backwards_compat(patch_get):
172-
"""
173-
These are the tests from the previous version of this interface.
174-
They query old tables by default and should return InvalidTableError.
175-
"""
176-
NasaExoplanetArchiveMock = NasaExoplanetArchiveClass()
177-
178-
NasaExoplanetArchiveMock._tap_tables = ['list']
179-
180-
# test_hd209458b_exoplanets_archive
181-
with pytest.warns(AstropyDeprecationWarning):
182-
with pytest.raises(InvalidTableError) as error:
183-
NasaExoplanetArchiveMock.query_planet("HD 209458 b ")
184-
assert "replaced" in str(error)
185-
186-
# test_hd209458b_exoplanet_archive_coords
187-
with pytest.warns(AstropyDeprecationWarning):
188-
with pytest.raises(InvalidTableError) as error:
189-
NasaExoplanetArchiveMock.query_planet("HD 209458 b ")
190-
assert "replaced" in str(error)
191-
192-
# test_hd209458_stellar_exoplanet
193-
with pytest.warns(AstropyDeprecationWarning):
194-
with pytest.raises(InvalidTableError) as error:
195-
NasaExoplanetArchiveMock.query_star("HD 209458")
196-
assert "replaced" in str(error)
197-
198-
# test_hd136352_stellar_exoplanet_archive
199-
with pytest.warns(AstropyDeprecationWarning):
200-
with pytest.raises(InvalidTableError) as error:
201-
NasaExoplanetArchiveMock.query_star("HD 136352")
202-
assert "replaced" in str(error)
203-
204-
# test_exoplanet_archive_query_all_columns
205-
with pytest.warns(AstropyDeprecationWarning):
206-
with pytest.raises(InvalidTableError) as error:
207-
NasaExoplanetArchiveMock.query_planet("HD 209458 b ", all_columns=True)
208-
assert "replaced" in str(error)
209-
210-
211171
@pytest.mark.parametrize("table,query", API_TABLES)
212172
def test_api_tables(patch_get, table, query):
213173
NasaExoplanetArchiveMock = NasaExoplanetArchiveClass()

0 commit comments

Comments
 (0)