Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-37873: Fix code to remove obscore manager in makeRepo #779

Merged
merged 2 commits into from
Feb 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions python/lsst/daf/butler/_butler.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,9 @@ def makeRepo(
# Strip obscore configuration, if it is present, before writing config
# to a file, obscore config will be stored in registry.
config_to_write = config
if ("registry", "managers", "obscore") in config:
if (obscore_config_key := ("registry", "managers", "obscore", "config")) in config:
config_to_write = config.copy()
del config_to_write["registry", "managers", "obscore", "config"]
del config_to_write[obscore_config_key]
config_to_write.dumpToUri(configURI, overwrite=overwrite)

# Create Registry and populate tables
Expand Down Expand Up @@ -961,8 +961,7 @@ def _rewrite_data_id(
if (
dimensionName == "visit"
and "visit_system_membership" in self.registry.dimensions
and "visit_system"
in self.registry.dimensions["instrument"].metadata # type: ignore
and "visit_system" in self.registry.dimensions["instrument"].metadata
):
instrument_records = list(
self.registry.queryDimensionRecords(
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/daf/butler/core/datasets/ref.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ def _lookupNames(self) -> Tuple[LookupKey, ...]:
# __contains__ can take an object of any type, it seems hard-coded to
# assume it will return False if the type doesn't match the key type
# of the Mapping.
if "instrument" in self.dataId: # type: ignore
if "instrument" in self.dataId:
names = tuple(n.clone(dataId={"instrument": self.dataId["instrument"]}) for n in names) + names

return names
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/daf/butler/tests/_datasetsHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def _fromBytes(self, serializedDataset: bytes, pytype: type[Any] | None = None)
data = super()._fromBytes(serializedDataset)
if self.dataId is None:
raise RuntimeError("This formatter requires a dataId")
if "detector" not in self.dataId: # type: ignore[comparison-overlap]
if "detector" not in self.dataId:
raise RuntimeError("This formatter requires detector to be present in dataId")
key = f"detector{self.dataId['detector']}"
assert pytype is not None
Expand Down