Skip to content

Generalize return types from classmethods#983

Merged
gadomski merged 3 commits into
mainfrom
issues/862-return-types
Feb 14, 2023
Merged

Generalize return types from classmethods#983
gadomski merged 3 commits into
mainfrom
issues/862-return-types

Conversation

@gadomski
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread pystac/collection.py
Comment thread pystac/validation/__init__.py
Comment thread pystac/common_metadata.py
@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