Skip to content

Generalize return types from classmethods #983

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 3 commits into from
Feb 14, 2023
Merged

Conversation

gadomski
Copy link
Member

@gadomski gadomski commented Feb 10, 2023

Related Issue(s):

Description:

Use TypeVar for alternate constructors, e.g. from_dict and from_file. The key cast that enables the whole inheritance tree to work is https://github.com/stac-utils/pystac/compare/issues/862-return-types?expand=1#diff-3f0f0b208e42045d63bb010a3b963e4178a8cf882f75f73d8392828b2190eafcR525.

Includes some sidecar fixes:

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.

@gadomski gadomski self-assigned this Feb 10, 2023
@gadomski gadomski added this to the 1.7 milestone Feb 10, 2023
@gadomski gadomski added the typing Issues or pull requests that relate to Python type checking label Feb 10, 2023
@gadomski gadomski force-pushed the issues/862-return-types branch from 8f323d7 to da6f665 Compare February 13, 2023 16:54
Copy link
Collaborator

@pjhartzell pjhartzell left a comment

Choose a reason for hiding this comment

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

Looks good. Just a few questions.

@gadomski gadomski requested a review from pjhartzell February 14, 2023 14:36
@gadomski gadomski added this pull request to the merge queue Feb 14, 2023
Merged via the queue into main with commit de52adb Feb 14, 2023
@gadomski gadomski deleted the issues/862-return-types branch February 14, 2023 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typing Issues or pull requests that relate to Python type checking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

clone shouldn't hard-code return type alternative constructors shouldn't hardcode their return types
2 participants