pandas icon indicating copy to clipboard operation
pandas copied to clipboard

TYP: avoid inherit_names for DatetimeIndexOpsMixin

Open twoertwein opened this issue 2 years ago • 1 comments

Similar to #36742

xref #32100

twoertwein avatar Aug 09 '22 16:08 twoertwein

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)

twoertwein avatar Aug 09 '22 19:08 twoertwein

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.

jbrockmendel avatar Aug 10 '22 22:08 jbrockmendel

I think I addressed all comments but now we also have some small implementation changes. If you could please have another look @jbrockmendel @mroeschke

twoertwein avatar Sep 05 '22 13:09 twoertwein

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)

mroeschke avatar Sep 06 '22 17:09 mroeschke

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.

github-actions[bot] avatar Oct 09 '22 00:10 github-actions[bot]

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.

mroeschke avatar Nov 17 '22 01:11 mroeschke

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

twoertwein avatar Nov 21 '22 02:11 twoertwein