10000 Backport PR #17814 on branch v3.3.x (Don't duplicate deprecated parameter addendum.) by meeseeksmachine · Pull Request #17815 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Backport PR #17814 on branch v3.3.x (Don't duplicate deprecated parameter addendum.) #17815

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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions lib/matplotlib/cbook/deprecation.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ def func(used_arg, other_arg, unused, more_args): ...
f"Matplotlib internal error: {name!r} must be a parameter for "
f"{func.__name__}()")

addendum = kwargs.pop('addendum', None)

@functools.wraps(func)
def wrapper(*inner_args, **inner_kwargs):
arguments = signature.bind(*inner_args, **inner_kwargs).arguments
Expand All @@ -396,16 +398,15 @@ def wrapper(*inner_args, **inner_kwargs):
# wrappers always pass all arguments explicitly.
elif any(name in d and d[name] != _deprecated_parameter
for d in [arguments, arguments.get(kwargs_name, {})]):
addendum = (f"If any parameter follows {name!r}, they should be "
f"passed as keyword, not positionally.")
if kwargs.get("addendum"):
kwargs["addendum"] += " " + addendum
else:
kwargs["addendum"] = addendum
deprecation_addendum = (
f"If any parameter follows {name!r}, they should be passed as "
f"keyword, not positionally.")
warn_deprecated(
since,
name=repr(name),
obj_type=f"parameter of {func.__name__}()",
addendum=(addendum + " " + deprecation_addendum) if addendum
else deprecation_addendum,
**kwargs)
return func(*inner_args, **inner_kwargs)

Expand Down
0