-
-
Notifications
You must be signed in to change notification settings - Fork 25k
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
MNT Fix incorrect source code link for wrapped objects #17247
MNT Fix incorrect source code link for wrapped objects #17247
Conversation
@@ -40,12 +40,13 @@ def _linkcode_resolve(domain, info, package, url_fmt, revision): | |||
return | |||
|
|||
class_name = info['fullname'].split('.')[0] | |||
if type(class_name) != str: |
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.
I have removed these lines because they were intended only for Python 2, and, as far as I am concerned, scikit-learn does not support Python 2 anymore.
@thomasjpfan Note that the source code link points to the decorator, instead of the function name. That's because |
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, it seems to work (see f1_score in the build)!
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
We can do slightly more fancy things to get the lineno to match up, but I think this PR works well as is.
I agree with that. The exact line number could be obtained with some "hacks", but this will mess the code. |
Thank you @alfaro96 ! |
@thomasjpfan @adrinjalali Should we cherry pick this to 0.23.X already now without waiting for the rest of bug fixes? As users keeps hitting this, and there are already 3 opened issues. |
AFAIK there aren't any left that we're waiting for. I'm creating the release PR now. |
Reference Issues/PRs
This closes #17242, and closes #10542.
What does this implement/fix? Explain your changes.
Fixes the source code link for objects wrapped by a decorator. Previously, the path to the file where the decorator is defined was returned.