Skip to content

Commit

Permalink
Hide deprecation warnings coming from inside removeDatasetType
Browse files Browse the repository at this point in the history
The caller is not querying anything so they won't understand
why they are getting a warning.
  • Loading branch information
timj committed Jun 21, 2023
1 parent c31cead commit f7977c1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion python/lsst/daf/butler/registries/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,13 @@ def removeDatasetType(self, name: str | tuple[str, ...]) -> None:
# Docstring inherited from lsst.daf.butler.registry.Registry

for datasetTypeExpression in ensure_iterable(name):
datasetTypes = list(self.queryDatasetTypes(datasetTypeExpression))
# Catch any warnings from the caller specifying a component
# dataset type. This will result in an error later but the
# warning could be confusing when the caller is not querying
# anything.
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=FutureWarning)
datasetTypes = list(self.queryDatasetTypes(datasetTypeExpression))
if not datasetTypes:
_LOG.info("Dataset type %r not defined", datasetTypeExpression)
else:
Expand Down

0 comments on commit f7977c1

Please sign in to comment.