Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Tim Jenness <tjenness@lsst.org>
  • Loading branch information
andy-slac and timj committed Feb 28, 2023
1 parent 8ddb5bd commit 738549a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions python/lsst/daf/butler/_quantum_backed.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def initialize(
location records. Default is a SQL-backed implementation.
search_paths : `list` of `str`, optional
Additional search paths for butler configuration.
dataset_types: `Mapping` [`str`, `DatasetType`]
dataset_types: `Mapping` [`str`, `DatasetType`], optional
Mapping of the dataset type name to its registry definition.
"""
predicted_inputs = [
Expand Down Expand Up @@ -272,7 +272,7 @@ def from_predicted(
location records. Default is a SQL-backed implementation.
search_paths : `list` of `str`, optional
Additional search paths for butler configuration.
dataset_types: `Mapping` [`str`, `DatasetType`]
dataset_types: `Mapping` [`str`, `DatasetType`], optional
Mapping of the dataset type name to its registry definition.
"""
return cls._initialize(
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/daf/butler/core/datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ def set_retrieve_dataset_type_method(self, method: Callable[[str], DatasetType |
Notes
-----
This method si only needed for a Datastore supporting a "trusted" mode
This method is only needed for a Datastore supporting a "trusted" mode
when it does not have an access to datastore records and needs to
guess dataset location based on its stored dataset type.
"""
Expand Down
10 changes: 5 additions & 5 deletions tests/test_datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,28 +452,28 @@ def testTrustGetRequest(self):
self.assertEqual(primaryURI2, primaryURI)
self.assertEqual(componentURIs2, componentURIs)

# Check for compatible storage class
# Check for compatible storage class.
if sc_name in ("StructuredDataNoComponents", "StructuredData"):
# need a special method to generate stored dataset type
# Need a special method to generate stored dataset type.
def _stored_dataset_type(name: str) -> DatasetType:
if name == ref.datasetType.name:
return ref.datasetType
raise ValueError(f"Unexpected dataset type name {ref.datasetType.name}")

datastore.set_retrieve_dataset_type_method(_stored_dataset_type)

# Storage class override with original dataset ref
# Storage class override with original dataset ref.
metrics_as_dict = datastore.get(ref, storageClass="StructuredDataDictJson")
self.assertIsInstance(metrics_as_dict, dict)

# Make new dataset ref with compatible storage class.
ref_comp = ref.overrideStorageClass("StructuredDataDictJson")

# get() should return a dict now
# get() should return a dict now.
metrics_as_dict = datastore.get(ref_comp)
self.assertIsInstance(metrics_as_dict, dict)

# exists() should work as well
# exists() should work as well.
self.assertTrue(datastore.exists(ref_comp))

datastore.set_retrieve_dataset_type_method(None)
Expand Down

0 comments on commit 738549a

Please sign in to comment.