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-42928: Add methods to get and set nested dictionaries from TaskMetadata #403

Merged
merged 7 commits into from Feb 22, 2024

Conversation

TallJimbo
Copy link
Member

@TallJimbo TallJimbo commented Feb 20, 2024

The methods here are trivial, but the PropertyList implementation is not, and it's the consistency between all three types (TaskMetadata, PropertyList, and PropertySet) that's really the value added here.

See also lsst/daf_base#82

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

Copy link

codecov bot commented Feb 20, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (a71a70a) 82.48% compared to head (9959a86) 82.50%.

Files Patch % Lines
python/lsst/pipe/base/_task_metadata.py 85.71% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #403      +/-   ##
==========================================
+ Coverage   82.48%   82.50%   +0.01%     
==========================================
  Files          91       91              
  Lines       10467    10498      +31     
  Branches     1984     1987       +3     
==========================================
+ Hits         8634     8661      +27     
- Misses       1484     1485       +1     
- Partials      349      352       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TallJimbo TallJimbo force-pushed the tickets/DM-42928 branch 2 times, most recently from f77910f to a5a6846 Compare February 20, 2024 18:48
The methods here are trivial, but the PropertyList implementation is
not, and it's the consistency between all three types (TaskMetadata,
PropertyList, and PropertySet) that's really the value added here.
Copy link
Member

@timj timj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks okay to me.

dictionary into these objects that avoids their historical idiosyncrasies.

The form in which these entries appear in the object's native keys and
values is implementation-defined. *Empty nested dictionaries *may* be
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This nesting of markup doesn't work in sphinx.

@@ -56,6 +60,41 @@ def _isListLike(v: Any) -> bool:
return isinstance(v, Sequence) and not isinstance(v, str)


class SetDictMetadata(Protocol):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could there be a single DictMetadata protocol that has both in?

`float`, `str`, `bool`, or another `dict` with the same key and
value types.
"""
self[key] = TaskMetadata.from_dict(value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self[key] = value

should work fine. The TaskMetadata.from_dict will be called later on.

python/lsst/pipe/base/_task_metadata.py Show resolved Hide resolved
@TallJimbo TallJimbo merged commit 4b2da7a into main Feb 22, 2024
13 checks passed
@TallJimbo TallJimbo deleted the tickets/DM-42928 branch February 22, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants