diff --git a/setup.cfg b/setup.cfg index 77cd1dd..e002362 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,7 +35,7 @@ install_requires = kubernetes maproxy notebook - pyvo + pyvo @ git+https://github.com/astropy/pyvo.git@7682a1809cb2169cc2ffd9313feb6a4abd7f7e37 requests tornado diff --git a/src/lsst/rsp/__init__.py b/src/lsst/rsp/__init__.py index 86ed6d1..7227192 100644 --- a/src/lsst/rsp/__init__.py +++ b/src/lsst/rsp/__init__.py @@ -36,19 +36,21 @@ __all__ = [ "__version__", - "Forwarder", + "get_catalog", + "get_obstap_service", + "get_tap_service", + "retrieve_query", "IPythonHandler", - "format_bytes", "forward_lsst_log", + "Forwarder", + "get_datalink_result", + "get_siav2_service", + "format_bytes", "get_access_token", - "get_catalog", "get_digest", + "get_hostname", "get_node", "get_pod", - "get_tap_service", - "get_obstap_service", - "retrieve_query", - "get_hostname", "get_pyvo_auth", "show_with_bokeh_server", ] diff --git a/src/lsst/rsp/catalog.py b/src/lsst/rsp/catalog.py index eaddd97..6e11b8c 100644 --- a/src/lsst/rsp/catalog.py +++ b/src/lsst/rsp/catalog.py @@ -1,6 +1,4 @@ -import os import warnings -from typing import Optional import pyvo from deprecated import deprecated diff --git a/src/lsst/rsp/service.py b/src/lsst/rsp/service.py index 9e57e19..618dafd 100644 --- a/src/lsst/rsp/service.py +++ b/src/lsst/rsp/service.py @@ -1,26 +1,28 @@ import os -import pyvo from pyvo.dal import SIA2Service from pyvo.dal.adhoc import DatalinkResults +from pyvo.dal.sia2 import ObsCoreRecord -from utils import get_pyvo_auth, get_service_url +from .utils import get_pyvo_auth, get_service_url LSST_CLOUD = [ "https://data.lsst.cloud", - "https://data-int.lsst.cloud", - "https://data-dev.lsst.cloud" + "https://data-int.lsst.cloud", + "https://data-dev.lsst.cloud", ] USDF = [ "https://usdf-rsp.slac.stanford.edu", - "https://usdf-rsp-dev.slac.stanford.edu" + "https://usdf-rsp-dev.slac.stanford.edu", ] -def get_datalink_result(result) -> DatalinkResults: +def get_datalink_result(result: ObsCoreRecord) -> DatalinkResults: """Helper function to return the datalink part of the result.""" - return DatalinkResults.from_result_url(result.getdataurl(),session=get_pyvo_auth()) + return DatalinkResults.from_result_url( + result.getdataurl(), session=get_pyvo_auth() + ) def get_siav2_service(*args: str) -> SIA2Service: diff --git a/src/lsst/rsp/utils.py b/src/lsst/rsp/utils.py index 3cd29ed..83108ff 100644 --- a/src/lsst/rsp/utils.py +++ b/src/lsst/rsp/utils.py @@ -9,7 +9,6 @@ import pyvo.auth.authsession import requests - _NO_K8S = False try: @@ -56,7 +55,7 @@ def get_hostname() -> str: return os.environ.get("HOSTNAME") or "localhost" -def get_service_url(name: str, env_name=None) -> str: +def get_service_url(name: str, env_name: Optional[str] = None) -> str: if not env_name: env_name = name.upper() @@ -132,7 +131,7 @@ def jupyter_proxy_url(port: Optional[int] = None) -> str: # The type: ignore is needed because the alternate form of notebook_url # (https://docs.bokeh.org/en/latest/docs/reference/io.html#bokeh.io.show) # isn't in bokeh's type hints. - bokeh.io.show(obj=obj, notebook_url=jupyter_proxy_url) # type:ignore + bokeh.io.show(obj=obj, notebook_url=jupyter_proxy_url) def get_pod() -> Optional[client.V1Pod]: