Repository navigation
TYP: implement a MixinColumn typing.Protocol - #17189
neutrinoceros wants to merge 2 commits into
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
|
👋 Thank you for your draft pull request! Do you know that you can use |
MixinColumn typing.Protocol
| info: MixinInfo | ||
| shape: tuple[int, ...] | ||
|
|
||
| def __getitem__(self, key): ... |
There was a problem hiding this comment.
MixinColumn is clearly a generic type where the parameter must agree with the return type of __getitem__().
There was a problem hiding this comment.
makes sense, though I'm not sure how well this mixes with a Protocol, but let's give it a try !
There was a problem hiding this comment.
The return type of __getitem__ can be either MixinColumn or a scalar element of MixinColumn. I'm not sure how to capture that.
There was a problem hiding this comment.
I think this was addressed with TypeVar + Protocol[T] + @overloading. Good to go, @eerovaher ?
There was a problem hiding this comment.
Good enough for me, but its the sub-package maintainer that should do the final review.
4d3acb3 to
5a98de4
Compare
8073746 to
3ef5960
Compare
|
We're hours away from astropy 7.0's feature freeze and this shouldn't be blocking in any way, so I'll bump the milestone to clear the backlog. If this happened to be merged today anyway, please revert the milestone. |
ee5b486 to
db117f0
Compare
|
Taking this one to draft for now, as I committed a partial implementation of @nstarman's suggestion but I'm now uncertain that it is the right approach. Further discussion needed in #17189 (comment) |
|
Hi humans 👋 - this pull request hasn't had any new commits for approximately 4 months. I plan to close this in 30 days if the pull request doesn't have any new commits by then. In lieu of a stalled pull request, please consider closing this and open an issue instead if a reminder is needed to revisit in the future. Maintainers may also choose to add keep-open label to keep this PR open but it is discouraged unless absolutely necessary. If this PR still needs to be reviewed, as an author, you can rebase it to reset the clock. If you believe I commented on this pull request incorrectly, please report this here. |
|
Hi humans 👋 - this pull request hasn't had any new commits for approximately 1 year, 10 months. I plan to close this in a month if the pull request doesn't have any new commits by then. In lieu of a stalled pull request, please consider closing this and open an issue instead if a reminder is needed to revisit in the future. Maintainers may also choose to add keep-open label to keep this PR open but it is discouraged unless absolutely necessary. If this PR still needs to be reviewed, as an author, you can rebase it to reset the clock. If you believe I commented on this pull request incorrectly, please report this here. |
Co-authored-by: Nathaniel Starkman <[email protected]>
0e7ffb7 to
35c7b70
Compare
|
@neutrinoceros what's the latest on this? |
Description
Extracted from, and to be used in #17051, as suggested by @eerovaher
This formalizes an already documented protocol.