-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: remove util._decorators.make_signature and make related changes #26819
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
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,6 @@ | |
|
||
import pandas.compat as compat | ||
from pandas.compat import raise_with_traceback | ||
from pandas.util._decorators import deprecate_kwarg, make_signature | ||
from pandas.util._validators import validate_kwargs | ||
|
||
import pandas.util.testing as tm | ||
|
||
|
@@ -37,22 +35,6 @@ def test_numpy_err_state_is_default(): | |
assert np.geterr() == expected | ||
|
||
|
||
@pytest.mark.parametrize("func,expected", [ | ||
# Case where the func does not have default kwargs. | ||
(validate_kwargs, (["fname", "kwargs", "compat_args"], | ||
["fname", "kwargs", "compat_args"])), | ||
|
||
# Case where the func does have default kwargs. | ||
(deprecate_kwarg, (["old_arg_name", "new_arg_name", | ||
"mapping=None", "stacklevel=2"], | ||
["old_arg_name", "new_arg_name", | ||
"mapping", "stacklevel"])) | ||
]) | ||
def test_make_signature(func, expected): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It can be noted that |
||
# see gh-17608 | ||
assert make_signature(func) == expected | ||
|
||
|
||
def test_raise_with_traceback(): | ||
with pytest.raises(LookupError, match="error_text"): | ||
try: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@WillAyd we should put a line comment on when to use these / what these are if not completely obvious (and then maybe even so).
future PR of course
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.
Yea I'm going to take another look at this module soon to see if there's a better way of doing things. Also wondering if we should use
if TYPE_CHECKING
imports in that module instead of the ABCs. Will check it out and post separatelyThere 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.
-1 on using TYPE_CHECCKING. I think the way you have it setup is very nice actually, unless I am missing something big.
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.
My concern is that the ABC* classes aren't getting type checked correctly. Adding
reveal_type(klass)
to this PR where the TypeVar is used yields the following:That coupled with @topper-123 's comment around code completion makes me think the ABCs might all be
Type[Any]
since they are generated bycreate_pandas_abc_type
, a function without any annotations itself (so implicitlyType[Any]
)Going to investigate and open a separate issue accordingly
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.
ok fair. I just don't want to introduce overhead for contributors, which typing especially with 'non-standard' things (e.g.
cast
) can do; we really want to minimize what people have to do (nothwithstanding maybe we have magic that makes things easy).