Skip to content

Commit

Permalink
Force collections to a list to ensure compatibility
Browse files Browse the repository at this point in the history
In old butler it's only a Sequence but in new butler it's
a ButlerCollection which has no __eq__ implementation. List
works for both.
  • Loading branch information
timj committed Aug 16, 2024
1 parent d68a17e commit d2a9315
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion python/lsst/obs/base/_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ def loadCamera(butler: Butler, dataId: DataId, *, collections: Any = None) -> tu
Raised when ``dataId`` does not specify a valid data ID.
"""
if collections is None:
collections = butler.collections
collections = list(butler.collections)
# Registry would do data ID expansion internally if we didn't do it first,
# but we might want an expanded data ID ourselves later, so we do it here
# to ensure it only happens once.
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/obs/base/defineVisits.py
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,7 @@ def computeExposureBounds(
sphere representing that detector's corners projected onto the sky.
"""
if collections is None:
collections = self.butler.collections
collections = list(self.butler.collections)
camera, versioned = loadCamera(self.butler, exposure.dataId, collections=collections)
if not versioned and self.config.requireVersionedCamera:
raise LookupError(f"No versioned camera found for exposure {exposure.dataId}.")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_defineVisits.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def testPickleTask(self):
self.assertEqual(self.task.log.name, copy.log.name)
self.assertEqual(self.task.config, copy.config)
self.assertEqual(self.task.butler._config, copy.butler._config)
self.assertEqual(self.task.butler.collections, copy.butler.collections)
self.assertEqual(list(self.task.butler.collections), list(copy.butler.collections))
self.assertEqual(self.task.butler.run, copy.butler.run)
self.assertEqual(self.task.universe, copy.universe)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ def testPickleTask(self):
self.assertEqual(self.task.log.name, copy.log.name)
self.assertEqual(self.task.config, copy.config)
self.assertEqual(self.task.butler._config, copy.butler._config)
self.assertEqual(self.task.butler.collections, copy.butler.collections)
self.assertEqual(list(self.task.butler.collections), list(copy.butler.collections))
self.assertEqual(self.task.butler.run, copy.butler.run)
self.assertEqual(self.task.universe, copy.universe)
self.assertEqual(self.task.datasetType, copy.datasetType)
Expand Down

0 comments on commit d2a9315

Please sign in to comment.