From 5b280e4cd92be882f77f7b70769196f1c37ba748 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Brigitta=20Sip=C5=91cz?= Date: Fri, 20 Oct 2023 12:34:46 -0700 Subject: [PATCH] DEP: votable.tree.Table was renamed to TableElement --- docs/dal/index.rst | 2 +- pyvo/dal/adhoc.py | 2 +- pyvo/dal/query.py | 4 ++-- pyvo/dal/scs.py | 2 +- pyvo/dal/sia.py | 2 +- pyvo/dal/sia2.py | 2 +- pyvo/dal/sla.py | 2 +- pyvo/dal/ssa.py | 2 +- pyvo/dal/tap.py | 2 +- pyvo/dal/tests/test_query.py | 12 +++++++++--- 10 files changed, 19 insertions(+), 13 deletions(-) diff --git a/docs/dal/index.rst b/docs/dal/index.rst index 985e9c291..953007f05 100644 --- a/docs/dal/index.rst +++ b/docs/dal/index.rst @@ -895,7 +895,7 @@ conventions. If you want to work with the XML data structures :py:class:`astropy.io.votable.tree.VOTableFile` or -:py:class:`astropy.io.votable.tree.Table`, they are accessible by the +:py:class:`astropy.io.votable.tree.TableElement`, they are accessible by the attributes :py:attr:`pyvo.dal.DALResults.resultstable` and :py:attr:`pyvo.dal.DALResults.votable`, respectively. diff --git a/pyvo/dal/adhoc.py b/pyvo/dal/adhoc.py index 0be375f42..6f1e692b3 100644 --- a/pyvo/dal/adhoc.py +++ b/pyvo/dal/adhoc.py @@ -467,7 +467,7 @@ class DatalinkResults(DatalinkResultsMixin, DALResults): ``DatalinkResults`` is essentially a wrapper around an Astropy :py:mod:`~astropy.io.votable` - :py:class:`~astropy.io.votable.tree.Table` instance where the + :py:class:`~astropy.io.votable.tree.TableElement` instance where the columns contain the various metadata describing the images. One can access that VOTable directly via the :py:attr:`~pyvo.dal.query.DALResults.votable` attribute. Thus, diff --git a/pyvo/dal/query.py b/pyvo/dal/query.py index 361da2b0f..a21c818c5 100644 --- a/pyvo/dal/query.py +++ b/pyvo/dal/query.py @@ -223,7 +223,7 @@ def execute_votable(self, post=False): Returns ------- - astropy.io.votable.tree.Table + astropy.io.votable.tree.TableElement an Astropy votable Table instance Raises @@ -420,7 +420,7 @@ def votable(self): @property def resultstable(self): """ - The votable XML element `astropy.io.votable.tree.Table` + The votable XML element `astropy.io.votable.tree.TableElement` """ return self._resultstable diff --git a/pyvo/dal/scs.py b/pyvo/dal/scs.py index d54225b3a..00f97a5f9 100644 --- a/pyvo/dal/scs.py +++ b/pyvo/dal/scs.py @@ -434,7 +434,7 @@ class SCSResults(DatalinkResultsMixin, DALResults): ``SCSResults`` is essentially a wrapper around an Astropy :py:mod:`~astropy.io.votable` - :py:class:`~astropy.io.votable.tree.Table` instance where the + :py:class:`~astropy.io.votable.tree.TableElement` instance where the columns contain the various metadata describing the images. One can access that VOTable directly via the :py:attr:`~pyvo.dal.query.DALResults.votable` attribute. Thus, diff --git a/pyvo/dal/sia.py b/pyvo/dal/sia.py index 19066e510..899d51c66 100644 --- a/pyvo/dal/sia.py +++ b/pyvo/dal/sia.py @@ -594,7 +594,7 @@ class SIAResults(DatalinkResultsMixin, DALResults): ``SIAResults`` is essentially a wrapper around an Astropy :py:mod:`~astropy.io.votable` - :py:class:`~astropy.io.votable.tree.Table` instance where the + :py:class:`~astropy.io.votable.tree.TableElement` instance where the columns contain the various metadata describing the images. One can access that VOTable directly via the :py:attr:`~pyvo.dal.query.DALResults.votable` attribute. Thus, diff --git a/pyvo/dal/sia2.py b/pyvo/dal/sia2.py index 9aad10c56..d82a8a94c 100644 --- a/pyvo/dal/sia2.py +++ b/pyvo/dal/sia2.py @@ -487,7 +487,7 @@ class SIA2Results(DatalinkResultsMixin, DALResults): ``SIA2Results`` is essentially a wrapper around an Astropy :py:mod:`~astropy.io.votable` - :py:class:`~astropy.io.votable.tree.Table` instance where the + :py:class:`~astropy.io.votable.tree.TableElement` instance where the columns contain the various metadata describing the images. One can access that VOTable directly via the :py:attr:`~pyvo.dal.query.DALResults.votable` attribute. Thus, diff --git a/pyvo/dal/sla.py b/pyvo/dal/sla.py index 55968ee68..1b8c072e8 100644 --- a/pyvo/dal/sla.py +++ b/pyvo/dal/sla.py @@ -367,7 +367,7 @@ class SLAResults(DALResults): ``SLAResults`` is essentially a wrapper around an Astropy :py:mod:`~astropy.io.votable` - :py:class:`~astropy.io.votable.tree.Table` instance where the + :py:class:`~astropy.io.votable.tree.TableElement` instance where the columns contain the various metadata describing the images. One can access that VOTable directly via the :py:attr:`~pyvo.dal.query.DALResults.votable` attribute. Thus, diff --git a/pyvo/dal/ssa.py b/pyvo/dal/ssa.py index ce9a3f14d..488b6d5e0 100644 --- a/pyvo/dal/ssa.py +++ b/pyvo/dal/ssa.py @@ -597,7 +597,7 @@ class SSAResults(DatalinkResultsMixin, DALResults): ``SSAResults`` is essentially a wrapper around an Astropy :py:mod:`~astropy.io.votable` - :py:class:`~astropy.io.votable.tree.Table` instance where the + :py:class:`~astropy.io.votable.tree.TableElement` instance where the columns contain the various metadata describing the spectra. One can access that VOTable directly via the :py:attr:`~pyvo.dal.query.DALResults.votable` attribute. Thus, diff --git a/pyvo/dal/tap.py b/pyvo/dal/tap.py index a79cecf86..567db098c 100644 --- a/pyvo/dal/tap.py +++ b/pyvo/dal/tap.py @@ -1147,7 +1147,7 @@ class TAPResults(DatalinkResultsMixin, DALResults): ``TAPResults`` is essentially a wrapper around an Astropy :py:mod:`~astropy.io.votable` - :py:class:`~astropy.io.votable.tree.Table` instance where the + :py:class:`~astropy.io.votable.tree.TableElement` instance where the columns contain the various metadata describing the images. One can access that VOTable directly via the :py:attr:`~pyvo.dal.query.DALResults.votable` attribute. Thus, diff --git a/pyvo/dal/tests/test_query.py b/pyvo/dal/tests/test_query.py index 92f66a89e..8dcee7f04 100644 --- a/pyvo/dal/tests/test_query.py +++ b/pyvo/dal/tests/test_query.py @@ -20,9 +20,15 @@ from pyvo.version import version from astropy.table import Table, QTable -from astropy.io.votable.tree import VOTableFile, Table as VOTable -from astropy.io.fits import HDUList +from astropy.io.votable.tree import VOTableFile + +try: + # Workaround astropy deprecation, remove try/except once >=6.0 is required + from astropy.io.votable.tree import TableElement +except ImportError: + from astropy.io.votable.tree import Table as TableElement +from astropy.io.fits import HDUList from astropy.utils.data import get_pkg_data_contents get_pkg_data_contents = partial( @@ -271,7 +277,7 @@ def test_init(self): assert dalresults.queryurl == 'http://example.com/query/basic' assert isinstance(dalresults.votable, VOTableFile) - assert isinstance(dalresults.resultstable, VOTable) + assert isinstance(dalresults.resultstable, TableElement) assert dalresults.fieldnames == ('1', '2') assert (