Coverage for python / lsst / daf / butler / tests / hybrid_butler_collections.py: 0%
28 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-05-01 08:17 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-05-01 08:17 +0000
1# This file is part of daf_butler.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (http://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This software is dual licensed under the GNU General Public License and also
10# under a 3-clause BSD license. Recipients may choose which of these licenses
11# to use; please see the files gpl-3.0.txt and/or bsd_license.txt,
12# respectively. If you choose the GPL option then the following text applies
13# (but note that there is still no warranty even if you opt for BSD instead):
14#
15# This program is free software: you can redistribute it and/or modify
16# it under the terms of the GNU General Public License as published by
17# the Free Software Foundation, either version 3 of the License, or
18# (at your option) any later version.
19#
20# This program is distributed in the hope that it will be useful,
21# but WITHOUT ANY WARRANTY; without even the implied warranty of
22# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23# GNU General Public License for more details.
24#
25# You should have received a copy of the GNU General Public License
26# along with this program. If not, see <http://www.gnu.org/licenses/>.
28from __future__ import annotations
30__all__ = ("HybridButlerCollections",)
32from collections.abc import Iterable, Sequence, Set
33from typing import TYPE_CHECKING
35from .._butler_collections import ButlerCollections, CollectionInfo
36from .._collection_type import CollectionType
38if TYPE_CHECKING:
39 from .._dataset_type import DatasetType
40 from .hybrid_butler import HybridButler
43class HybridButlerCollections(ButlerCollections):
44 """Implementation of ButlerCollections for HybridButler.
46 Parameters
47 ----------
48 butler : `~lsst.daf.butler.tests.hybrid_butler.HybridButler`
49 Hybrid butler to use.
50 """
52 def __init__(self, butler: HybridButler):
53 self._hybrid = butler
55 @property
56 def defaults(self) -> Sequence[str]:
57 return self._hybrid._remote_butler.collections.defaults
59 def extend_chain(self, parent_collection_name: str, child_collection_names: str | Iterable[str]) -> None:
60 return self._hybrid._direct_butler.collections.extend_chain(
61 parent_collection_name, child_collection_names
62 )
64 def prepend_chain(self, parent_collection_name: str, child_collection_names: str | Iterable[str]) -> None:
65 return self._hybrid._direct_butler.collections.prepend_chain(
66 parent_collection_name, child_collection_names
67 )
69 def redefine_chain(
70 self, parent_collection_name: str, child_collection_names: str | Iterable[str]
71 ) -> None:
72 self._hybrid._direct_butler.collections.redefine_chain(parent_collection_name, child_collection_names)
74 def remove_from_chain(
75 self, parent_collection_name: str, child_collection_names: str | Iterable[str]
76 ) -> None:
77 return self._hybrid._direct_butler.collections.remove_from_chain(
78 parent_collection_name, child_collection_names
79 )
81 def query_info(
82 self,
83 expression: str | Iterable[str],
84 collection_types: Set[CollectionType] | CollectionType | None = None,
85 flatten_chains: bool = False,
86 include_chains: bool | None = None,
87 include_parents: bool = False,
88 include_summary: bool = False,
89 include_doc: bool = False,
90 summary_datasets: Iterable[DatasetType] | Iterable[str] | None = None,
91 ) -> Sequence[CollectionInfo]:
92 return self._hybrid._remote_butler.collections.query_info(
93 expression,
94 collection_types=collection_types,
95 flatten_chains=flatten_chains,
96 include_chains=include_chains,
97 include_parents=include_parents,
98 include_summary=include_summary,
99 include_doc=include_doc,
100 summary_datasets=summary_datasets,
101 )
103 def get_info(
104 self, name: str, include_parents: bool = False, include_summary: bool = False
105 ) -> CollectionInfo:
106 return self._hybrid._remote_butler.collections.get_info(
107 name, include_parents=include_parents, include_summary=include_summary
108 )
110 def register(self, name: str, type: CollectionType = CollectionType.RUN, doc: str | None = None) -> bool:
111 return self._hybrid._direct_butler.collections.register(name, type=type, doc=doc)
113 def x_remove(self, name: str) -> None:
114 self._hybrid._direct_butler.collections.x_remove(name)