-
Notifications
You must be signed in to change notification settings - Fork 122
Normalize hrefs while skipping unresolved links #900
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
Conversation
f5a41bc
to
f55e8b0
Compare
Codecov ReportBase: 90.09% // Head: 90.12% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #900 +/- ##
==========================================
+ Coverage 90.09% 90.12% +0.02%
==========================================
Files 47 47
Lines 6057 6064 +7
Branches 905 909 +4
==========================================
+ Hits 5457 5465 +8
Misses 420 420
+ Partials 180 179 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
This looks fine to me, I think it's a good change - in most cases of adding new items to a catalog you shouldn't need to resolve anything that isn't newly added (i.e., resolved). But I'm not sure I follow this:
What do you mean by newly-added entities aren't normalized? |
If I understood #284 correctly, you were proposing a change where collection.add_item(item) would auto-magically normalize the item href (without having to call |
f55e8b0
to
c7229bf
Compare
d313e30
to
db41b8f
Compare
560245a
to
3e55bdb
Compare
Adds a `skip_unresolved` argument to `normalize_hrefs` and `normalize_and_save`. Instead of using `get_items` and `get_children` (which resolve their links), we re-implement with additional logic to conditionally skip unresolved links. We considered pushing `skip_unresolved` all the way down into `get_stac_object`, but this seemed like overkill, since the motivating use-case for `skip_unresolved` is to avoid walking the whole tree when normalizing (#284). Because `save` already skips unresolved links, this enables `normalize_and_save` to only touch objects that have been added to the tree or modified (and therefore resolved).
Co-authored-by: Preston Hartzell <preston.hartzell@gmail.com>
3e55bdb
to
4c149a8
Compare
Related Issue(s):
Description:
Adds a
skip_unresolved
argument toCatalog.normalize_hrefs
andCatalog.normalize_and_save
. Instead of usingCatalog.get_items
andCatalog.get_children
(which resolve their links), we re-implement with additional logic to conditionally skip unresolved links. We considered pushingskip_unresolved
all the way down intoLink.get_stac_object
, but this seemed like overkill, since the motivating use-case forskip_unresolved
is to avoid walking the whole tree when normalizing (#284).Because
save
already skips unresolved links, this enablesnormalize_and_save
to only touch objects that have been added to the tree or modified (and therefore resolved).Note this isn't exactly the solution proposed by @matthewhanson in #284, since the hrefs newly-added entities aren't normalized. These changes are only confined to
normalize
.This is a feature-adding, backwards compatible change that could be incorporated in a MINOR release.
cc @l0b0
PR Checklist:
pre-commit run --all-files
)scripts/test
)