-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: Typing annotations pandas/util/ #30411
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
2 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
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 |
---|---|---|
|
@@ -37,7 +37,7 @@ def test_foo(): | |
from pandas.core.computation.expressions import _NUMEXPR_INSTALLED, _USE_NUMEXPR | ||
|
||
|
||
def safe_import(mod_name, min_version=None): | ||
def safe_import(mod_name: str, min_version: Optional[str] = None): | ||
""" | ||
Parameters: | ||
----------- | ||
|
@@ -110,7 +110,7 @@ def _skip_if_not_us_locale(): | |
return True | ||
|
||
|
||
def _skip_if_no_scipy(): | ||
def _skip_if_no_scipy() -> bool: | ||
return not ( | ||
safe_import("scipy.stats") | ||
and safe_import("scipy.sparse") | ||
|
@@ -195,7 +195,9 @@ def skip_if_no(package: str, min_version: Optional[str] = None) -> Callable: | |
) | ||
|
||
|
||
def skip_if_np_lt(ver_str, reason=None, *args, **kwds): | ||
def skip_if_np_lt( | ||
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. these could actually be a pytest.mark.skipif type (not sure what that actually is though) 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. but can address that later if so desired |
||
ver_str: str, reason: Optional[str] = None, *args, **kwds | ||
) -> Callable: | ||
if reason is None: | ||
reason = f"NumPy {ver_str} or greater required" | ||
return pytest.mark.skipif( | ||
|
@@ -211,14 +213,14 @@ def parametrize_fixture_doc(*args): | |
initial fixture docstring by replacing placeholders {0}, {1} etc | ||
with parameters passed as arguments. | ||
|
||
Parameters: | ||
Parameters | ||
---------- | ||
args: iterable | ||
Positional arguments for docstring. | ||
args: iterable | ||
Positional arguments for docstring. | ||
|
||
Returns: | ||
Returns | ||
------- | ||
documented_fixture: function | ||
function | ||
The decorated function wrapped within a pytest | ||
``parametrize_fixture_doc`` mark | ||
""" | ||
|
@@ -230,7 +232,7 @@ def documented_fixture(fixture): | |
return documented_fixture | ||
|
||
|
||
def check_file_leaks(func): | ||
def check_file_leaks(func) -> Callable: | ||
""" | ||
Decorate a test function tot check that we are not leaking file descriptors. | ||
""" | ||
|
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
Oops, something went wrong.
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.
Actually not 100% sure on this one but would be nice if return type could be annotated as well
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.
Code style question, what is preferred here?
or
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.
NVM, mypy complains about it anyway.