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

Skip to content

Improve code generated by boilerplate.py #10309

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

Merged
merged 1 commit into from
Feb 2, 2018

Conversation

timhoffm
Copy link
Member

PR Summary

This PR improves the code generated by boilerplate.py. In particular

  • make the boilerplate-no-change-comment fit on one line (just aesthetics).
  • make the docstrings of the colormap-functions PEP8 conform.
  • change the code of the colormap functions to just calling set_colormap (the code from there was just duplicated). Below is an example of a changed colormap function as it's not easily readable in the diff.

Before:

def autumn():
    '''
    set the default colormap to autumn and apply to current image if any.
    See help(colormaps) for more information
    '''
    rc('image', cmap='autumn')
    im = gci()
    if im is not None:
        im.set_cmap(cm.autumn)

After:

def autumn():
    """
    Set the colormap to "autumn".

    This changes the default colormap as well as the colormap of the current
    image if there is one. See ``help(colormaps)`` for more information.
    """
    set_cmap("autumn")

@timhoffm timhoffm changed the title improve code generated by boilerplate.py Improve code generated by boilerplate.py Jan 24, 2018
@timhoffm timhoffm added this to the v2.2 milestone Jan 24, 2018
@anntzer
Copy link
Contributor

anntzer commented Jan 25, 2018

See also #9173...

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.

Needs to pass, but I think it will...

Yes @anntzer PR will gobble this one up, but this one doesn't hurt....

@dstansby
Copy link
Member

I think this might need a rebase to make the travis job pass

@timhoffm timhoffm force-pushed the improve-boilerplate branch from 079a445 to 087f312 Compare January 29, 2018 22:33
@timhoffm
Copy link
Member Author

timhoffm commented Feb 1, 2018

Do I have to do something about the codecov before merge? AFAICS none of the colormaps functions is tested and therefore all changed code is untested as well. But I don't think it's necessary to test these functions as they are trivial.

@jklymak
Copy link
Member

jklymak commented Feb 1, 2018

I think it not passing codecov is fine. I think if you want to be fancy you could tell codecov to not look at these files. Not merging, because this is a big enough change someone else should also look at it.

@dstansby dstansby merged commit db1cde0 into matplotlib:master Feb 2, 2018
@QuLogic QuLogic modified the milestones: needs sorting, v2.2.0 Feb 12, 2018
@timhoffm timhoffm deleted the improve-boilerplate branch December 17, 2018 20:39
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.

5 participants