Skip to content

Commit

Permalink
Always include the collection docs in collections.get_info
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Aug 16, 2024
1 parent 250c5dc commit 1c58667
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 16 deletions.
4 changes: 1 addition & 3 deletions python/lsst/daf/butler/_butler_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/daf/butler/remote_butler/_remote_butler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 2 additions & 4 deletions python/lsst/daf/butler/tests/hybrid_butler_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1c58667

Please sign in to comment.