-
-
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
Conversation
@@ -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): |
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.
def safe_import(mod_name: str, min_version: Optional[str] = None): | |
def safe_import(mod_name: str, min_version: Optional[str] = None) -> Union[types.ModuleType, bool]: |
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?
from types import ModuleType
or
import types
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.
pandas/util/_validators.py
Outdated
|
||
compat_args: OrderedDict | ||
A ordered dictionary of keys and their associated default values. | ||
compat_args : OrderedDict |
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.
Is this still an OrderedDict? IIRC we removed all occurrences of those from code base recently
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.
Remove it from the doc?
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.
Hmm was going to say just label as dict
but it looks like there is a detailed note about ordered requirements. Still should just be a dict but have to clean up the associated note; can do in a follow up if you'd like
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.
Looking at the detailed note, it's just to be compatible some buggy versions of numpy, and by looking at the git-blame of it, it way 4 years ago.
It's probably fixed by now, but I really cant know for sure, because there's no mention of a
specific/range of problematic numpy's versions.
Do you feel comfortable with removing the detailed note about the OrderedDict
?
592ed71
to
ef5b45d
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.
Minor comment otherwise @simonjayhawkins
ef5b45d
to
70b5af4
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.
lgtm
@@ -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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
but can address that later if so desired
thanks @MomIsBestFriend |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff