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

Skip to content

fix warning used by cbook.warn_deprecated() #15302

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
Sep 22, 2019
Merged

fix warning used by cbook.warn_deprecated() #15302

merged 1 commit into from
Sep 22, 2019

Conversation

sameshl
Copy link
Contributor

@sameshl sameshl commented Sep 19, 2019

change warning class from UserWarning to MatplotlibDeprecationWarning

closes #15289

@sameshl
Copy link
Contributor Author

sameshl commented Sep 19, 2019

@timhoffm Could you have a look at this. I think the failures are unrelated to the PR

Thanks!

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Thanks for contributing! The catergory should be set one level deeper in _warn_deprecated. There are usages of _ warn_external that are not deprecation warnings. The test failures actually arise from this.

@sameshl
Copy link
Contributor Author

sameshl commented Sep 19, 2019

@timhoffm Thanks for helping.
I am not able to understand why setting category in _warn_deprecated is one level deeper than _warn_external. Isn't _warn_deprecated one level higher abstraction than _warn_external?.
Or did I understand you wrong?:sweat_smile:

@timhoffm
Copy link
Member

timhoffm commented Sep 19, 2019

Sorry to have caused confusion. Yes, you are right, this is actually one level higher.

Anyway, the point is warn_deprecated should call _warn_external(warning, category=MatplotlibDeprecationWarning).

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Should be squashed before merging.

@timhoffm timhoffm added this to the v3.3.0 milestone Sep 21, 2019
@sameshl
Copy link
Contributor Author

sameshl commented Sep 21, 2019

@timhoffm I think I have made a mistake while squashing the commits, could you have a look please and let me know what needs to be done. Thanks!

@timhoffm
Copy link
Member

You've apparently accidentially squashed some of your changes with an existing commit from master (a371ae4).

It's probably the most easy to start a new branch on top of current master. This is how I would do it (but there are many ways in git):

  1. Copy your 2018-09-18-AL.rst somewhere safe.
  2. git checkout master, git pull ustream master
  3. Remove the branch git branch -D cbook_warning
  4. Recreate the branch on top of master git checkout -b cbook_warning
  5. Cherry-pick your valid commit git cherry-pick b29a9db.
  6. Copy 2018-09-18-AL.rst back and amend your existing commit: git add 2018-09-18-AL.rst and git commit --amend --no-edit.
  7. Then force push git push origin cbook_warning --force

change warning class from UserWarning to MatplotlibDeprecationWarning

closes #15289
@sameshl
Copy link
Contributor Author

sameshl commented Sep 22, 2019

@timhoffm Thanks a lot for the detailed explanation and steps! 😄

@anntzer anntzer merged commit 95d89fe into matplotlib:master Sep 22, 2019
@sameshl sameshl deleted the cbook_warning branch September 22, 2019 12:03
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.

cbook.warn_deprecated() should warn with a MatplotlibDeprecationWarning not a UserWarning
3 participants