Skip to content

Commit

Permalink
Put back in old function and add deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
mfisherlevine committed Oct 10, 2023
1 parent d009768 commit fcdad76
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions python/lsst/summit/utils/efdUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import logging
import pandas as pd
import re
from deprecated.sphinx import deprecated

from .utils import getSite

Expand All @@ -47,6 +48,7 @@
'getDayObsStartTime',
'getDayObsEndTime',
'getDayObsForTime',
'getSubTopics', # deprecated, being remove in w_2023_50
'getTopics',
]

Expand Down Expand Up @@ -531,6 +533,37 @@ def getDayObsForTime(time):
return int((time + offset).utc.isot[:10].replace('-', ''))


@deprecated(
reason="getSubTopics() has been replaced by getTopics() and using wildcards. "
"Will be removed after w_2023_50.",
version="w_2023_40",
category=FutureWarning,
)
def getSubTopics(client, topic):
"""Get all the sub topics within a given topic.
Note that the topic need not be a complete one, for example, rather than
doing `getSubTopics(client, 'lsst.sal.ATMCS')` to get all the topics for
the AuxTel Mount Control System, you can do `getSubTopics(client,
'lsst.sal.AT')` to get all which relate to the AuxTel in general.
Parameters
----------
client : `lsst_efd_client.efd_helper.EfdClient`
The EFD client to use.
topic : `str`
The topic to query.
Returns
-------
subTopics : `list` of `str`
The sub topics.
"""
loop = asyncio.get_event_loop()
topics = loop.run_until_complete(client.get_topics())
return sorted([t for t in topics if t.startswith(topic)])


def getTopics(client, toFind, caseSensitive=False):
"""Return all the strings in topics which match the topic query string.
Expand Down

0 comments on commit fcdad76

Please sign in to comment.