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

Use get_required to raise RequiredPropertyMissing when appropriate #561

Conversation

duckontheweb
Copy link
Contributor

@duckontheweb duckontheweb commented Jul 16, 2021

Related Issue(s):

Description:

Updates codebase to use utils.get_required instead of raising RequiredPropertyMissing directly. Also updates usages to always use .get(some_prop) instead of [some_prop] to ensure we get RequiredPropertyMissing instead of KeyError.

PR Checklist:

  • Code is formatted (run pre-commit run --all-files)
  • Tests pass (run scripts/test)
  • Documentation has been updated to reflect changes, if applicable
  • This PR maintains or improves overall codebase code coverage.
  • Changes are added to the CHANGELOG. See the docs for information about adding to the changelog.

@codecov-commenter
Copy link

Codecov Report

Merging #561 (170683f) into main (0ba1a1d) will increase coverage by 0.08%.
The diff coverage is 84.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #561      +/-   ##
==========================================
+ Coverage   94.46%   94.55%   +0.08%     
==========================================
  Files          71       71              
  Lines       10728    10703      -25     
  Branches     1075     1067       -8     
==========================================
- Hits        10134    10120      -14     
+ Misses        419      411       -8     
+ Partials      175      172       -3     
Impacted Files Coverage Δ
pystac/extensions/datacube.py 62.89% <20.00%> (+0.72%) ⬆️
pystac/extensions/eo.py 93.11% <100.00%> (ø)
pystac/extensions/file.py 92.06% <100.00%> (ø)
pystac/extensions/pointcloud.py 97.76% <100.00%> (+2.32%) ⬆️
pystac/extensions/raster.py 89.70% <100.00%> (ø)
pystac/extensions/sar.py 98.56% <100.00%> (-0.02%) ⬇️
tests/extensions/test_pointcloud.py 100.00% <100.00%> (ø)
pystac/errors.py 100.00% <0.00%> (+5.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0ba1a1d...170683f. Read the comment docs.

Copy link
Member

@lossyrob lossyrob left a comment

Choose a reason for hiding this comment

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

Reviewed the extensions, looks like all non-optional getter properties are now using get_required 👍

@duckontheweb duckontheweb merged commit ac7b1d6 into stac-utils:main Jul 17, 2021
@duckontheweb duckontheweb deleted the change/gh-315-required-property-exception branch July 17, 2021 15: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.

Implement RequiredPropertyMissing exception where appropriate
3 participants