Skip to content

Commit d90083f

Browse files
authored
Merge branch 'main' into gaia-astroquery-1.1
2 parents 083cc2f + 9526b6f commit d90083f

File tree

15 files changed

+43
-129
lines changed

15 files changed

+43
-129
lines changed

.github/workflows/ci_crontests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ jobs:
2424
- name: Python 3.9 with all dependencies with remote data
2525
os: ubuntu-latest
2626
python: '3.9'
27-
toxenv: py39-test-alldeps-devdeps
27+
toxenv: py39-test-alldeps-devdeps-online
2828
toxargs: -v
29-
toxposargs: --remote-data -v --durations=50
29+
toxposargs: -v --durations=50
3030

3131
- name: pre-repease dependencies with all dependencies
3232
os: ubuntu-latest

CHANGES.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ casda
3434
- Use the standard ``login`` method for authenticating, which supports the system
3535
keyring [#2386]
3636

37+
ipac.nexsci.nasa_exoplanet_archive
38+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39+
40+
- The deprecated methods ``query_planet()`` and ``query_star()`` have been removed.
41+
3742
jplsbdb
3843
^^^^^^^
3944

@@ -53,6 +58,12 @@ gaia
5358
With this change the epoch photometry service returns all data associated to
5459
a given source. [#2376]
5560

61+
oac
62+
^^^
63+
64+
- Fix bug in parsing events that contain html tags (e.g. in their alias
65+
field). [#2423]
66+
5667
Infrastructure, Utility and Other Changes and Additions
5768
-------------------------------------------------------
5869

astroquery/esa/iso/tests/setup_package.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
1010
"""
1111

12-
from __future__ import absolute_import
13-
1412
import os
1513

1614

astroquery/exoplanet_orbit_database/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
66
:Author: Brett M. Morris ([email protected])
77
"""
8-
from __future__ import (absolute_import, division, print_function,
9-
unicode_literals)
108
from .exoplanet_orbit_database import (ExoplanetOrbitDatabase,
119
ExoplanetOrbitDatabaseClass)
1210
from astropy import config as _config

astroquery/exoplanet_orbit_database/exoplanet_orbit_database.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# Licensed under a 3-clause BSD style license - see LICENSE.rst
2-
from __future__ import (absolute_import, division, print_function,
3-
unicode_literals)
42
import json
53
import os
64

astroquery/exoplanet_orbit_database/tests/test_exoplanet_orbit_database.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import (absolute_import, division, print_function,
2-
unicode_literals)
31
import os
42

53
import pytest

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()

astroquery/oac/core.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import json
1414
import csv
15+
import re
1516

1617
import astropy.units as u
1718
from astropy.table import Column, Table
@@ -435,7 +436,12 @@ def _args_to_payload(self, event, quantity,
435436

436437
def _format_output(self, raw_output):
437438
if self.FORMAT == 'csv':
438-
split_output = raw_output.splitlines()
439+
440+
fixed_raw_output = re.sub('<[^<]+?>', '', raw_output)
441+
split_output = fixed_raw_output.splitlines()
442+
443+
# Remove any HTML tags
444+
439445
columns = list(csv.reader([split_output[0]], delimiter=',',
440446
quotechar='"'))[0]
441447
rows = split_output[1:]

astroquery/oac/tests/test_oac_remote.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,27 @@ def test_query_region_box_json(self):
5959
data_format='json')
6060
assert isinstance(phot, dict)
6161

62-
@pytest.mark.xfail(reason="Upstream API issue. See #1130")
6362
def test_get_photometry(self):
6463
phot = OAC.get_photometry(event="SN2014J")
6564
assert isinstance(phot, Table)
65+
assert len(phot) > 0
6666

6767
def test_get_photometry_b(self):
6868
phot = OAC.get_photometry(event="SN2014J")
6969
assert isinstance(phot, Table)
70+
assert len(phot) > 0
7071

71-
@pytest.mark.xfail(reason="Upstream API issue. See #1130")
7272
def test_get_single_spectrum(self):
7373
spec = OAC.get_single_spectrum(event="SN2014J",
7474
time=self.test_time)
7575
assert isinstance(spec, Table)
76+
assert len(spec) > 0
7677

7778
def test_get_single_spectrum_b(self):
7879
test_time = 56680
7980
spec = OAC.get_single_spectrum(event="SN2014J", time=test_time)
8081
assert isinstance(spec, Table)
82+
assert len(spec) > 0
8183

8284
def test_get_spectra(self):
8385
spec = OAC.get_spectra(event="SN2014J")

0 commit comments

Comments
 (0)