-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[MRG] MNT Uses pep562 to import private methods #15431
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
[MRG] MNT Uses pep562 to import private methods #15431
Conversation
I think this is missing import sys
PY37 = sys.version_info >= (3, 7)
if not PY37:
Pep562(__name__) |
@@ -143,7 +148,9 @@ def test_tabs(): | |||
'feature_extraction._hashing_fast' in modname): | |||
continue | |||
|
|||
# because we don't import | |||
# Do not check deprecated paths | |||
if modname in DEPRECATED_MODULE_NAMES: |
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.
why do we need this? There shouldn't be any tab anyway?
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.
The Pep562
wraps the original module and is an instance, which means getsource
will fail in this case.
I updated this PR by unwrapping the instance and grab the underlying _module
.
@@ -133,6 +134,10 @@ def test_docstring_parameters(): | |||
raise AssertionError("Docstring Error:\n" + msg) | |||
|
|||
|
|||
DEPRECATED_MODULE_NAMES = set( |
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.
declare in the function where it's used?
@@ -145,6 +146,12 @@ def test_tabs(): | |||
|
|||
# because we don't import | |||
mod = importlib.import_module(modname) | |||
|
|||
# unwrap to get module because Pep562 backport wraps the original | |||
# module |
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.
Mark as to be removed in 0.24 or when Pep562 isn't used anymore
?
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.
We can also used this for experimental features for a better error message?
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.
still worth a tag?
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.
Nice! Thanks @thomasjpfan !
Reference Issues/PRs
Resolves #15415
Alternative to #15419
What does this implement/fix? Explain your changes.
Lets backport pep562, since we may be using it for
enable_experimental_*
as well.