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

Skip to content

Fix usages of warn_deprecated() #12823

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
Nov 23, 2018

Conversation

timhoffm
Copy link
Member

PR Summary

Fixes #12817.

@timhoffm timhoffm added this to the v3.1 milestone Nov 17, 2018
@@ -1311,7 +1311,7 @@ def set_adjustable(self, adjustable, share=False):
"""
if adjustable == 'box-forced':
cbook.warn_deprecated(
"2.2", "box-forced", obj_type="keyword argument")
"2.2", name="box-forced", obj_type="keyword argument")
Copy link
Member

Choose a reason for hiding this comment

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

passing obj_type is deprecated and has no effect. Probably doesn't make sense to have a deprecation warning trigger another deprecation warning if we can prevent it...

Copy link
Member Author

Choose a reason for hiding this comment

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

Where is that? I cannot find a deprecation of obj_type in the code. Have you maybe misinterpreded the docstring?

    obj_type : str, optional
        The object type being deprecated.

Copy link
Member

Choose a reason for hiding this comment

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

It was deprecated in #11395 because it does nothing.

@@ -290,7 +290,8 @@ def get_subplot_params(self, figure=None, fig=None):
parameters are from rcParams unless a figure attribute is set.
"""
if fig is not None:
cbook.warn_deprecated("2.2", "fig", obj_type="keyword argument",
cbook.warn_deprecated("2.2", name="fig",
obj_type="keyword argument",
Copy link
Member

Choose a reason for hiding this comment

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

obj_type has no effect and is deprecated.

@@ -382,7 +383,8 @@ def get_subplot_params(self, figure=None, fig=None):
"""Return a dictionary of subplot layout parameters.
"""
if fig is not None:
cbook.warn_deprecated("2.2", "fig", obj_type="keyword argument",
cbook.warn_deprecated("2.2", name="fig",
obj_type="keyword argument",
Copy link
Member

Choose a reason for hiding this comment

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

ditto

@WeatherGod
Copy link
Member

This should probably get backported to the v3.0.x branch, if possible. It does not need to be backported to the v2.2.x branch because that version did not use the kwarg-only syntax.

"for it will be removed %(removal)s.")
"3.0", message="Passing 'obj_type' to the 'deprecated' decorator "
"has no effect, and is deprecated since Matplotlib %(since)s; "
"support for it will be removed %(removal)s.")
Copy link
Member

Choose a reason for hiding this comment

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

I got confused by this over here. This is not confusing at all!

@anntzer
Copy link
Contributor

anntzer commented Nov 19, 2018

To clarify the situation:

  • Passing obj_type to the @deprecated decorator is deprecated, because the decorator would overwrite it with the type of the deprecated object anyways.
  • Passing obj_type to warn_deprecated is not deprecated, because there's no reason to.

So the PR looks fine.

@jklymak jklymak merged commit a4a7bd3 into matplotlib:master Nov 23, 2018
@jklymak jklymak modified the milestones: v3.1, v3.0.3 Nov 23, 2018
@jklymak
Copy link
Member

jklymak commented Nov 23, 2018

@meeseeksdev backport to v3.0.x

@lumberbot-app
Copy link

lumberbot-app bot commented Nov 23, 2018

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v3.0.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 a4a7bd3bed9aead117ef738cc7d71b9053ffaf4d
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #12823: Fix usages of warn_deprecated()'
  1. Push to a named branch :
git push YOURFORK v3.0.x:auto-backport-of-pr-12823-on-v3.0.x
  1. Create a PR against branch v3.0.x, I would have named this PR:

"Backport PR #12823 on branch v3.0.x"

And apply the correct labels and milestones.

Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon!

If these instruction are inaccurate, feel free to suggest an improvement.

@QuLogic
Copy link
Member

QuLogic commented Nov 23, 2018

Not sure why this needs a backport; the issue is tagged 3.1.

@dstansby dstansby modified the milestones: v3.0.3, v3.1.0 Jun 7, 2019
@timhoffm timhoffm deleted the fix-warn_deprecated-usages branch June 10, 2022 21:16
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.

Multiple places where Type Errors on cbook.warn_deprecated will happen
6 participants