Skip to content

ENH: Improve typing for Timedelta #388

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 15 commits into from
Nov 4, 2022
Merged

Conversation

bashtage
Copy link
Contributor

  • Tests added: Please use assert_type() to assert the type of any return value

xref #383

@bashtage bashtage mentioned this pull request Oct 16, 2022
1 task
@bashtage bashtage requested a review from Dr-Irv October 19, 2022 13:24
Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

Picked up a number of issue. Let's get this one right, then will probably need to make similar changes for the Timestamp PR, so once this one is approved, then make similar changes there and I will then review.

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Oct 24, 2022

Once you have addressed my comments, and the new version of pyright is used that fixes those 2 issues (abs and NDArray typing), and you're all green, ping me and I'll review.

@bashtage
Copy link
Contributor Author

@Dr-Irv All green and all comments addressed.

@bashtage bashtage requested a review from Dr-Irv October 25, 2022 16:54
Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

Sorry for the delay in this review. Had some other projects at work come up.

There was one case where you resolved the conversation saying you made a change, but I didn't see it.

In addition, if you have a test like this:

check(assert_type(td % int_series, TimedeltaSeries), pd.Series)

can you change it to

check(assert_type(td % int_series, TimedeltaSeries), pd.Series, pd.Timestamp)

which will then check that the first element of the Series is a Timestamp. So anytime you are calling check() and you expect a Series, we can also check what we expect to be inside the Series (at least for the first element)

There's a number of tests like this, and I didn't mark any of them, so the above is just one example.

@bashtage
Copy link
Contributor Author

bashtage commented Nov 3, 2022

There's a number of tests like this, and I didn't mark any of them, so the above is just one example.

I got all of these.

@bashtage
Copy link
Contributor Author

bashtage commented Nov 3, 2022

I'm seeing that these have NOT been split.
Split now.

@bashtage bashtage requested a review from Dr-Irv November 4, 2022 07:58
Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

A few small things, then should be good to go

@bashtage bashtage requested a review from Dr-Irv November 4, 2022 18:55
Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

thanks @bashtage

@Dr-Irv Dr-Irv merged commit 5df1c51 into pandas-dev:main Nov 4, 2022
bashtage added a commit to bashtage/pandas-stubs that referenced this pull request Nov 6, 2022
* ENH: Improve typing for Timedelta

* ENH: Improve typing of timedelta

* ENH/TST: Improve Timedelta and its tests

* ENH: Final changes for timedelta

* ENH: Further improvements to timestamp

* ENH: Add more types

* Final changes to timedelta

* Final cleanup

* CLN: Final clean

* CLN: Final clean

Co-authored-by: Kevin Sheppard <[email protected]>
Dr-Irv pushed a commit that referenced this pull request Nov 8, 2022
* MAINT: Fix for future change

* ENH: Add pytest warns context manager manager

* Switch to pandas Version

* ENH: Improve typing for Timedelta (#388)

* ENH: Improve typing for Timedelta

* ENH: Improve typing of timedelta

* ENH/TST: Improve Timedelta and its tests

* ENH: Final changes for timedelta

* ENH: Further improvements to timestamp

* ENH: Add more types

* Final changes to timedelta

* Final cleanup

* CLN: Final clean

* CLN: Final clean

Co-authored-by: Kevin Sheppard <[email protected]>

* ENH: Add typing for Version

Co-authored-by: Kevin Sheppard <[email protected]>
@bashtage bashtage deleted the scalars-timedelta branch November 8, 2022 23:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants