Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@thomasjpfan
Copy link
Member

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.

@NicolasHug
Copy link
Member

I think this is missing

import sys
PY37 = sys.version_info >= (3, 7)
if not PY37:
    Pep562(__name__)


# because we don't import
# Do not check deprecated paths
if modname in DEPRECATED_MODULE_NAMES:
Copy link
Member

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?

Copy link
Member Author

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.

raise AssertionError("Docstring Error:\n" + msg)


DEPRECATED_MODULE_NAMES = set(
Copy link
Member

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?

mod = importlib.import_module(modname)

# unwrap to get module because Pep562 backport wraps the original
# module
Copy link
Member

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

?

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still worth a tag?

Copy link
Member

@rth rth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks @thomasjpfan !

@rth rth merged commit f447dbc into scikit-learn:master Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC] Feedback after scikit-learn module privatization

4 participants