-
Notifications
You must be signed in to change notification settings - Fork 12
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
Conversation
Codecov ReportAttention:
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. |
f77910f
to
a5a6846
Compare
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.
a5a6846
to
ecb25ba
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
This will be used shortly on DM-39842.
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
doc/changes