-
-
Notifications
You must be signed in to change notification settings - Fork 141
ENH: Improve typing for Interval #391
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
Conversation
421bbc8
to
dbb1735
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good. Ping when green and those issues have been addressed.
ping when green and when issues have been addressed. |
@bashtage checking on status of this. It was in pretty good shape, just needs to go green and address a few issues. |
f730f5c
to
657c1d2
Compare
@Dr-Irv green ex nightly. |
Pretty sure these are gone. When I search for |
@Dr-Irv Should be all fixed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more things
def __eq__(self, other: IntervalT | IntervalIndex[IntervalT]) -> np_ndarray_bool: ... # type: ignore[misc] | ||
@overload | ||
def __eq__(self, other: pd.Series[IntervalT]) -> pd.Series[bool]: ... # type: ignore[misc] | ||
@overload | ||
def __eq__(self, other: object) -> Literal[False]: ... | ||
def __eq__(self, other: object) -> Never: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should remain Literal[False]
, because it is always valid code to do equality against another object.
npt.NDArray[np.float64], | ||
pd.Series[float], | ||
pd.Float64Index, | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the use of pd.Int64Index
and pd.Float64Index
here will cause issues with the nightly builds once #436 is merged in, so we'll have to figure out how to deal with that when in a Union
like this.
np.ndarray, | ||
np.bool_, | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to add tests that check that the typing is not too wide. Don't have to do it for this PR. E.g., interval_i >= pd.Timestamp("2017-01-01")
should be disallowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @bashtage
assert_type()
to assert the type of any return valuexref #383