-
-
Notifications
You must be signed in to change notification settings - Fork 138
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
Simplify and fix overloads for methods with inplace
parameter
#1105
base: main
Are you sure you want to change the base?
Conversation
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.
Tests are failing. Please make sure to run the tests locally before resubmitting.
I understand what you are trying to do here, and it seems correct, but I also would like to know what prompted you to make these changes. Is there a test we can add that fails with the current stubs but passes with your changes?
level: Sequence[Level] = ..., | ||
*, | ||
drop: bool = ..., | ||
name: Level = ..., | ||
inplace: Literal[True], | ||
allow_duplicates: 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.
I don't think you can remove this overload.
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 seems safe to simplify. There are only 3 return possibilities:
Series or DataFrame or None
When drop is False (the default), a DataFrame is returned. The newly created columns will come first in the DataFrame, followed by the original Series values. When drop is True, a Series is returned. In either case, ifinplace=True
, no value is returned.
The return value can be fully determined by the value of drop
and inplace
, otherwise the signatures are identical.
Note, the previous 6 overloads with a split for level: Sequence[Level]
and level: Level | None
had the same other parameters and possible return values (DataFrame
, Series[S1]
, or None
).
I assumed this duplication was a result of some auto-generated code, but if there's something else I'm failing to understand, please let me know.
The return value of these methods varies on the `inplace` argument.
@Dr-Irv Thanks for the quick review and sorry for my delay in replying. I've just updated the PR and tests are now passing.
My initial reason for wanting this change was a mistake on my part (I thought that the overloads for There are probably a few minor improvements here as well (adding overloads or return type annotations to methods which lacked them before), but it seemed unnecessary to try and make separate PRs (one for new annotations, one for cleanup). |
We could probably add one for |
The return value of these methods varies on the
inplace
argument.