pandas
pandas copied to clipboard
TYP: avoid inherit_names for DatetimeIndexOpsMixin
Similar to #36742
xref #32100
Over multiple PRs, my goal is to remove inherit_names
to make static type checkers aware of those methods.
The alternative is to keep inherit_names
but add method_name: type_annotation
. Writing those annotations is tricky for properties.
Adding little helper methods as done in #36742 and here has the advantage that we can easily express the type of properties, it is more difficult for the implementation and the annotations to get out of sync, and it might also be more readable. Mypy doesn't seem to support properties with decorators but it seems that it just ignores them, which should be fine in most/all cases (@doc(...)
doesn't change the function signature)
Not a hill I plan to die on, but it isn't obvious to me that this is worthwhile. we implemented inherit_names in the first place for boilerplate-reduction, which is still a good goal.
I think I addressed all comments but now we also have some small implementation changes. If you could please have another look @jbrockmendel @mroeschke
Generally looks okay to me. I don't have a strong opinion in which direction inherit_names
should go (but generally I don't mind some boilerplating as it makes the code easier to grok IMO)
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this.
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.
Opened #49804