From 1c58667908b864afe10b8d4239b1a0ee4240c849 Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Fri, 16 Aug 2024 12:45:49 -0700 Subject: [PATCH] Always include the collection docs in collections.get_info --- python/lsst/daf/butler/_butler_collections.py | 4 +--- .../daf/butler/direct_butler/_direct_butler_collections.py | 6 ++---- python/lsst/daf/butler/remote_butler/_remote_butler.py | 2 +- .../daf/butler/remote_butler/_remote_butler_collections.py | 6 ++---- python/lsst/daf/butler/tests/hybrid_butler_collections.py | 6 ++---- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/python/lsst/daf/butler/_butler_collections.py b/python/lsst/daf/butler/_butler_collections.py index 75de1d3b49..9e5a3c843c 100644 --- a/python/lsst/daf/butler/_butler_collections.py +++ b/python/lsst/daf/butler/_butler_collections.py @@ -308,15 +308,13 @@ def x_query_info( raise NotImplementedError() @abstractmethod - def get_info(self, name: str, include_doc: bool = False, include_parents: bool = False) -> CollectionInfo: + def get_info(self, name: str, include_parents: bool = False) -> CollectionInfo: """Obtain information for a specific collection. Parameters ---------- name : `str` The name of the collection of interest. - include_doc : `bool`, optional - If `True` any documentation about this collection will be included. include_parents : `bool`, optional If `True` any parents of this collection will be included. diff --git a/python/lsst/daf/butler/direct_butler/_direct_butler_collections.py b/python/lsst/daf/butler/direct_butler/_direct_butler_collections.py index 10b438c824..e047cdb6f7 100644 --- a/python/lsst/daf/butler/direct_butler/_direct_butler_collections.py +++ b/python/lsst/daf/butler/direct_butler/_direct_butler_collections.py @@ -118,11 +118,9 @@ def x_query_info( info.append(self.get_info(name, include_parents=include_parents)) return info - def get_info(self, name: str, include_doc: bool = False, include_parents: bool = False) -> CollectionInfo: + def get_info(self, name: str, include_parents: bool = False) -> CollectionInfo: record = self._registry.get_collection_record(name) - doc = "" - if include_doc: - doc = self._registry.getCollectionDocumentation(name) or "" + doc = self._registry.getCollectionDocumentation(name) or "" children: tuple[str, ...] = tuple() if record.type == CollectionType.CHAINED: assert isinstance(record, ChainedCollectionRecord) diff --git a/python/lsst/daf/butler/remote_butler/_remote_butler.py b/python/lsst/daf/butler/remote_butler/_remote_butler.py index bc9d78b8dc..f09a1a62bc 100644 --- a/python/lsst/daf/butler/remote_butler/_remote_butler.py +++ b/python/lsst/daf/butler/remote_butler/_remote_butler.py @@ -158,7 +158,7 @@ def collection_chains(self) -> ButlerCollections: @property def collections(self) -> ButlerCollections: - """Object with methods for modifying collection chains.""" + """Object with methods for modifying and querying collections.""" from ._registry import RemoteButlerRegistry return RemoteButlerCollections(cast(RemoteButlerRegistry, self._registry)) diff --git a/python/lsst/daf/butler/remote_butler/_remote_butler_collections.py b/python/lsst/daf/butler/remote_butler/_remote_butler_collections.py index 1e62d9c3e9..7e907a9235 100644 --- a/python/lsst/daf/butler/remote_butler/_remote_butler_collections.py +++ b/python/lsst/daf/butler/remote_butler/_remote_butler_collections.py @@ -93,10 +93,8 @@ def x_query_info( info.append(self.get_info(name, include_parents=include_parents)) return info - def get_info(self, name: str, include_doc: bool = False, include_parents: bool = False) -> CollectionInfo: - info = self._registry._get_collection_info( - name, include_doc=include_doc, include_parents=include_parents - ) + def get_info(self, name: str, include_parents: bool = False) -> CollectionInfo: + info = self._registry._get_collection_info(name, include_doc=True, include_parents=include_parents) doc = info.doc or "" children = info.children or () parents = info.parents or set() diff --git a/python/lsst/daf/butler/tests/hybrid_butler_collections.py b/python/lsst/daf/butler/tests/hybrid_butler_collections.py index 1a0875e1c8..4ac8688e6d 100644 --- a/python/lsst/daf/butler/tests/hybrid_butler_collections.py +++ b/python/lsst/daf/butler/tests/hybrid_butler_collections.py @@ -93,10 +93,8 @@ def x_query_info( include_parents=include_parents, ) - def get_info(self, name: str, include_doc: bool = False, include_parents: bool = False) -> CollectionInfo: - return self._hybrid._remote_butler.collections.get_info( - name, include_doc=include_doc, include_parents=include_parents - ) + def get_info(self, name: str, include_parents: bool = False) -> CollectionInfo: + return self._hybrid._remote_butler.collections.get_info(name, include_parents=include_parents) def register(self, name: str, type: CollectionType = CollectionType.RUN, doc: str | None = None) -> bool: return self._hybrid._direct_butler.collections.register(name, type=type, doc=doc)