Skip to content

Commit

Permalink
Merge pull request #884 from lsst/tickets/DM-40450
Browse files Browse the repository at this point in the history
DM-40450: Change default value for components to False
  • Loading branch information
timj committed Aug 21, 2023
2 parents c732061 + a9cd4db commit 6b871c2
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 25 deletions.
12 changes: 5 additions & 7 deletions python/lsst/daf/butler/cli/opt/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,13 @@ def makeCollectionTypes(

components_option = MWOptionDecorator(
"--components/--no-components",
default=None,
default=False,
help=unwrap(
"""For --components, apply all expression patterns to
component dataset type names as well. For --no-components,
never apply patterns to components. Default (where neither
is specified) is to apply patterns to components only if
their parent datasets were not matched by the expression.
Fully-specified component datasets (`str` or `DatasetType`
instances) are always included."""
component dataset type names as well. For --no-components,
never apply patterns to components. Default is False.
Fully-specified component datasets (`str` or `DatasetType`
instances) are always included."""
),
)

Expand Down
8 changes: 4 additions & 4 deletions python/lsst/daf/butler/registries/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def queryDatasetTypes(
self,
expression: Any = ...,
*,
components: bool | None = None,
components: bool | None = False,
missing: list[str] | None = None,
) -> Iterable[DatasetType]:
# Docstring inherited from lsst.daf.butler.registry.Registry
Expand Down Expand Up @@ -522,7 +522,7 @@ def queryDatasets( # type: ignore
dataId: DataId | None = None,
where: str = "",
findFirst: bool = False,
components: bool | None = None,
components: bool | None = False,
bind: Mapping[str, Any] | None = None,
check: bool = True,
**kwargs: Any,
Expand Down Expand Up @@ -568,7 +568,7 @@ def queryDataIds( # type: ignore
datasets: Any = None,
collections: CollectionArgType | None = None,
where: str = "",
components: bool | None = None,
components: bool | None = False,
bind: Mapping[str, Any] | None = None,
check: bool = True,
**kwargs: Any,
Expand Down Expand Up @@ -618,7 +618,7 @@ def queryDimensionRecords( # type: ignore
datasets: Any = None,
collections: CollectionArgType | None = None,
where: str = "",
components: bool | None = None,
components: bool | None = False,
bind: Mapping[str, Any] | None = None,
check: bool = True,
**kwargs: Any,
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/daf/butler/registries/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ def queryDatasetTypes(
self,
expression: Any = ...,
*,
components: bool | None = None,
components: bool | None = False,
missing: list[str] | None = None,
) -> Iterable[DatasetType]:
# Docstring inherited from lsst.daf.butler.registry.Registry
Expand Down Expand Up @@ -1124,7 +1124,7 @@ def queryDatasets(
dataId: DataId | None = None,
where: str = "",
findFirst: bool = False,
components: bool | None = None,
components: bool | None = False,
bind: Mapping[str, Any] | None = None,
check: bool = True,
**kwargs: Any,
Expand Down
14 changes: 7 additions & 7 deletions python/lsst/daf/butler/registry/_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ def queryDatasetTypes(
self,
expression: Any = ...,
*,
components: bool | None = None,
components: bool | None = False,
missing: list[str] | None = None,
) -> Iterable[DatasetType]:
"""Iterate over the dataset types whose names match an expression.
Expand All @@ -1045,7 +1045,7 @@ def queryDatasetTypes(
components : `bool`, optional
If `True`, apply all expression patterns to component dataset type
names as well. If `False`, never apply patterns to components.
If `None` (default), apply patterns to components only if their
If `None`, apply patterns to components only if their
parent datasets were not matched by the expression.
Fully-specified component datasets (`str` or `DatasetType`
instances) are always included.
Expand Down Expand Up @@ -1136,7 +1136,7 @@ def queryDatasets(
dataId: DataId | None = None,
where: str = "",
findFirst: bool = False,
components: bool | None = None,
components: bool | None = False,
bind: Mapping[str, Any] | None = None,
check: bool = True,
**kwargs: Any,
Expand Down Expand Up @@ -1184,7 +1184,7 @@ def queryDatasets(
components : `bool`, optional
If `True`, apply all dataset expression patterns to component
dataset type names as well. If `False`, never apply patterns to
components. If `None` (default), apply patterns to components only
components. If `None`, apply patterns to components only
if their parent datasets were not matched by the expression.
Fully-specified component datasets (`str` or `DatasetType`
instances) are always included.
Expand Down Expand Up @@ -1257,7 +1257,7 @@ def queryDataIds(
datasets: Any = None,
collections: CollectionArgType | None = None,
where: str = "",
components: bool | None = None,
components: bool | None = False,
bind: Mapping[str, Any] | None = None,
check: bool = True,
**kwargs: Any,
Expand Down Expand Up @@ -1302,7 +1302,7 @@ def queryDataIds(
components : `bool`, optional
If `True`, apply all dataset expression patterns to component
dataset type names as well. If `False`, never apply patterns to
components. If `None` (default), apply patterns to components only
components. If `None`, apply patterns to components only
if their parent datasets were not matched by the expression.
Fully-specified component datasets (`str` or `DatasetType`
instances) are always included.
Expand Down Expand Up @@ -1367,7 +1367,7 @@ def queryDimensionRecords(
datasets: Any = None,
collections: CollectionArgType | None = None,
where: str = "",
components: bool | None = None,
components: bool | None = False,
bind: Mapping[str, Any] | None = None,
check: bool = True,
**kwargs: Any,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def register(self, datasetType: DatasetType) -> tuple[DatasetRecordStorage, bool
def resolve_wildcard(
self,
expression: Any,
components: bool | None = None,
components: bool | None = False,
missing: list[str] | None = None,
explicit_only: bool = False,
components_deprecated: bool = True,
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/daf/butler/registry/interfaces/_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ def remove(self, name: str) -> None:
def resolve_wildcard(
self,
expression: Any,
components: bool | None = None,
components: bool | None = False,
missing: list[str] | None = None,
explicit_only: bool = False,
components_deprecated: bool = True,
Expand All @@ -530,7 +530,7 @@ def resolve_wildcard(
components : `bool`, optional
If `True`, apply all expression patterns to component dataset type
names as well. If `False`, never apply patterns to components. If
`None` (default), apply patterns to components only if their parent
`None`, apply patterns to components only if their parent
datasets were not matched by the expression. Fully-specified
component datasets (`str` or `DatasetType` instances) are always
included.
Expand Down
3 changes: 2 additions & 1 deletion python/lsst/daf/butler/registry/tests/_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,8 @@ def testDatasetTypeComponentQueries(self):
# that component dataset type if components=None.
with self.assertWarns(FutureWarning):
self.assertEqual(
{"bias.wcs"}, NamedValueSet(registry.queryDatasetTypes(re.compile(r"^bias\.wcs"))).names
{"bias.wcs"},
NamedValueSet(registry.queryDatasetTypes(re.compile(r"^bias\.wcs"), components=None)).names,
)
self.assertEqual(
set(),
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cliCmdQueryDatasetTypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class QueryDatasetTypesCmdTest(CliCmdTestBase, unittest.TestCase):

@staticmethod
def defaultExpected():
return dict(repo=None, verbose=False, glob=(), components=None)
return dict(repo=None, verbose=False, glob=(), components=False)

@staticmethod
def command():
Expand Down

0 comments on commit 6b871c2

Please sign in to comment.