-
-
Notifications
You must be signed in to change notification settings - Fork 145
Improvements to arguments, types with stubtest #1294
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
@@ -53,7 +52,6 @@ class PeriodIndex(DatetimeIndexOpsMixin[pd.Period], PeriodIndexFieldOps): | |||
def __rsub__( # pyright: ignore[reportIncompatibleMethodOverride] | |||
self, other: NaTType | |||
) -> NaTType: ... | |||
def __array__(self, dtype=...) -> np.ndarray: ... |
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.
Using parent definition.
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. a number of things that stubgen picks up we still need to follow the docs on
pandas-stubs/core/frame.pyi
Outdated
self, | ||
func: AggFuncTypeBase | AggFuncTypeDictSeries, | ||
func: AggFuncTypeBase | AggFuncTypeDictSeries = ..., |
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 is not valid. If you don't specify the value of func
, an exception will be raised. Please revert.
Co-authored-by: Irv Lustig <[email protected]>
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 @loicdiridollou
More improvements with the stubtest flagging some drift with pandas.
One point that was raised is the handling of deprecated items, maybe the other possibility than purely removing it from the stubs is to force the stubs to adopt the default value so that whatever the user is doing it won't allow any other behavior.
We need to see how much we can use stubtest, I don't see it being used in CI at the moment or anytime soon considering the mountain of work that it raises (mostly correctly but I have seen a few places where it is flagging things that are fine), there is also the problem of the
no_default
that pandas uses abundantly and which is hard to replicate in the stubs.assert_type()
to assert the type of any return value