-
Notifications
You must be signed in to change notification settings - Fork 122
Make ExtensionManagementMixin.add_to idempotent #419
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
Make ExtensionManagementMixin.add_to idempotent #419
Conversation
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.
👍🏽 to keepin' it simple for now, and if we identify this as a performance bottleneck later we know how to proceed (seems unlikely).
We also talked about checking that the object to see if it has the extension on |
I started to tackle that as part of this PR, but there's a wrinkle with how to handle that when extending an Asset with no owner, since it won't have any extension info associated with it. I figured I would work through that in comments on #370 and merge this in the meantime, but I'm also fine with keeping this open until that's resolved. |
I will actually just implement that as part of this PR and we can get feedback on the approach that way. Probably easier than trying to discuss it in an issue. |
@lossyrob Sorry to keep waffling on this, but I think it would be best to merge this and tackle #370 in a separate PR. There are some challenges around how and where to implement that exception and how to handle |
9a9f6f1
to
77b5d97
Compare
Codecov Report
@@ Coverage Diff @@
## main #419 +/- ##
=======================================
Coverage 90.67% 90.67%
=======================================
Files 40 40
Lines 5105 5106 +1
=======================================
+ Hits 4629 4630 +1
Misses 476 476
Continue to review full report at Codecov.
|
Related Issue(s): #
Description:
pystac.extensions.base.ExtensionManagementMixin.add_to
will only add the schema URI for the inheriting extension class if it is not already in the object'sstac_extensions
list.I looked into making
stac_extensions
aset
instead of alist
, but the extra complexity to ensure that the set was properly serialized and deserialized did not seem worth the effort. If that seems like the better approach, I can explore it in more depth, though.PR Checklist:
scripts/format
)scripts/test
)