Skip to content

Commit

Permalink
Allow None in butler put arguments
Browse files Browse the repository at this point in the history
This allows "optional" outputs in failure states.
  • Loading branch information
parejkoj committed Mar 19, 2024
1 parent f121fb5 commit 42a0300
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions python/lsst/pipe/base/_quantumContext.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ def put(
``[calexp1, calexp2]``. Like wise if there is a single ref, then
only a single object need be passed. The same restriction applies
if dataset is directly a `list` of `~lsst.daf.butler.DatasetRef`
or a single `~lsst.daf.butler.DatasetRef`.
or a single `~lsst.daf.butler.DatasetRef`. If ``values.NAME`` is
None, no output is written.
dataset : `OutputQuantizedConnection` or `list`[`DatasetRef`] \
or `DatasetRef`
This argument may either be an `InputQuantizedConnection` which
Expand All @@ -371,7 +372,9 @@ def put(
" attributes must be passed as the values to put"
)
for name, refs in dataset:
valuesAttribute = getattr(values, name)
valuesAttribute = getattr(values, name, None)
if valuesAttribute is None:
continue
if isinstance(refs, list | tuple):
if len(refs) != len(valuesAttribute):
raise ValueError(f"There must be a object to put for every Dataset ref in {name}")
Expand Down

0 comments on commit 42a0300

Please sign in to comment.