Skip to content
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

Fix broken link to proxy artists documentation #9343

Merged
merged 2 commits into from Oct 12, 2017

Conversation

deepyaman
Copy link
Contributor

@dstansby dstansby added this to the 2.1.1 (next bug fix release) milestone Oct 10, 2017
@dstansby
Copy link
Member

Thanks for opening a PR! We require any new code to require to the PEP8 guidelines - it looks like one of your added lines is too long (see here for the error https://travis-ci.org/matplotlib/matplotlib/jobs/286021773#L2930) - could you make it less than 80 characters long?

@deepyaman
Copy link
Contributor Author

@dstansby Thank you for your review. I was aware that it violates the 80-character rule of PEP8, but my understanding was that long URLs are an exception (for copying, readability, etc.). See https://google.github.io/styleguide/pyguide.html#Line_length, https://stackoverflow.com/questions/10739843/how-should-i-format-a-long-url-in-a-python-comment-and-still-be-pep8-compliant, or even from the matplotlib repo,

# http://matplotlib.org/users/navigation_toolbar.html#navigation-keyboard-shortcuts
I'd even prefer to put the whole URL on one line, but I moved the fragment to be consistent with the current version and more in line with the PEP8 recommendation.

That being said, if I should still make it less than 80 characters long, I can change it to the following:

            if handler is None:
                warnings.warn(
                    "Legend does not support {!r} instances.\nA proxy artist "
                    "may be used instead.\nSee: "
                    "http://matplotlib.org/users/legend_guide.html"
                    "#creating-artists-specifically-for-adding-to-the-legend-"
                    "aka-proxy-artists".format(orig_handle)
                )

@jklymak
Copy link
Member

jklymak commented Oct 10, 2017

Does #noqa work for pytest --pep8?

@anntzer
Copy link
Contributor

anntzer commented Oct 10, 2017

You can add entries in pytest.ini, but here I'd just split the string tbh (ignore entries in pytest.ini is a bit of a giant hammer).

@@ -616,11 +616,12 @@ def _init_legend_box(self, handles, labels, markerfirst=True):
for orig_handle, lab in zip(handles, labels):
handler = self.get_legend_handler(legend_handler_map, orig_handle)
if handler is None:
fragment = "#creating-artists-specifically-for-adding-to-the-legend-aka-proxy-artists"
Copy link
Member

Choose a reason for hiding this comment

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

you can also use \ to split a line

That is a bit of an absurd ref target...

Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

This looks good to me. Link works...

@dstansby dstansby merged commit 67ffdf7 into matplotlib:master Oct 12, 2017
@jklymak
Copy link
Member

jklymak commented Oct 12, 2017

Thanks @deepyaman !

dstansby added a commit that referenced this pull request Oct 15, 2017
@deepyaman deepyaman deleted the fix-proxy-artists-url branch April 19, 2021 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants