Skip to content

Return calling class from Link constructor methods #512

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

Merged
merged 7 commits into from
Jul 7, 2021

Conversation

duckontheweb
Copy link
Contributor

@duckontheweb duckontheweb commented Jul 2, 2021

Related Issue(s):

Description:

Following in the footsteps of #451, this changes the Link constructor methods (Link.from_dict, etc.) to return the calling class instead of hard-coding the Link class as the return type. This allows downstream libraries and users to sub-class Link and still be able to use these constructors.

UPDATE: Also does the same for Asset constructors and for clone methods on Catalog, Collection, Item, Link, and Asset classes.

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-commenter commented Jul 2, 2021

Codecov Report

Merging #512 (44157ab) into main (a4fe4cd) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #512      +/-   ##
==========================================
+ Coverage   93.96%   93.97%   +0.01%     
==========================================
  Files          71       71              
  Lines        9991    10013      +22     
  Branches     1061     1061              
==========================================
+ Hits         9388     9410      +22     
  Misses        434      434              
  Partials      169      169              
Impacted Files Coverage Δ
pystac/link.py 92.18% <100.00%> (ø)
tests/test_link.py 100.00% <100.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 a4fe4cd...44157ab. Read the comment docs.

@duckontheweb duckontheweb merged commit 27d6132 into stac-utils:main Jul 7, 2021
@duckontheweb duckontheweb deleted the fix/link-inheritance branch July 7, 2021 20:14
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.

3 participants