Fix KeyError in The_national_map_USGS.prodFormats - #1353
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe PR updates USGS property annotations to return sets, prevents ChangesUSGS API and documentation
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Tick the box to add this pull request to the merge queue (same as
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a KeyError in The_national_map_USGS.prodFormats when The National Map API returns dataset entries that omit the "formats" key, and aligns the Python type hints/docstrings with the properties’ actual return types.
Changes:
- Guarded
prodFormatsagainst missing"formats"keys in dataset entries. - Updated return type annotations for
prodFormatsanddatasetsfromlisttoset(and adjusted thedatasetsdocstring accordingly). - Corrected a docstring typo in
Map.remove.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| leafmap/leafmap.py | Docstring correction for Map.remove. |
| leafmap/common.py | Fixes prodFormats KeyError on missing "formats"; updates type hints/docstrings to match set return types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Fixes #1352
The Request response object of the dataset Imagery - NAIP (1 meter to .5 foot) does not include a "formats" key, causing a KeyError when the set comprehension assumed it always existed.
prodFormatsnow checks if a "formats" key exists before accessing it.prodFormatsanddatasetsproperties from list to set to match their actual (unchanged) runtime return typedatasetsproperty to match the actual return typeMap.removemethodSummary by CodeRabbit
Bug Fixes
Documentation