Skip to content

Commit

Permalink
Merge pull request #484 from bsipocz/deprecate_vodataservice_Table
Browse files Browse the repository at this point in the history
DEP: Deprecate vodataservice Table
  • Loading branch information
bsipocz authored Aug 30, 2023
2 parents 8d735ab + f36247e commit 0806b46
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
``SIA2_PARAMETERS_DESC``. The old names now issue an
``AstropyDeprecationWarning``. [#419]

- Class ``pyvo.vosi.vodataservice.Table`` has been renamed to
``VODataServiceTable`` to avoid sharing the name with a more generic
``astropy.table.Table`` while having different API. [#484]

- Registry search now finds SIA v2 services. [#422, #428]

- Deprecate VOSI ``AvailabilityMixin``, this mean the deprecation of the
Expand Down
2 changes: 1 addition & 1 deletion docs/registry/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ and then you can run:
.. doctest-remote-data::

>>> res.get_tables() # doctest: +IGNORE_OUTPUT
{'flashheros.data': <Table name="flashheros.data">... 29 columns ...</Table>, 'ivoa.obscore': <Table name="ivoa.obscore">... 0 columns ...</Table>}
{'flashheros.data': <VODataServiceTable name="flashheros.data">... 29 columns ...</VODataServiceTable>, 'ivoa.obscore': <VODataServiceTable name="ivoa.obscore">... 0 columns ...</VODataServiceTable>}


Reference/API
Expand Down
4 changes: 2 additions & 2 deletions pyvo/io/vosi/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ def tableset(self, iterator, tag, data, config, pos):
tableset.parse(iterator, config)
self._tableset = tableset

@xmlelement(cls=vs.Table)
@xmlelement(cls=vs.VODataServiceTable)
def table(self):
"""
The `Table` root element if present.
The `VODataServiceTable` root element if present.
"""
return self._table

Expand Down
16 changes: 11 additions & 5 deletions pyvo/io/vosi/vodataservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import re

from astropy.utils import deprecated
from astropy.utils.collections import HomogeneousList
from astropy.utils.misc import indent
from astropy.utils.xml import check as xml_check
Expand All @@ -31,7 +32,7 @@
E01, E02, E03, E04, E05, E06)

__all__ = [
"TableSet", "TableSchema", "ParamHTTP", "Table", "BaseParam", "TableParam",
"TableSet", "TableSchema", "ParamHTTP", "VODataServiceTable", "BaseParam", "TableParam",
"InputParam", "DataType", "SimpleDataType", "TableDataType", "VOTableType",
"TAPDataType", "TAPType", "FKColumn", "ForeignKey"]

Expand Down Expand Up @@ -143,7 +144,7 @@ class TableSchema(Element, HomogeneousList):
"""

def __init__(self, config=None, pos=None, _name='schema', **kwargs):
HomogeneousList.__init__(self, Table)
HomogeneousList.__init__(self, VODataServiceTable)
Element.__init__(self, config, pos, _name, **kwargs)

self._name = None
Expand Down Expand Up @@ -230,7 +231,7 @@ def tables(self):

@tables.adder
def tables(self, iterator, tag, data, config, pos):
table = Table(config, pos, 'table', **data)
table = VODataServiceTable(config, pos, 'table', **data)
table.parse(iterator, config)
self.append(table)

Expand Down Expand Up @@ -288,7 +289,7 @@ def parse(self, iterator, config):
warn_or_raise(W18, W18, config=config, pos=self._pos)


class Table(Element):
class VODataServiceTable(Element):
"""
Table element as described in
http://www.ivoa.net/xml/VODataService/v1.1
Expand All @@ -310,7 +311,7 @@ def __init__(
self._foreignkeys = HomogeneousList(ForeignKey)

def __repr__(self):
return '<Table name="{}">... {} columns ...</Table>'.format(
return '<VODataServiceTable name="{}">... {} columns ...</VODataServiceTable>'.format(
self.name, len(self.columns))

def describe(self):
Expand Down Expand Up @@ -449,6 +450,11 @@ def parse(self, iterator, config):
vo_raise(E06, self._Element__name, config=config, pos=self._pos)


@deprecated("1.5", alternative="VODataServiceTable")
class Table(VODataServiceTable):
pass


class BaseParam(Element):
"""
BaseParam element as described in
Expand Down
6 changes: 3 additions & 3 deletions pyvo/registry/regtap.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,10 +873,10 @@ def _build_vosi_column(self, column_row):

def _build_vosi_table(self, table_row, columns):
"""
return a io.vosi.vodataservice.Table element for a
return a io.vosi.vodataservice.VODataServiceTable element for a
query result from get_tables.
"""
res = vodataservice.Table()
res = vodataservice.VODataServiceTable()
res.name = table_row["table_name"]
res.title = table_row["table_title"]
res.description = table_row["table_description"]
Expand All @@ -892,7 +892,7 @@ def get_tables(self, table_limit=20):
"""
return the structure of the tables underlying the service.
This returns a dict with table names as keys and vosi.Table
This returns a dict with table names as keys and vodataservice.VODataServiceTable
objects as values (pretty much what tables returns for a TAP
service). The table instances will have an ``origin`` attribute
pointing back to the registry record.
Expand Down

0 comments on commit 0806b46

Please sign in to comment.